Why can't maxima solve...



Dear Dan,
Dear James,
Dear Andrei,
Dear Colleagues,

I have also attempted to use solve in order to solve James' equation,

> James Frye wrote:
> > ...something like this?
> >
> >   C1: f1(x):= x - 2 * sqrt (x);
> >   C2: solve (f(x) = 10, x);
> >
> > gives back
> >
> >   D2: [x = 2 SQRT(x) + 10]
> >
> > which IMHO isn't much of a solution :-)

but I also failed (even with solveexplicit : true):

(C1) display2d : false$
(C2) solve(x-2*sqrt(x)=10,x);
(D2) [x = 2*SQRT(x)+10]
(C3) solve(x-2*sqrt(x)=10,x), solveexplicit:true;
(D3) []

Therefore, Andrei's so recent code is the solution to this problem.
Many thanks, Andrei, for this code, which, I believe, will get
improved and incorporated into the Maxima's next distribution.

Incidentally, I found there is a package in Maxima 5.9.0, the
solver.mac package I was unaware of,

> This package is solver, a parametric equation solver, written by
> Eckhard Hennig and Ralf Sommer.  I have made some minor
> modifications to it so that it runs on maxima.
> I wish to thank Dr. Hennig for his donation of the solver code
> to the maxima project.
> Dan Stanger

which can be loaded (after copying its files to the algebra share
directory). I would like just to test this package too, but I failed
in the example below, based on the test.mac file in the distribution:

> block([s:solver([x+y+x^2=a,x-y=b],[x,y],[a,b])],print(s));
> block(
>   [s:solver([x+2*y-z=6,2*x + y*z - z^2 = -1, 3*x - y + 2*z^2 =
3],[x,y,z])],
>  print(s));

(C4) load(solver)$

(C5) s:solver([x+y+x^2=a,x-y=b],[x,y],[a,b]);
(D5) solver([y+x^2+x = a,x-y = b],[x,y],[a,b])

(C6) s:Solver([x+y+x^2=a,x-y=b],[x,y],[a,b]);
MACSYMA was unable to evaluate the predicate:
ERREXP1
#0: SetupSolver(equations=[y+x^2+x = a,x-y = b],
      solverparams=[[x,y],[a,b]])
#1: SOLVER(equations=[y+x^2+x = a,x-y = b],
     solverparams=[[x,y],[a,b]])(solver.mac line 451)
     -- an error.  Quitting.  To debug this try DEBUGMODE(TRUE);)

Can you, please, advise me, which is the correct command in
using Solver in the above example or in a different example?

Incidentally, I can add that Maxima can solve some more
complicated equations than simple polynomials with solve, e.g.

(C22) solve(-2^(x+5)+4^(x+3)=1,x), solveexplicit:true;
(D22) []
(C23) solve(-2^(x+5)+4^(x+3)=1,x), solveradcan:true;
(D23) [x = (LOG(2-SQRT(5))-3*LOG(2))/LOG(2),
       x = (LOG(SQRT(5)+2)-3*LOG(2))/LOG(2)]

some trigonometric and logarithmic equations too, but I do not
know exactly which is the class of equations which can be solved.

Many sincere thanks in advance and best regards from Patras,

Nikos

> --- "Andrei Zorine" <zoav1@uic.nnov.ru>

> Hello James,
> funny to find this letter in  the morning, because I've spent last night
> teaching Maxima to solve irrational equations :)) I attach the code I
> have so far.
>
> Maxima has the ability to solve systems of polinomial equations (do
> describe(solve)) only.
>
> The procedure goes thru the expr from leaves to top, substituting all
> irrational subexpressions containing vars with new variables and adds
> rational equations to define these new variables. Finally it gets the
> system of polynoimial equations and algsys tries to solve it. then all
> the solutiona are substed into initial equations to check which are the
> proper solutions.
>
> The problems I've faced so far: 1)Algsys is slooooow 2) substituting
> even correct solution into initial equations doesn't always simplify to
> true 3) Usually Algsys gives approximate solutions (I know, I can alter
> it  adjusting algexact, but it leads to 'quotient is not exact' errors,
> like in algsys([S1-3*S2=2,(x+3)*S1^6=(x-5),(x-5)*S2^6=(x+3)],[S1,S2,x])).
>
> Can somebody give advice concerning the problems mentioned above?
>
> Example session:
> (C21) solve\-irrat(sqrt(1+x)=2,[x]);
>
> [x]
> G22262 = 2
>         2
> [G22262  = x + 1]
> [[G22262 = 2, x = 3]]
> (D21)    [[x = 3]]
>
> --
> Andrei Zorine