Variable not found while trying to plot a parametric phase portrait
I'm trying to plot a parametric phase portrait of a differential equations system, but i get the following error:
ValueError: Variable 't' not found
Here's what I'm trying to do:
@interact
def _(a1 = slider(-30, 30, 0.001, default=0, label='a1'),
b1 = slider(-30, 30, 0.001, default=0, label='b1'),
a2 = slider(-30, 30, 0.001, default=0, label='a2'),
b2 = slider(-30, 30, 0.001, default=0, label='b2'),
g1 = slider(-30, 30, 0.001, default=0, label='g1'),
g2 = slider(-30, 30, 0.001, default=0, label='g2'),
auto_update=True):
discriminant = b2^2-2*b1*b2+b1^2+4*a1*a2
pretty_print("discriminant = " + str(discriminant))
if discriminant >= 0:
t = var('t')
M1 = function('M_1', t)
M2 = function('M_2', t)
de1 = diff(M1,t) == a1 * M2 - b1 * M1 + g1
de2 = diff(M2,t) == a2 * M1 - b2 * M2 + g2
plot_vector_field((de1.rhs(),de2.rhs()),(M1,-3,3),(M2,-3,3))
else:
pretty_print("discriminant is negative. adjust parameters")
Can't really figure out why is t not found and how to fix it