Hi, I'd like to numerically integrate a simple pendulum problem:

y'' = -9.8*cos(y)

y(0)  = 0
y'(0) = 0

I have tried this code (based on the Lotka-Volterra example in the Sage 
documentation):

from sage.calculus.desolvers import desolve_odeint
y,yd = var('y,yd')
f    = [0,-9.8*cos(y)]
v    = [y,yd]
t    = srange(0,10,0.1)
ci   = [0,1]
sol = desolve_odeint(f,ci,t,v,rtol=1e-3,atol=1e-4,h0=0.1,hmax=1,hmin=1e-4,
mxstep=1000)
p2 = line(zip(t,sol[:,0]))
p2.show()
which gave this output:
Traceback (most recent call last):    sol = desolve_odeint(f,ci,t,v,rtol=
1e-3,atol=1e-4,h0=0.1,hmax=1,hmin=1e-4,mxstep=1000)
  File "", line 1, in <module>
    
  File "/tmp/tmpowXVlu/___code___.py", line 9, in <module>
    sol = desolve_odeint(f,ci,t,v,rtol=_sage_const_1en3 ,atol=_sage_const_1en4 
,h0=_sage_const_0p1 ,hmax=_sage_const_1 ,hmin=_sage_const_1en4 
,mxstep=_sage_const_1000 
)
  File 
"/home/sage/sage-6.6/local/lib/python2.7/site-packages/sage/calculus/desolvers.py"
, line 1487, in desolve_odeint
    all_vars.update(set(de.variables()))
  File "sage/structure/element.pyx", line 430, in sage.structure.element.
Element.__getattr__ (build/cythonized/sage/structure/element.c:4625)
  File "sage/structure/misc.pyx", line 257, in 
sage.structure.misc.getattr_from_other_class 
(build/cythonized/sage/structure/misc.c:1772)
AttributeError: 'sage.rings.integer.Integer' object has no attribute 
'variables'

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to