In this case, the following works:

sage: t = var('t')
sage: x = function('x',t)
sage: DE = lambda y: diff(y,t,t) + y
sage: f = eval(desolve_laplace(DE(x(t)), ["t","x"], [0,1,0]))
sage: f(t)
cos(t)

(However, for other problems, this trick will not work so well.)
I know about the problem with desolve and don't know how
to "fix" it (though, it is actually documented that way, as you will see if
you type desolve?). Sorry.


On Tue, Jan 20, 2009 at 6:29 PM, MacosX12345 <[email protected]> wrote:
>
>  Dear All,
>
>  I did not find the answer to this elementary question elsewhere ---
> please apologize if it was already answered.
>
>  I want to solve the 2nd order ODE y''(x)+y(x)=0 with initial
> conditions y(0)=1, y'(0)=0. Obviously the solution is unique and it is
> y(x)=cos(x). Let's try:
>
> x=var('x')
> y=function('y',x)
> desolve(diff(y,x,2)+y(x)==0,y,[0,1,0])
>
> Answer from SAGE:
>
> y(0)*cos(x)
>
> Why isn't the answer simply cos(x)? Similarly, if I try with initial
> conditions y(0)=0,y'(0)=1, instead of sin(x) I get sin(x)+y(0)*cos(x).
>
>  However, I checked that Maxima (which, I understood, SAGE drives to
> solve the ODE) gives the correct answer:
> -----------------------------------------------------------------------
> Maxima 5.16.3 http://maxima.sourceforge.net
> Using Lisp SBCL 1.0.22
> Distributed under the GNU Public License. See the file COPYING.
> Dedicated to the memory of William Schelter.
> The function bug_report() provides bug reporting information.
> (%i1) s: ode2('diff(y,x,2)+y,y,x);
> (%o1)                     y = %k1 sin(x) + %k2 cos(x)
> (%i2) ic2(s,x=0,y=1,'diff(y,x)=0);
> (%o2)                             y = cos(x)
> -----------------------------------------------------------------------
>
>  Thanks for your advice.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to