Ask Your Question

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

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

Hoss N. Feffer gravatar image

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

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()?


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

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

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?

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

Is  %k1  positive or negative?

(%o19) [(sqrt(2)*log((sqrt(-(%k1*y-1)/y)-sqrt(-%k1))
          = x+%k2,
          = 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


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

Seen: 731 times

Last updated: Oct 24 '14