Plotting a sympy function. Strange xlim behavior

Viewed 55

I try to plot a sympy function from 0 to 120 by using this code :

def symbolicCalc():
    A0, k1, k2, t = sp.symbols("A0 k1 k2 t",real=True)
    fSymb=A0*(1-(k1+k2*A0)/(k2*A0+k1*sp.exp((k1+k2*A0)*t)))
    sp.plotting.plot(fSymb.subs([(A0,70),(k1,8e-4),(k2,1.5e-3)]),xlim=[0,120],ylim=[0,100])

symbolicCalc()

And I obtain the following figure :

enter image description here

How can I have a plot from 0 to 120 ?

Thanks for answer

1 Answers

Ok, I solved my problem by adding (t,0,120)

def symbolicCalc():
    A0, k1, k2, t = sp.symbols("A0 k1 k2 t",real=True)
    fSymb=A0*(1-(k1+k2*A0)/(k2*A0+k1*sp.exp((k1+k2*A0)*t)))
    sp.plotting.plot(fSymb.subs([(A0,70),(k1,8e-4),(k2,1.5e-3)]),(t,0,120),xlim=[0,120],ylim=[0,100])

symbolicCalc()
Related