Interactive solving differential equations with MAXIMA's desolve

asked 2017-05-09 16:48:50 +0200

bekalph gravatar image

I am using Maxima's "desolve" to handle a system of linear differential equations. During processing, Maxima arrives at an intermediate expression (in my case this is a complicated argument of a sqareroot) that may be positive, negative or zero. Maxima asks me interactively if this expression is negative, positive or zero. If I use "desolve" directly within the Maxima's notebook, I can give my answer interactively (e.g., "pos") to Maxima. Consequently, Maxima can continue processing immediately. Thus, in Maxima's notebook there is no need to use an 'assume' statement that includes the whole complicate expression in question. On the contrary, processing this system via Maxima's 'desolve ' at a sage's notebook is very inconvenient, since, according to sage's documentation, one can answer such questions only via assumes given prior to 'desolve'. Moreover, in the treated case Maxima ignores such 'assume'-statements. Thus, solving my equation system at Maxima via sage turns out to be impossible.
Thus my question: Is it really impossible to answer Maxima's interactive questions via sage? If not, one should implement this feature in future save-versions. This would enable sage to solve linear differential equations that cannot be treated by sage up to now.

Here is a simlpe executable example for interactive working with Maxima. (Members of Maxima's discussion forum gave this example to me for demonstration) I tried to answer this question interactively at a sage- notebook. Unfortunately, This leads to a deadlock in the sage-platform (version 7.4).

(%i1) integrate(x^a,x);
 Is a equal to -1?   

 no; 
 (%o1) x^(a+1)/(a+1)
edit retag flag offensive close merge delete

Comments

assume is used in some tests of desolvers.py. do you want to post some instance of your system of equations? the integrate example works in the sagemath cell (currently runs v.7.6)

mforets gravatar imagemforets ( 2017-05-09 18:01:26 +0200 )edit

It's definitely possible to write some modified maxima interface that passes through questions and collects questions to them somehow; see https://github.com/sagemath/sage/blob... You'd have to put some code there that suspends lisp, calls back into python, collects the answer, and resumes lisp. The problem is designing an interface that fits in sage properly. The sage library doesn't assume there is a user available to ask information. You could build something on top of sage that does make such an assumption, of course. But why would you? Just use Maxima. By the time you need input from a user you're not automating tasks anyway. You just need a way to save&load results between sage & maxima (if cut/paste doesn't cut it)

nbruin gravatar imagenbruin ( 2017-05-09 20:09:06 +0200 )edit