Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

type error solving system of differential equations numerically

R = 5 g = 9.8 t = var('t') x = function('x')(t) y = function('y')(t) de1 = diff(x,t) - y == 0 de2 = diff(y,t) + (g/R)sin(x) == 0 desolve_system_rk4([de1,de2],[x,y],ics = [0,(20/180)pi,0],ivar=t)

type error solving system of differential equations numerically

R = 5 g = 9.8 t = var('t') x = function('x')(t) y = function('y')(t) de1 = diff(x,t) - y == 0 de2 = diff(y,t) + (g/R)sin(x) == 0 desolve_system_rk4([de1,de2],[x,y],ics = [0,(20/180)pi,0],ivar=t)

type error solving system of differential equations numerically

I tried to solve a differential system numerically as follows:

R = 5
 g = 9.8
 t = var('t')
 x = function('x')(t)
 y = function('y')(t)
 de1 = diff(x,t) - y == 0
de2 = diff(y,t) + (g/R)*sin(x) == 0
desolve_system_rk4([de1,de2],[x,y],ics = [0,(20/180)*pi,0],ivar=t)

and got a type error:

Traceback (most recent call last)
...
TypeError: Error executing code in Maxima
CODE:
 de2 = diff(y,t) + (g/R)sin(x) == 0
sage4 : rk(['diff('x(_SAGE_VAR_t),_SAGE_VAR_t,1)-'y(_SAGE_VAR_t)=0,'diff('y(_SAGE_VAR_t),_SAGE_VAR_t,1)+1.96*sin('x(_SAGE_VAR_t))=0],['x(_SAGE_VAR_t),'y(_SAGE_VAR_t)],[%pi/9,0],[_SAGE_VAR_t,0,10,0.1])  desolve_system_rk4([de1,de2],[x,y],ics = [0,(20/180)pi,0],ivar=t)

$ Maxima ERROR: rk: variable name expected; found: 'x(_SAGE_VAR_t) -- an error. To debug this try: debugmode(true);