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[0],a[1]] for a in ans]
tv=[[a[0],a[2]] for a in ans]
line(ty)+line(tv,color='red')