Python function in ODE not producing needed results
I am using the
dirac_delta function in an ODE, and since it is treated like a Python function, it is not evaluated as I would like in the ODE solver. I think this is a matter of having a Python function when I need a symbolic function, but I cannot figure out how to get around it. My code is below. Any ideas?
var('A p y t s v') A=3 p=2 alpha = 1 beta = -1/sqrt(3) omega = 1 F(t) = [SR(1),v,-omega^2*y+A*dirac_delta(t-p)] ans=desolve_odeint(F(t),[0,alpha,beta],srange(0,5,0.1),[s,y,v],ivar=t) ty=[[a,a] for a in ans] tv=[[a,a] for a in ans] line(ty)+line(tv,color='red')