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)
1 | initial version |
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)
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)
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);