Changes between Version 3 and Version 5 of Ticket #11653
 Timestamp:
 08/06/11 02:09:19 (9 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

Ticket #11653
 Property Cc kcrisman nbruin added; sjm.guzman@… removed
 Property Keywords maxima at desolve added

Property
Authors
changed from
JGuzman
to

Ticket #11653 – Description
v3 v5 1 1 When trying to solve a simple ODE whose rhs contains a function, Sage fails to interpret the Maxima output. 2 2 3 Here a minimal example is #========================================================================= sage: x=var('x') # independent variable 4 3 Here a minimal example is 4 {{{ 5 #===================== 6 sage: x=var('x') # independent variable 5 7 sage: v=function('v', x) # dependent variable 6 8 7 9 # we define a custom square pulse function 8 9 10 def pulse(tonset, tdur, amp): 10 11 """ returns a square pulse as a function of x, f(x) the pulse is defined as follows: t onset  start of pulse tdur  duration of pulse amp  amplitude of pulse """ 12 11 """ 12 returns a square pulse as a function of x, f(x) 13 the pulse is defined as follows: 14 t onset  start of pulse 15 tdur  duration of pulse 16 amp  amplitude of pulse 17 """ 13 18 f(x)= amp*(sign(xtonset)/2sign(xtonsettdur)/2) 14 15 19 return f 16 20 17 21 # create my pulse function 18 19 22 sage: mypulse = pulse(tonset=5, tdur=5, amp=2) 20 23 21 24 # define differential equation s 22 23 25 sage: dvdx = diff(v, x)x mypulse == 0 # mypulse(x) is function 24 26 25 27 # get the evolution of v 26 27 28 myvolt = desolve(de=dvdx, ivar=x, dvar=v, ics=[0,0]) 28 29 29 #========================================================================= The error message is: 30 #======= 31 The error message is: 30 32 31 33 ''TypeError: unable to make sense of Maxima expression 'v(x)=(2*(at(integrate(signum(x5)signum(x13),x),[x=0,v(x)=0]))2*int\ egrate(signum(x5)signum(x13),x)x^2)/2' in Sage^'' 32 34 }}} 33 35 desolve_laplace leads to similar error: 34 36 {{{ 35 37 sage: desolve(de=dvdx, ivar=x, dvar=v, ics=[0,0]) 36 38 37 39 ''TypeError: unable to make sense of Maxima expression 'ilt(((laplace(signum(x5),x,?g2733)laplace(signum(x13),x,?g2733)+v(0)\ )*?g2733^2+1)/?g2733^3,?g2733,x)' in Sage'' 38 40 }}} 39 41 According to Nils Bruin, the problem is that Maxima 'at' function. As described in Ticket #385, this can be a problem with the implementation of 'at' for SR. 40 42 41 43 Strange enough, when using other functions, the solver works nicely 42 44 {{{ 43 45 sage: dvdx = diff(v, x)x sin(x) == 0 44 46 45 47 sage: desolve(de=dvdx, ivar=x, dvar=v, ics=[http://trac.sagemath.org/sage_trac/log/?revs=0 "[0,0]"]) 46 48 }}} 47 49 now Sage returns 1/2*x!^2  cos(x) + 1 48 50