On Feb 1, 2009, at 3:42 PM, David Joyner wrote: > On Sun, Feb 1, 2009 at 5:34 PM, Christophe Deroulers > <[email protected]> wrote: >> > >> >> When one looks at what Sage sends to Maxima when "desolve(diff(y,x, >> 2)+y(x)==0,y,[0,3,2])" is called, it turns out that Maxima receives >> something like >> >> my_ode: diff('y(x),x,2) + 'y(x) = 0; >> my_sol: ode2(my_ode, 'y(x), x); >> ic2(my_sol, x=0, 'y(x)=2, diff('y(x),x)=3); >> >> and then Maxima returns "y(x) = 3 sin(x) + y(0) cos(x)", whereas the >> documentation of Maxima's ode2 seems to expect that one should type: >> >> my_ode: 'diff(y,x,2) + y = 0; >> my_sol: ode2(my_ode, y, x); >> ic2(my_sol, x=0, y=2, 'diff(y,x)=3); >> >> in which case Maxima returns "y = 3 sin(x) + 2 cos(x)" (the expected >> answer). >> > > Thanks, this is very interesting. > > > In this case, it seems that the subfunction > > def to_eqns(lhs, exprs): > eqns = [] > for lhs, expr in zip(lhs, exprs): > if isinstance(expr, SymbolicEquation): > eqns.append(expr) > else: > if lhs == dvar and len(exprs) == 2: > ivar_ic = exprs[0] # figure this out... > lhs = lhs._f(ivar_ic) > eqns.append(lhs == expr) > > in desolver needs to be modified somehow. It sets the > syntax of the initial conditions passed to maxima. > > > >> Therefore, one could think of: >> > ... >> >> (3) Patching Sage so that it checks that there is no y(0) left in the >> solution and, if any, eliminates it by calling solve and >> substituting. >> >> (4) Modifying Sage to that it sends to Maxima's ode2 and ic2 >> functions >> what they actually expect (i.e. an O.D.E. and I.C. with y, not 'y >> (x)). >> > > > I think this is the most natural way to go but I don't see how to > do it.
For sure this is the way to do it. I'm not sure what maxima expects, but it shouldn't be too hard (I wrote the above code quickly one morning for a demo, knowing nothing about Maxima's DE solvers beforehand, and didn't have time to flush it out fully). - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
