# solve maxima?

The following in Jupyter (and sage cloud) produces the wrong output. I do have an (extremely similar) maxima batch file that works fine. I sort of presume that maxima "solve" is not really called. If needed I can provide all files and stuff; either link or inline. Or if the correct way to use maxima/solve isn't obvious I can shorten up the generation of the solve argument by direct assignment. The last commented line is to prove that simpler problems yield the correct same answers in sagemath and maxima; when sagemath feels like. jupyter:

%display latex
var('A B C D M r')
T =matrix([[A,B],[C,D]]);
m=1-2M/r
G =matrix([[-m,0],[0,1/m]])
k = T.transpose()
GT
eq1=k[0,0];
eq2=k[0,1];
eq3=k[1,0];
eq4=k[1,1];
eqd=A
D-BC-1
eqd
sol=solve([eq1+m==0,eq3-sqrt(2
M/r)==0,eq4-1==0,eqd==0],[A,B,C,D]);
sol

#### -comment---solve([eq1+m==0,eq3-sqrt(2*M/r)==0],[A,B])

Produces:
$\newcommand{\Bold}[1]{\mathbf{#1}}\left[-B C + A D - 1 = 0, A^{2} {\left(\frac{2 \cdot M}{r} - 1\right)} - \frac{C^{2}}{\frac{2 \cdot M}{r} - 1} - \frac{2 \, M}{r} + 1 = 0, A B {\left(\frac{2 \cdot M}{r} - 1\right)} - \frac{C D}{\frac{2 \cdot M}{r} - 1} - \sqrt{2} \sqrt{\frac{M}{r}} = 0, B^{2} {\left(\frac{2 \, M}{r} - 1\right)} - \frac{D^{2}}{\frac{2 \, M}{r} - 1} - 1 = 0\right]$

Whereas : a maxima script produces

${\left[ \left[ A=-1 , B={{\sqrt{2} \cdot r \cdot \sqrt{{{M}\over{r}}}}\over{r-2\cdot M}} , C=0 , D=-1 \right] , \left[ A=1 , B=-{{\sqrt{2} \cdot r \cdot \sqrt{{{M}\over{r}}}}\over{r-2\cdot M}}, C=0 , D=1 \right] \right] }$

edit retag close merge delete

Sort by » oldest newest most voted

The answer given by sage is not wrong. It just returns the system of equations (unchanged disregarding the order). If you add C==0 to the system of equations, sages gives the answer you got from maxima. But if you add D==x, sage gives a general solution that shows A,B,C dependent from x. May be, there are some (hidden) restrictions in the maxima code producing only two solutions.

more

Your system of equations is underdetermined, so Sage is doing its job by not returning any solution. If you

1) use eq1 and eq4 to eliminate C and D
2) add and subtract the remaining equations
3) rearrange by factoring

you'll see that the remaining two equations are algebraic inverses of each other, i.e., the same equation. You can't get a solution without additional constraints on the functions.

more

You are saying that sagemath can't give multiple solutions? Or is maxima wrong? In other words: what is the semantic difference between solve in sagemath and maxima? I know that maxima doesn't always find all the answers but I haven't had it give me a wrong one. I do know that underdetermined equation sets yield parametric or multiple solutions.

( 2017-01-08 00:03:28 +0200 )edit

solve in SageMath calls Maxima's solve by default (here's where it happens in the source code), so they're the same.

( 2017-01-09 20:35:24 +0200 )edit