Ask Your Question
1

2nd-order ODE: Maxima wants sign of 1 constant before finishing

asked 2014-10-24 17:16:29 +0100

Hoss N. Feffer gravatar image

updated 2014-10-24 17:19:45 +0100

I'm trying to solve a 2nd-order nonlinear ODE using desolve(). Maxima gets partway through, but then asks for the sign of one of the integration constants. How can I tell it to assume something that doesn't exist before I call desolve()?

t,P,x0=var('t,P,x0')
x=function('x',t)
de=(diff(x,t,2)*x^2+P==0)
forget()
assume(P>0,x0>0)
desolve(de,x,ics=[0,x0,0],ivar=t)

gives the error:

TypeError: ECL says: Maxima asks: Is  %k1  positive or negative?
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-10-24 18:08:25 +0100

kcrisman gravatar image

That is a very good question, and my answer will both be workarounds. I'm not sure we can solve this directly because of the way we interact with Maxima. Below is some gory detail of trying to do it directly in Maxima.


That will be annoying because the syntax will be different, but then you could answer the question. Unfortunately, the syntax is not nice, and took me a bit of reading through our code for desolve?? as well as the Maxima desolve docs.

But in fact the solution doesn't even seem to solve it - there is a y on the left hand side in several places. I'm also not sure why x0 doesn't appear, but I suspect it has something to do with the reason it asks a question - probably there is some two integrations happening internally and it's not getting the initial condition in right?

sage: maxima_console()

<snip stuff>

(%o13) [x0 > 0]
(%i14) assume(P>0);

(%o14) [P > 0]
(%i15) atvalue(y(x),x=0,x0);

(%o15) x0
(%i16) atvalue('diff(y(x),x),x=0,0);

(%o16) 0
(%i17) display2d:false;

(%o17) false
(%i18) ode2('diff(y,x,2)*y^2+P,y,x);

Is  %k1  positive or negative?

p;
(%o18) [(sqrt(2)*atan(sqrt(-(%k1*y-1)/y)/sqrt(%k1))
         +sqrt(2)*sqrt(%k1)*y*sqrt(-(%k1*y-1)/y))
         /(2*%k1^(3/2)*sqrt(P))
          = x+%k2,
        -(sqrt(2)*atan(sqrt(-(%k1*y-1)/y)/sqrt(%k1))
         +sqrt(2)*sqrt(%k1)*y*sqrt(-(%k1*y-1)/y))
         /(2*%k1^(3/2)*sqrt(P))
          = x+%k2]
(%i19) ode2('diff(y,x,2)*y^2+P,y,x);

Is  %k1  positive or negative?

n;
(%o19) [(sqrt(2)*log((sqrt(-(%k1*y-1)/y)-sqrt(-%k1))
                      /(sqrt(-(%k1*y-1)/y)+sqrt(-%k1)))
         +2^(3/2)*sqrt(-%k1)*y*sqrt(-(%k1*y-1)/y))
         /(4*sqrt(-%k1)*%k1*sqrt(P))
          = x+%k2,
        -(sqrt(2)*log((sqrt(-(%k1*y-1)/y)-sqrt(-%k1))
                       /(sqrt(-(%k1*y-1)/y)+sqrt(-%k1)))
         +2^(3/2)*sqrt(-%k1)*y*sqrt(-(%k1*y-1)/y))
         /(4*sqrt(-%k1)*%k1*sqrt(P))
          = x+%k2]
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-10-24 17:16:29 +0100

Seen: 773 times

Last updated: Oct 24 '14