1 | initial version |
You can do this using desolve_odeint
. I'm not sure why it's not working in desolve_rk4
. Try this:
var('t s V')
def f(t):
if t<5:
return 3
else:
return 0
def rhs(V,s,t):
return ((f(t)-V)/(2.3*1.2))
F=[SR(1),rhs]
tlist=srange(0,10,0.1)
ans=desolve_odeint(F,[0,10],tlist,[s,V],ivar=t)
line(ans)