2 * Functions and Variables for Equations::
3 * Examples for algsys::
4 * References for equations::
7 @c -----------------------------------------------------------------------------
8 @node Functions and Variables for Equations, , Equations, Equations
9 @section Functions and Variables for Equations
10 @c -----------------------------------------------------------------------------
13 @defvr {System variable} %rnum
14 Default value: @code{0}
16 @code{%rnum} is the counter for the @code{%r} variables introduced in solutions by
17 @mref{solve} and @mrefdot{algsys}. The next @code{%r} variable is numbered
20 See also @mref{%rnum_list}.
22 @opencatbox{Categories:}
23 @category{Algebraic equations}
27 @c -----------------------------------------------------------------------------
29 @defvr {System variable} %rnum_list
30 Default value: @code{[]}
32 @code{%rnum_list} is the list of variables introduced in solutions by
33 @mref{solve} and @mrefdot{algsys} @code{%r} variables are added to
34 @code{%rnum_list} in the order they are created. This is convenient for doing
35 substitutions into the solution later on.
37 See also @mref{%rnum}.
39 @c WHAT DOES THIS STATEMENT MEAN ??
40 It's recommended to use this list rather than doing @code{concat ('%r, j)}.
43 @c solve ([x + y = 3], [x,y]);
45 @c sol : solve ([x + 2*y + 3*z = 4], [x,y,z]);
47 @c for i : 1 thru length (%rnum_list) do
48 @c sol : subst (t[i], %rnum_list[i], sol)$
53 (%i1) solve ([x + y = 3], [x,y]);
54 (%o1) [[x = 3 - %r1, y = %r1]]
61 (%i3) sol : solve ([x + 2*y + 3*z = 4], [x,y,z]);
62 (%o3) [[x = - 2 %r3 - 3 %r2 + 4, y = %r3, z = %r2]]
69 (%i5) for i : 1 thru length (%rnum_list) do
70 sol : subst (t[i], %rnum_list[i], sol)$
74 (%o6) [[x = - 2 t - 3 t + 4, y = t , z = t ]]
79 @opencatbox{Categories:}
80 @category{Algebraic equations}
84 @c -----------------------------------------------------------------------------
86 @defvr {Option variable} algepsilon
89 @c WHAT IS algepsilon, EXACTLY ??? describe ("algsys") IS NOT VERY INFORMATIVE !!!
90 @code{algepsilon} is used by @mrefdot{algsys}
92 @opencatbox{Categories:}
93 @category{Algebraic equations}
97 @c -----------------------------------------------------------------------------
99 @defvr {Option variable} algexact
100 Default value: @code{false}
102 @code{algexact} affects the behavior of @mref{algsys} as follows:
104 If @code{algexact} is @code{true}, @code{algsys} always calls @mref{solve} and
105 then uses @mref{realroots} on @code{solve}'s failures.
107 If @code{algexact} is @code{false}, @code{solve} is called only if the
108 eliminant was not univariate, or if it was a quadratic or biquadratic.
110 Thus @code{algexact: true} does not guarantee only exact solutions, just that
111 @code{algsys} will first try as hard as it can to give exact solutions, and
112 only yield approximations when all else fails.
114 @c ABOVE DESCRIPTION NOT TOO CLEAR -- MAYBE EXAMPLES WILL HELP
116 @opencatbox{Categories:}
117 @category{Algebraic equations}
121 @c -----------------------------------------------------------------------------
123 @deffn {Function} algsys @
124 @fname{algsys} ([@var{expr_1}, @dots{}, @var{expr_m}], [@var{x_1}, @dots{}, @var{x_n}]) @
125 @fname{algsys} ([@var{eqn_1}, @dots{}, @var{eqn_m}], [@var{x_1}, @dots{}, @var{x_n}])
127 Solves the simultaneous polynomials @var{expr_1}, @dots{}, @var{expr_m} or
128 polynomial equations @var{eqn_1}, @dots{}, @var{eqn_m} for the variables
129 @var{x_1}, @dots{}, @var{x_n}. An expression @var{expr} is equivalent to an
130 equation @code{@var{expr} = 0}. There may be more equations than variables or
133 @code{algsys} returns a list of solutions, with each solution given as a list
134 of equations stating values of the variables @var{x_1}, @dots{}, @var{x_n}
135 which satisfy the system of equations. If @code{algsys} cannot find a solution,
136 an empty list @code{[]} is returned.
138 The symbols @code{%r1}, @code{%r2}, @dots{}, are introduced as needed to
139 represent arbitrary parameters in the solution; these variables are also
140 appended to the list @mrefdot{%rnum_list}
142 The method is as follows:
146 First the equations are factored and split into subsystems.
149 For each subsystem @var{S_i}, an equation @var{E} and a variable @var{x} are
150 selected. The variable is chosen to have lowest nonzero degree. Then the
151 resultant of @var{E} and @var{E_j} with respect to @var{x} is computed for each
152 of the remaining equations @var{E_j} in the subsystem @var{S_i}. This yields a
153 new subsystem @var{S_i'} in one fewer variables, as @var{x} has been eliminated.
154 The process now returns to (1).
157 Eventually, a subsystem consisting of a single equation is obtained. If the
158 equation is multivariate and no approximations in the form of floating point
159 numbers have been introduced, then @mref{solve} is called to find an exact
162 In some cases, @code{solve} is not be able to find a solution, or if it does
163 the solution may be a very large expression.
165 @c REMAINDER OF (3) IS PRETTY COMPLEX. HOW CAN IT BE CLARIFIED ??
166 If the equation is univariate and is either linear, quadratic, or biquadratic,
167 then again @code{solve} is called if no approximations have been introduced.
168 If approximations have been introduced or the equation is not univariate and
169 neither linear, quadratic, or biquadratic, then if the switch
170 @mref{realonly} is @code{true}, the function @mref{realroots} is called to find
171 the real-valued solutions. If @code{realonly} is @code{false}, then
172 @mref{allroots} is called which looks for real and complex-valued solutions.
174 If @code{algsys} produces a solution which has fewer significant digits than
175 required, the user can change the value of @mref{algepsilon} to a higher value.
177 If @code{algexact} is set to @code{true}, @code{solve} will always be called.
178 @c algepsilon IS IN Floating.texi -- MAY WANT TO BRING IT INTO THIS FILE
181 Finally, the solutions obtained in step (3) are substituted into
182 previous levels and the solution process returns to (1).
183 @c "PREVIOUS LEVELS" -- WHAT ARE THOSE ??
186 When @code{algsys} encounters a multivariate equation which contains floating
187 point approximations (usually due to its failing to find exact solutions at an
188 earlier stage), then it does not attempt to apply exact methods to such
189 equations and instead prints the message:
190 "@code{algsys} cannot solve - system too complicated."
192 Interactions with @mref{radcan} can produce large or complicated expressions.
193 In that case, it may be possible to isolate parts of the result with
194 @mref{pickapart} or @mrefdot{reveal}
196 Occasionally, @code{radcan} may introduce an imaginary unit @code{%i} into a
197 solution which is actually real-valued.
202 @c e1: 2*x*(1 - a1) - 2*(x - 1)*a2;
204 @c e3: a1*(-y - x^2 + 1);
205 @c e4: a2*(y - (x - 1)^2);
206 @c algsys ([e1, e2, e3, e4], [x, y, a1, a2]);
208 @c e2: -1 - y + 2*y^2 - x + x^2;
209 @c algsys ([e1, e2], [x, y]);
213 (%i1) e1: 2*x*(1 - a1) - 2*(x - 1)*a2;
214 (%o1) 2 (1 - a1) x - 2 a2 (x - 1)
221 (%i3) e3: a1*(-y - x^2 + 1);
223 (%o3) a1 (- y - x + 1)
226 (%i4) e4: a2*(y - (x - 1)^2);
228 (%o4) a2 (y - (x - 1) )
231 (%i5) algsys ([e1, e2, e3, e4], [x, y, a1, a2]);
232 (%o5) [[x = 0, y = %r1, a1 = 0, a2 = 0],
233 [x = 1, y = 0, a1 = 1, a2 = 1]]
241 (%i7) e2: -1 - y + 2*y^2 - x + x^2;
243 (%o7) 2 y - y + x - x - 1
246 (%i8) algsys ([e1, e2], [x, y]);
248 (%o8) [[x = - -------, y = -------],
251 [x = -------, y = - -------], [x = - -, y = - -], [x = 1, y = 1]]
256 @opencatbox{Categories:}
257 @category{Algebraic equations}
261 @c -----------------------------------------------------------------------------
263 @deffn {Function} allroots @
264 @fname{allroots} (@var{expr}) @
265 @fname{allroots} (@var{eqn})
267 Computes numerical approximations of the real and complex roots of the
268 polynomial @var{expr} or polynomial equation @var{eqn} of one variable.
270 The flag @mref{polyfactor} when @code{true} causes @code{allroots} to factor
271 the polynomial over the real numbers if the polynomial is real, or over the
272 complex numbers, if the polynomial is complex.
274 @code{allroots} may give inaccurate results in case of multiple roots.
275 If the polynomial is real, @code{allroots (%i*@var{p})} may yield
276 more accurate approximations than @code{allroots (@var{p})}, as @code{allroots}
277 invokes a different algorithm in that case.
279 @code{allroots} rejects non-polynomials. It requires that the numerator
280 after @code{rat}'ing should be a polynomial, and it requires that the
281 denominator be at most a complex number. As a result of this @code{allroots}
282 will always return an equivalent (but factored) expression, if
283 @code{polyfactor} is @code{true}.
285 For complex polynomials an algorithm by Jenkins and Traub is used
286 (Algorithm 419, @i{Comm. ACM}, vol. 15, (1972), p. 97). For real polynomials
287 the algorithm used is due to Jenkins (Algorithm 493, @i{ACM TOMS}, vol. 1,
293 @c eqn: (1 + 2*x)^3 = 13.5*(1 + x^5);
294 @c soln: allroots (eqn);
296 @c do (e2: subst (e, eqn), disp (expand (lhs(e2) - rhs(e2))));
302 (%i1) eqn: (1 + 2*x)^3 = 13.5*(1 + x^5);
304 (%o1) (2 x + 1) = 13.5 (x + 1)
307 (%i2) soln: allroots (eqn);
308 (%o2) [x = 0.8296749902129361, x = - 1.0157555438281212,
309 x = 0.9659625152196369 %i - 0.4069597231924075,
310 x = - 0.9659625152196369 %i - 0.4069597231924075, x = 1.0]
314 do (e2: subst (e, eqn), disp (expand (lhs(e2) - rhs(e2))));
315 - 3.552713678800501e-15
317 - 5.329070518200751e-15
319 2.6645352591003757e-15 %i - 6.217248937900877e-15
321 - 2.6645352591003757e-15 %i - 6.217248937900877e-15
327 (%i4) polyfactor: true$
329 (%i5) allroots (eqn);
330 (%o5) - 13.5 (x - 1.0) (x - 0.8296749902129361)
332 (x + 1.0157555438281212) (x + 0.813919446384815 x
333 + 1.0986997971102883)
337 @opencatbox{Categories:}
338 @category{Polynomials}
339 @category{Numerical methods}
343 @c -----------------------------------------------------------------------------
345 @deffn {Function} bfallroots @
346 @fname{bfallroots} (@var{expr}) @
347 @fname{bfallroots} (@var{eqn})
349 Computes numerical approximations of the real and complex roots of the
350 polynomial @var{expr} or polynomial equation @var{eqn} of one variable.
352 In all respects, @code{bfallroots} is identical to @code{allroots} except
353 that @code{bfallroots} computes the roots using bigfloats. See
354 @mref{allroots} for more information.
356 @opencatbox{Categories:}
357 @category{Polynomials}
358 @category{Numerical methods}
362 @c -----------------------------------------------------------------------------
364 @defvr {Option variable} backsubst
365 Default value: @code{true}
367 @c WHAT IS THE CONTEXT HERE ?? (TO WHICH OTHER FUNCTION DOES THIS APPLY ??)
368 @c --- According to the documentation, to linsolve
369 When @code{backsubst} is @code{false}, prevents back substitution in
370 @mref{linsolve} after the equations have been triangularized. This may
371 be helpful in very big problems where back substitution would cause
372 the generation of extremely large expressions.
375 @c eq1 : x + y + z = 6$
376 @c eq2 : x - y + z = 2$
377 @c eq3 : x + y - z = 0$
378 @c backsubst : false$
379 @c linsolve ([eq1, eq2, eq3], [x,y,z]);
381 @c linsolve ([eq1, eq2, eq3], [x,y,z]);
384 (%i1) eq1 : x + y + z = 6$
385 (%i2) eq2 : x - y + z = 2$
386 (%i3) eq3 : x + y - z = 0$
387 (%i4) backsubst : false$
389 (%i5) linsolve ([eq1, eq2, eq3], [x,y,z]);
390 (%o5) [x = z - y, y = 2, z = 3]
392 (%i6) backsubst : true$
394 (%i7) linsolve ([eq1, eq2, eq3], [x,y,z]);
395 (%o7) [x = 1, y = 2, z = 3]
399 @opencatbox{Categories:}
400 @category{Algebraic equations}
404 @c -----------------------------------------------------------------------------
406 @defvr {Option variable} breakup
407 Default value: @code{true}
409 When @code{breakup} is @code{true}, @mref{solve} expresses solutions of cubic
410 and quartic equations in terms of common subexpressions, which are assigned to
411 intermediate expression labels (@code{%t1}, @code{%t2}, etc.).
412 Otherwise, common subexpressions are not identified.
414 @code{breakup: true} has an effect only when @mref{programmode} is @code{false}.
419 (%i1) programmode: false$
421 (%i3) solve (x^3 + x^2 - 1);
424 (%t3) (--------- + --)
431 (%t4) x = (- ---------- - -) %t3 + -------------- - -
437 (%t5) x = (---------- - -) %t3 + ---------------- - -
441 (%t6) x = %t3 + ----- - -
443 (%o6) [%t4, %t5, %t6]
444 (%i6) breakup: false$
445 (%i7) solve (x^3 + x^2 - 1);
451 (%t7) x = --------------------- + (--------- + --)
452 sqrt(23) 25 1/3 6 sqrt(3) 54
457 (- ---------- - -) - -
460 sqrt(23) 25 1/3 sqrt(3) %i 1
461 (%t8) x = (--------- + --) (---------- - -)
467 + --------------------- - -
473 (%t9) x = (--------- + --) + --------------------- - -
474 6 sqrt(3) 54 sqrt(23) 25 1/3 3
477 (%o9) [%t7, %t8, %t9]
480 @opencatbox{Categories:}
481 @category{Algebraic equations}
485 @c -----------------------------------------------------------------------------
487 @deffn {Function} dimension @
488 @fname{dimension} (@var{eqn}) @
489 @fname{dimension} (@var{eqn_1}, @dots{}, @var{eqn_n})
491 @code{dimen} is a package for dimensional analysis.
492 @code{load ("dimen")} loads this package.
493 @code{demo ("dimen")} displays a short demonstration.
494 @c I GUESS THIS SHOULD BE EXPANDED TO COVER EACH FUNCTION IN THE PACKAGE
496 @opencatbox{Categories:}
497 @category{Share packages}
501 @c -----------------------------------------------------------------------------
503 @defvr {Option variable} dispflag
504 Default value: @code{true}
506 @c WHAT DOES THIS MEAN ??
507 If set to @code{false} within a @code{block} will inhibit the display of output
508 generated by the solve functions called from within the @code{block}.
509 Termination of the @code{block} with a dollar sign, @code{$}, sets @code{dispflag} to
512 @opencatbox{Categories:}
513 @category{Algebraic equations}
514 @category{Display flags and variables}
518 @c THIS COULD BENEFIT FROM REPHRASING
520 @c -----------------------------------------------------------------------------
522 @deffn {Function} funcsolve (@var{eqn}, @var{g}(@var{t}))
524 Returns @code{[@var{g}(@var{t}) = ...]} or @code{[]}, depending on whether
525 or not there exists a rational function @code{@var{g}(@var{t})} satisfying
526 @var{eqn}, which must be a first order, linear polynomial in (for this case)
527 @code{@var{g}(@var{t})} and @code{@var{g}(@var{t}+1)}
530 @c eqn: (n + 1)*f(n) - (n + 3)*f(n + 1)/(n + 1) =
532 @c funcsolve (eqn, f(n));
536 (%i1) eqn: (n + 1)*f(n) - (n + 3)*f(n + 1)/(n + 1) =
538 (n + 3) f(n + 1) n - 1
539 (%o1) (n + 1) f(n) - ---------------- = -----
543 (%i2) funcsolve (eqn, f(n));
544 solve: dependent equations eliminated: (4 3)
546 (%o2) f(n) = ---------------
551 Warning: this is a very rudimentary implementation -- many safety checks
552 and obvious generalizations are missing.
554 @opencatbox{Categories:}
555 @category{Algebraic equations}
559 @c -----------------------------------------------------------------------------
561 @defvr {Option variable} globalsolve
562 Default value: @code{false}
564 When @code{globalsolve} is @code{true}, solved-for variables are assigned the
565 solution values found by @code{linsolve}, and by @mref{solve} when solving two
566 or more linear equations.
568 When @code{globalsolve} is @code{false}, solutions found by @mref{linsolve} and
569 by @code{solve} when solving two or more linear equations are expressed as
570 equations, and the solved-for variables are not assigned.
572 When solving anything other than two or more linear equations, @code{solve}
573 ignores @code{globalsolve}. Other functions which solve equations (e.g.,
574 @mref{algsys}) always ignore @code{globalsolve}.
579 @c globalsolve: true$
580 @c solve ([x + 3*y = 2, 2*x - y = 5], [x, y]);
583 @c globalsolve: false$
585 @c solve ([x + 3*y = 2, 2*x - y = 5], [x, y]);
590 (%i1) globalsolve: true$
592 (%i2) solve ([x + 3*y = 2, 2*x - y = 5], [x, y]);
594 (%o2) [[x : --, y : - -]]
609 (%i5) globalsolve: false$
612 (%i7) solve ([x + 3*y = 2, 2*x - y = 5], [x, y]);
614 (%o7) [[x = --, y = - -]]
627 @opencatbox{Categories:}
628 @category{Linear equations}
632 @c THIS DESCRIPTION NEEDS WORK AND EXAMPLES
633 @c MERGE IN TEXT FROM share/integequations/inteqn.usg
634 @c AND EXAMPLES FROM .../intexs.mac
636 @c --- I'm not sure that all examples from share/integequations/intexs.mac
637 @c are handled correctly by ieqn.
639 @c -----------------------------------------------------------------------------
641 @deffn {Function} ieqn (@var{ie}, @var{unk}, @var{tech}, @var{n}, @var{guess})
643 @code{inteqn} is a package for solving integral equations.
644 @code{load ("inteqn")} loads this package.
646 @var{ie} is the integral equation; @var{unk} is the unknown function;
647 @var{tech} is the technique to be tried from those given in the lists
648 below; (@var{tech} = @code{first} means: try the first technique which
649 finds a solution; @var{tech} = @code{all} means: try all applicable
650 techniques); @var{n} is the maximum number of terms to take for
651 @code{taylor}, @code{neumann}, @code{firstkindseries}, or
652 @code{fredseries} (it is also the maximum depth of recursion for the
653 differentiation method); @var{guess} is the initial guess for
654 @code{neumann} or @code{firstkindseries}.
656 Two types of equations are considered. A second-kind equation of the
663 p(x) = q(x, p(x), I w(x, u, p(x), p(u)) du)
670 $$p\left(x\right)=q\left(x, p\left(x\right) , \int_{a\left(x\right)}
671 ^{b\left(x\right)}{w\left(x, u, p\left(x\right), p\left(u\right)\right)
675 and a first-kind equation with the form
681 f(x) = I w(x, u, p(u)) du
688 $$f\left(x\right)=\int_{a\left(x\right)}^{b\left(x\right)}
689 {w\left(x, u, p\left(u\right)\right)\;du}$$
692 The different solution techniques used require particular forms of the
693 expressions @var{q} and @var{w}. The techniques available are the following:
695 @b{Second-kind equations}
697 @item @code{flfrnk2nd}: For fixed-limit, finite-rank integrands.
698 @item @code{vlfrnk}: For variable-limit, finite-rank integrands.
699 @item @code{transform}: Laplace transform for convolution types.
700 @item @code{fredseries}: Fredholm-Carleman series for linear equations.
701 @item @code{tailor}: Taylor series for quasi-linear variable-limit equations.
702 @item @code{neumann}: Neumann series for quasi-second kind equations.
703 @item @code{collocate}: Collocation using a power series form for p(x)
704 evaluated at equally spaced points.
707 @b{First-kind equations}
709 @item @code{flfrnk1st}: For fixed-limit, finite-rank integrands.
710 @item @code{vlfrnk}: For variable-limit, finite-rank integrands.
711 @item @code{abel}: For singular integrands
712 @item @code{transform}: See above
713 @item @code{collocate}: See above
714 @item @code{firstkindseries}: Iteration technique similar to neumann series.
717 The default values for the 2nd thru 5th parameters in the calling form
720 @var{unk}: @code{@var{p}(@var{x})}, where @var{p} is the first function
721 encountered in an integrand which is unknown to Maxima and @var{x} is the
722 variable which occurs as an argument to the first occurrence of @var{p} found
723 outside of an integral in the case of @code{secondkind} equations, or is the
724 only other variable besides the variable of integration in @code{firstkind}
725 equations. If the attempt to search for @var{x} fails, the user will be asked
726 to supply the independent variable. @var{tech}: @code{first}. @var{n}: 1.
727 @var{guess}: @code{none} which will cause @code{neumann} and
728 @code{firstkindseries} to use @code{@var{f}(@var{x})} as an initial guess.
732 (%i1) load("inteqn")$
734 (%i2) e: p(x) - 1 -x + cos(x) + 'integrate(cos(x-u)*p(u),u,0,x)$
736 (%i3) ieqn(e, p(x), 'transform);
737 default 4th arg, number of iterations or coll. parms.: 1
738 default 5th arg, initial guess: none
742 (%i4) e: 2*'integrate(p(x*sin(u)), u, 0, %pi/2) - a*x - b$
744 (%i5) ieqn(e, p(x), 'firstkindseries);
745 default 4th arg, number of iterations or coll. parms.: 1
746 default 5th arg, initial guess: none
748 (%t5) [2 a x + %pi b, firstkindseries, 1, approximate]
752 @opencatbox{Categories:}
753 @category{Integral equations}
757 @c -----------------------------------------------------------------------------
759 @defvr {Option variable} ieqnprint
760 Default value: @code{true}
762 @code{ieqnprint} governs the behavior of the result returned by the
763 @mref{ieqn} command. When @code{ieqnprint} is @code{false}, the lists returned
764 by the @code{ieqn} function are of the form
766 [@var{solution}, @var{technique used}, @var{nterms}, @var{flag}]
768 where @var{flag} is absent if the solution is exact.
770 Otherwise, it is the word @code{approximate} or @code{incomplete} corresponding
771 to an inexact or non-closed form solution, respectively. If a series method was
772 used, @var{nterms} gives the number of terms taken (which could be less than
773 the n given to @code{ieqn} if an error prevented generation of further terms).
775 @opencatbox{Categories:}
776 @category{Integral equations}
780 @c -----------------------------------------------------------------------------
782 @deffn {Function} lhs (@var{expr})
784 Returns the left-hand side (that is, the first argument) of the expression
785 @var{expr}, when the operator of @var{expr} is one of the relational operators
786 @code{< <= = # equal notequal >= >},
787 @c MENTION -> (MARROW) IN THIS LIST IF/WHEN THE PARSER RECOGNIZES IT
788 one of the assignment operators @code{:= ::= : ::}, or a user-defined binary
789 infix operator, as declared by @mrefdot{infix}
791 When @var{expr} is an atom or its operator is something other than the ones
792 listed above, @code{lhs} returns @var{expr}.
794 See also @mrefdot{rhs}
802 @c [lhs (aa < bb), lhs (aa <= bb), lhs (aa >= bb),
804 @c [lhs (aa = bb), lhs (aa # bb), lhs (equal (aa, bb)),
805 @c lhs (notequal (aa, bb))];
806 @c e1: '(foo(x) := 2*x);
807 @c e2: '(bar(y) ::= 3*y);
810 @c [lhs (e1), lhs (e2), lhs (e3), lhs (e4)];
816 (%i1) e: aa + bb = cc;
828 (%i4) [lhs (aa < bb), lhs (aa <= bb), lhs (aa >= bb),
830 (%o4) [aa, aa, aa, aa]
833 (%i5) [lhs (aa = bb), lhs (aa # bb), lhs (equal (aa, bb)),
834 lhs (notequal (aa, bb))];
835 (%o5) [aa, aa, aa, aa]
838 (%i6) e1: '(foo(x) := 2*x);
842 (%i7) e2: '(bar(y) ::= 3*y);
854 (%i10) [lhs (e1), lhs (e2), lhs (e3), lhs (e4)];
855 (%o10) [foo(x), bar(y), x, x]
862 (%i12) lhs (aa ][ bb);
867 @opencatbox{Categories:}
868 @category{Expressions}
872 @c REVISIT -- THERE'S PROBABLY MORE TO SAY HERE
874 @c -----------------------------------------------------------------------------
876 @deffn {Function} linsolve ([@var{expr_1}, @dots{}, @var{expr_m}], [@var{x_1}, @dots{}, @var{x_n}])
878 Solves the list of simultaneous linear equations for the list of variables.
879 The expressions must each be polynomials in the variables and may be equations.
880 If the length of the list of variables doesn't match the number of
881 linearly-independent equations to solve the result will be an empty list.
883 When @mref{globalsolve} is @code{true}, each solved-for variable is bound to
884 its value in the solution of the equations.
886 When @mref{backsubst} is @code{false}, @code{linsolve} does not carry out back
887 substitution after the equations have been triangularized. This may be
888 necessary in very big problems where back substitution would cause the
889 generation of extremely large expressions.
891 When @mref{linsolve_params} is @code{true}, @code{linsolve} also generates the
892 @code{%r} symbols used to represent arbitrary parameters described in the manual
893 under @mrefdot{algsys} Otherwise, @code{linsolve} solves an under-determined
894 system of equations with some variables expressed in terms of others.
896 When @mref{programmode} is @code{false}, @code{linsolve} displays the solution
897 with intermediate expression (@code{%t}) labels, and returns the list of labels.
899 See also @mrefcomma{algsys} @mrefdot{eliminate} and @mrefdot{solve}
904 @c e2: 2*a*x - y = 2*a^2;
906 @c [globalsolve: false, programmode: true];
907 @c linsolve ([e1, e2, e3], [x, y, z]);
908 @c [globalsolve: false, programmode: false];
909 @c linsolve ([e1, e2, e3], [x, y, z]);
911 @c [globalsolve: true, programmode: false];
912 @c linsolve ([e1, e2, e3], [x, y, z]);
915 @c [globalsolve: true, programmode: true];
916 @c linsolve ([e1, e2, e3], '[x, y, z]);
925 (%i2) e2: 2*a*x - y = 2*a^2;
927 (%o2) 2 a x - y = 2 a
930 (%i3) e3: y - 2*z = 2;
934 (%i4) [globalsolve: false, programmode: true];
938 (%i5) linsolve ([e1, e2, e3], [x, y, z]);
939 (%o5) [x = a + 1, y = 2 a, z = a - 1]
942 (%i6) [globalsolve: false, programmode: false];
946 (%i7) linsolve ([e1, e2, e3], [x, y, z]);
954 (%o9) [%t7, %t8, %t9]
958 (%o10) [z = a - 1, y = 2 a, x = a + 1]
961 (%i11) [globalsolve: true, programmode: false];
965 (%i12) linsolve ([e1, e2, e3], [x, y, z]);
973 (%o14) [%t12, %t13, %t14]
977 (%o15) [z : a - 1, y : 2 a, x : a + 1]
981 (%o16) [a + 1, 2 a, a - 1]
984 (%i17) [globalsolve: true, programmode: true];
988 (%i18) linsolve ([e1, e2, e3], '[x, y, z]);
989 (%o18) [x : a + 1, y : 2 a, z : a - 1]
993 (%o19) [a + 1, 2 a, a - 1]
997 @opencatbox{Categories:}
998 @category{Linear equations}
1002 @c DO ANY FUNCTIONS OTHER THAN linsolve RESPECT linsolvewarn ??
1004 @c -----------------------------------------------------------------------------
1005 @anchor{linsolvewarn}
1006 @defvr {Option variable} linsolvewarn
1007 Default value: @code{true}
1009 When @code{linsolvewarn} is @code{true}, @mref{linsolve} prints a message
1010 "Dependent equations eliminated".
1012 @opencatbox{Categories:}
1013 @category{Linear equations}
1017 @c -----------------------------------------------------------------------------
1018 @anchor{linsolve_params}
1019 @defvr {Option variable} linsolve_params
1020 Default value: @code{true}
1022 When @code{linsolve_params} is @code{true}, @mref{linsolve} also generates
1023 the @code{%r} symbols used to represent arbitrary parameters described in
1024 the manual under @mrefdot{algsys} Otherwise, @code{linsolve} solves an
1025 under-determined system of equations with some variables expressed in terms of
1028 @opencatbox{Categories:}
1029 @category{Linear equations}
1033 @c -----------------------------------------------------------------------------
1034 @anchor{multiplicities}
1035 @defvr {System variable} multiplicities
1036 Default value: @code{not_set_yet}
1038 @code{multiplicities} is set to a list of the multiplicities of the individual
1039 solutions returned by @mref{solve} or @mrefdot{realroots}
1040 @c NEED AN EXAMPLE HERE
1042 @opencatbox{Categories:}
1043 @category{Algebraic equations}
1044 @category{Polynomials}
1048 @c -----------------------------------------------------------------------------
1050 @deffn {Function} nroots (@var{p}, @var{low}, @var{high})
1052 Returns the number of real roots of the real univariate polynomial @var{p} in
1053 the half-open interval @code{(@var{low}, @var{high}]}. The endpoints of the
1054 interval may be @code{minf} or @code{inf}.
1056 @code{nroots} uses the method of Sturm sequences.
1059 @c p: x^10 - 2*x^4 + 1/2$
1060 @c nroots (p, -6, 9.1);
1063 (%i1) p: x^10 - 2*x^4 + 1/2$
1065 (%i2) nroots (p, -6, 9.1);
1070 @opencatbox{Categories:}
1071 @category{Polynomials}
1072 @category{Numerical methods}
1078 @c -----------------------------------------------------------------------------
1080 @deffn {Function} nthroot (@var{p}, @var{n})
1082 where @var{p} is a polynomial with integer coefficients and @var{n} is a
1083 positive integer returns @code{q}, a polynomial over the integers, such that
1084 @code{q^n = p} or prints an error message indicating that @var{p} is not a
1085 perfect nth power. This routine is much faster than @mref{factor} or even
1088 @opencatbox{Categories:}
1089 @category{Polynomials}
1093 @c -----------------------------------------------------------------------------
1095 @defvr {Option variable} polyfactor
1096 Default value: @code{false}
1098 The option variable @code{polyfactor} when @code{true} causes
1099 @mref{allroots} and @mref{bfallroots} to factor the polynomial over the real
1100 numbers if the polynomial is real, or over the complex numbers, if the
1101 polynomial is complex.
1103 See @code{allroots} for an example.
1105 @opencatbox{Categories:}
1106 @category{Polynomials}
1107 @category{Numerical methods}
1111 @c -----------------------------------------------------------------------------
1112 @anchor{programmode}
1113 @defvr {Option variable} programmode
1114 Default value: @code{true}
1116 When @code{programmode} is @code{true}, @mrefcomma{solve}@w{}
1117 @mrefcomma{realroots} @mrefcomma{allroots} and @mref{linsolve} return solutions
1118 as elements in a list.
1119 @c WHAT DOES BACKSUBSTITUTION HAVE TO DO WITH RETURN VALUES ??
1120 (Except when @mref{backsubst} is set to @code{false}, in which case
1121 @code{programmode: false} is assumed.)
1123 When @code{programmode} is @code{false}, @code{solve}, etc. create intermediate
1124 expression labels @code{%t1}, @code{%t2}, etc., and assign the solutions to them.
1125 @c NEED AN EXAMPLE HERE
1127 @opencatbox{Categories:}
1128 @category{Algebraic equations}
1129 @category{Polynomials}
1133 @c -----------------------------------------------------------------------------
1135 @defvr {Option variable} realonly
1136 Default value: @code{false}
1138 When @code{realonly} is @code{true}, @mref{algsys} returns only those solutions
1139 which are free of @code{%i}.
1141 @opencatbox{Categories:}
1142 @category{Algebraic equations}
1146 @c -----------------------------------------------------------------------------
1148 @deffn {Function} realroots @
1149 @fname{realroots} (@var{expr}, @var{bound}) @
1150 @fname{realroots} (@var{eqn}, @var{bound}) @
1151 @fname{realroots} (@var{expr}) @
1152 @fname{realroots} (@var{eqn})
1154 Computes rational approximations of the real roots of the polynomial @var{expr}
1155 or polynomial equation @var{eqn} of one variable, to within a tolerance of
1156 @var{bound}. Coefficients of @var{expr} or @var{eqn} must be literal numbers;
1157 symbol constants such as @code{%pi} are rejected.
1159 @code{realroots} assigns the multiplicities of the roots it finds
1160 to the global variable @mrefdot{multiplicities}
1162 @code{realroots} constructs a Sturm sequence to bracket each root, and then
1163 applies bisection to refine the approximations. All coefficients are converted
1164 to rational equivalents before searching for roots, and computations are carried
1165 out by exact rational arithmetic. Even if some coefficients are floating-point
1166 numbers, the results are rational (unless coerced to floats by the
1167 @mref{float} or @mref{numer} flags).
1169 When @var{bound} is less than 1, all integer roots are found exactly.
1170 When @var{bound} is unspecified, it is assumed equal to the global variable
1171 @mrefdot{rootsepsilon}
1173 When the global variable @mref{programmode} is @code{true}, @code{realroots}
1174 returns a list of the form @code{[x = @var{x_1}, x = @var{x_2}, ...]}.
1175 When @code{programmode} is @code{false}, @code{realroots} creates intermediate
1176 expression labels @code{%t1}, @code{%t2}, @dots{},
1177 assigns the results to them, and returns the list of labels.
1179 See also @mrefcomma{allroots} @mrefcomma{bfallroots} @mrefcomma{guess_exact_value}
1185 @c realroots (-1 - x + x^5, 5e-6);
1186 @c ev (%[1], float);
1187 @c ev (-1 - x + x^5, %);
1191 (%i1) realroots (-1 - x + x^5, 5e-6);
1197 (%i2) ev (%[1], float);
1198 (%o2) x = 1.1673030853271484
1201 (%i3) ev (-1 - x + x^5, %);
1202 (%o3) - 7.396496210176906e-6
1207 @c realroots (expand ((1 - x)^5 * (2 - x)^3 * (3 - x)), 1e-20);
1212 (%i1) realroots (expand ((1 - x)^5 * (2 - x)^3 * (3 - x)), 1e-20);
1213 (%o1) [x = 1, x = 2, x = 3]
1216 (%i2) multiplicities;
1221 @opencatbox{Categories:}
1222 @category{Polynomials}
1223 @category{Numerical methods}
1227 @c -----------------------------------------------------------------------------
1229 @deffn {Function} rhs (@var{expr})
1231 Returns the right-hand side (that is, the second argument) of the expression
1232 @var{expr}, when the operator of @var{expr} is one of the relational operators
1233 @code{< <= = # equal notequal >= >},
1234 @c MENTION -> (MARROW) IN THIS LIST IF/WHEN THE PARSER RECOGNIZES IT
1235 one of the assignment operators @code{:= ::= : ::}, or a user-defined binary
1236 infix operator, as declared by @mrefdot{infix}
1238 When @var{expr} is an atom or its operator is something other than the ones
1239 listed above, @code{rhs} returns 0.
1241 See also @mrefdot{lhs}
1249 @c [rhs (aa < bb), rhs (aa <= bb), rhs (aa >= bb),
1251 @c [rhs (aa = bb), rhs (aa # bb), rhs (equal (aa, bb)),
1252 @c rhs (notequal (aa, bb))];
1253 @c e1: '(foo(x) := 2*x);
1254 @c e2: '(bar(y) ::= 3*y);
1257 @c [rhs (e1), rhs (e2), rhs (e3), rhs (e4)];
1263 (%i1) e: aa + bb = cc;
1275 (%i4) [rhs (aa < bb), rhs (aa <= bb), rhs (aa >= bb),
1277 (%o4) [bb, bb, bb, bb]
1280 (%i5) [rhs (aa = bb), rhs (aa # bb), rhs (equal (aa, bb)),
1281 rhs (notequal (aa, bb))];
1282 (%o5) [bb, bb, bb, bb]
1285 (%i6) e1: '(foo(x) := 2*x);
1289 (%i7) e2: '(bar(y) ::= 3*y);
1290 (%o7) bar(y) ::= 3 y
1297 (%i9) e4: '(x :: y);
1301 (%i10) [rhs (e1), rhs (e2), rhs (e3), rhs (e4)];
1302 (%o10) [2 x, 3 y, y, y]
1305 (%i11) infix ("][");
1309 (%i12) rhs (aa ][ bb);
1314 @opencatbox{Categories:}
1315 @category{Expressions}
1319 @c -----------------------------------------------------------------------------
1320 @anchor{rootsconmode}
1321 @defvr {Option variable} rootsconmode
1322 Default value: @code{true}
1324 @code{rootsconmode} governs the behavior of the @code{rootscontract} command.
1325 See @mref{rootscontract} for details.
1327 @opencatbox{Categories:}
1328 @category{Expressions}
1329 @category{Simplification flags and variables}
1335 @c -----------------------------------------------------------------------------
1336 @anchor{rootscontract}
1337 @deffn {Function} rootscontract (@var{expr})
1339 Converts products of roots into roots of products. For example,
1340 @code{rootscontract (sqrt(x)*y^(3/2))} yields @code{sqrt(x*y^3)}.
1342 When @mref{radexpand} is @code{true} and @mref{domain} is @code{real},
1343 @code{rootscontract} converts @mref{abs} into @mrefcomma{sqrt} e.g.,
1344 @code{rootscontract (abs(x)*sqrt(y))} yields @code{sqrt(x^2*y)}.
1346 There is an option @mref{rootsconmode} affecting @code{rootscontract} as
1350 Problem Value of Result of applying
1351 rootsconmode rootscontract
1353 x^(1/2)*y^(3/2) false (x*y^3)^(1/2)
1354 x^(1/2)*y^(1/4) false x^(1/2)*y^(1/4)
1355 x^(1/2)*y^(1/4) true (x*y^(1/2))^(1/2)
1356 x^(1/2)*y^(1/3) true x^(1/2)*y^(1/3)
1357 x^(1/2)*y^(1/4) all (x^2*y)^(1/4)
1358 x^(1/2)*y^(1/3) all (x^3*y^2)^(1/6)
1361 When @code{rootsconmode} is @code{false}, @code{rootscontract} contracts only
1362 with respect to rational number exponents whose denominators are the same. The
1363 key to the @code{rootsconmode: true} examples is simply that 2 divides into 4
1364 but not into 3. @code{rootsconmode: all} involves taking the least common
1365 multiple of the denominators of the exponents.
1367 @code{rootscontract} uses @mref{ratsimp} in a manner similar to
1368 @mrefdot{logcontract}
1373 @c rootsconmode: false$
1374 @c rootscontract (x^(1/2)*y^(3/2));
1375 @c rootscontract (x^(1/2)*y^(1/4));
1376 @c rootsconmode: true$
1377 @c rootscontract (x^(1/2)*y^(1/4));
1378 @c rootscontract (x^(1/2)*y^(1/3));
1379 @c rootsconmode: all$
1380 @c rootscontract (x^(1/2)*y^(1/4));
1381 @c rootscontract (x^(1/2)*y^(1/3));
1382 @c rootsconmode: false$
1383 @c rootscontract (sqrt(sqrt(x) + sqrt(1 + x))
1384 @c *sqrt(sqrt(1 + x) - sqrt(x)));
1385 @c rootsconmode: true$
1386 @c rootscontract (sqrt(5 + sqrt(5)) - 5^(1/4)*sqrt(1 + sqrt(5)));
1389 (%i1) rootsconmode: false$
1391 (%i2) rootscontract (x^(1/2)*y^(3/2));
1396 (%i3) rootscontract (x^(1/2)*y^(1/4));
1400 (%i4) rootsconmode: true$
1402 (%i5) rootscontract (x^(1/2)*y^(1/4));
1403 (%o5) sqrt(x sqrt(y))
1406 (%i6) rootscontract (x^(1/2)*y^(1/3));
1410 (%i7) rootsconmode: all$
1412 (%i8) rootscontract (x^(1/2)*y^(1/4));
1417 (%i9) rootscontract (x^(1/2)*y^(1/3));
1421 (%i10) rootsconmode: false$
1423 (%i11) rootscontract (sqrt(sqrt(x) + sqrt(1 + x))
1424 *sqrt(sqrt(1 + x) - sqrt(x)));
1427 (%i12) rootsconmode: true$
1429 (%i13) rootscontract (sqrt(5 + sqrt(5)) - 5^(1/4)*sqrt(1 + sqrt(5)));
1434 @opencatbox{Categories:}
1435 @category{Simplification functions}
1439 @c -----------------------------------------------------------------------------
1440 @anchor{rootsepsilon}
1441 @defvr {Option variable} rootsepsilon
1442 Default value: 1.0e-7
1444 @code{rootsepsilon} is the tolerance which establishes the confidence interval
1445 for the roots found by the @mref{realroots} function.
1446 @c IS IT GUARANTEED THAT |ACTUAL - ESTIMATE| < rootepsilon OR IS IT SOME OTHER
1447 @c NOTION ?? NEED EXAMPLE HERE
1449 @opencatbox{Categories:}
1450 @category{Polynomials}
1451 @category{Numerical methods}
1457 @c -----------------------------------------------------------------------------
1459 @deffn {Function} solve @
1460 @fname{solve} (@var{expr}, @var{x}) @
1461 @fname{solve} (@var{expr}) @
1462 @fname{solve} ([@var{eqn_1}, @dots{}, @var{eqn_n}], [@var{x_1}, @dots{}, @var{x_n}])
1464 Solves the algebraic equation @var{expr} for the variable @var{x} and returns a
1465 list of solution equations in @var{x}. If @var{expr} is not an equation, the
1466 equation @code{@var{expr} = 0} is assumed in its place.
1467 @var{x} may be a function (e.g. @code{f(x)}), or other non-atomic expression
1468 except a sum or product. @var{x} may be omitted if @var{expr} contains only one
1469 variable. @var{expr} may be a rational expression, and may contain
1470 trigonometric functions, exponentials, etc.
1472 The following method is used:
1474 Let @var{E} be the expression and @var{X} be the variable. If @var{E} is linear
1475 in @var{X} then it is trivially solved for @var{X}. Otherwise if @var{E} is of
1476 the form @code{A*X^N + B} then the result is @code{(-B/A)^1/N)} times the
1477 @code{N}'th roots of unity.
1479 If @var{E} is not linear in @var{X} then the gcd of the exponents of @var{X} in
1480 @var{E} (say @var{N}) is divided into the exponents and the multiplicity of the
1481 roots is multiplied by @var{N}. Then @code{solve} is called again on the
1482 result. If @var{E} factors then @code{solve} is called on each of the factors.
1483 Finally @code{solve} will use the quadratic, cubic, or quartic formulas where
1486 In the case where @var{E} is a polynomial in some function of the variable to be
1487 solved for, say @code{F(X)}, then it is first solved for @code{F(X)} (call the
1488 result @var{C}), then the equation @code{F(X)=C} can be solved for @var{X}
1489 provided the inverse of the function @var{F} is known.
1491 @mref{breakup} if @code{false} will cause @code{solve} to express the solutions
1492 of cubic or quartic equations as single expressions rather than as made
1493 up of several common subexpressions which is the default.
1495 @mref{multiplicities} - will be set to a list of the multiplicities of the
1496 individual solutions returned by @code{solve}, @mrefcomma{realroots} or
1497 @mrefdot{allroots} Try @code{apropos (solve)} for the switches which affect
1498 @code{solve}. @mref{describe} may then by used on the individual switch names
1499 if their purpose is not clear.
1501 @code{solve ([@var{eqn_1}, ..., @var{eqn_n}], [@var{x_1}, ..., @var{x_n}])}
1502 solves a system of simultaneous (linear or non-linear) polynomial equations by
1503 calling @mref{linsolve} or @mref{algsys} and returns a list of the solution
1504 lists in the variables. In the case of @mref{linsolve} this list would contain
1505 a single list of solutions. It takes two lists as arguments. The first list
1506 represents the equations to be solved; the second list is a
1507 list of the unknowns to be determined. If the total number of
1508 variables in the equations is equal to the number of equations, the
1509 second argument-list may be omitted.
1511 @c I think this is not true --hgeyer
1514 @c solution exists, then @code{singular} will be displayed.
1516 When @mref{programmode} is @code{false}, @code{solve} displays solutions with
1517 intermediate expression (@code{%t}) labels, and returns the list of labels.
1519 When @mref{globalsolve} is @code{true} and the problem is to solve two or more
1520 linear equations, each solved-for variable is bound to its value in the solution
1525 @c FOLLOWING ADAPTED FROM example (solve)
1527 @c solve (asin (cos (3*x))*(f(x) - 1), x);
1528 @c ev (solve (5^f(x) = 125, f(x)), solveradcan);
1529 @c [4*x^2 - y^2 = 12, x*y - x = 2];
1530 @c solve (%, [x, y]);
1531 @c solve (1 + a*x + x^3, x);
1534 @c ev (x^6 - 1, %[1]);
1538 @c ev (%th(2), %[1]);
1542 (%i1) solve (asin (cos (3*x))*(f(x) - 1), x);
1543 solve: using arc-trig functions to get a solution.
1544 Some solutions will be lost.
1546 (%o1) [x = ---, f(x) = 1]
1550 (%i2) ev (solve (5^f(x) = 125, f(x)), solveradcan);
1552 (%o2) [f(x) = --------]
1556 (%i3) [4*x^2 - y^2 = 12, x*y - x = 2];
1558 (%o3) [4 x - y = 12, x y - x = 2]
1561 (%i4) solve (%, [x, y]);
1562 (%o4) [[x = 2, y = 2], [x = 0.5202594388652008 %i
1563 - 0.1331240357358706, y = 0.07678378523787788
1564 - 3.608003221870287 %i], [x = - 0.5202594388652008 %i
1565 - 0.1331240357358706, y = 3.608003221870287 %i
1566 + 0.07678378523787788], [x = - 1.733751846381093,
1567 y = - 0.15356757100196963]]
1570 (%i5) solve (1 + a*x + x^3, x);
1572 - 1 sqrt(3) %i sqrt(4 a + 27) 1 1/3
1573 (%o5) [x = (--- - ----------) (--------------- - -)
1577 (---------- + ---) a
1579 - --------------------------, x =
1581 sqrt(4 a + 27) 1 1/3
1582 3 (--------------- - -)
1586 sqrt(3) %i - 1 sqrt(4 a + 27) 1 1/3
1587 (---------- + ---) (--------------- - -)
1591 (--- - ----------) a
1593 - --------------------------, x =
1595 sqrt(4 a + 27) 1 1/3
1596 3 (--------------- - -)
1600 sqrt(4 a + 27) 1 1/3 a
1601 (--------------- - -) - --------------------------]
1603 2 3 sqrt(4 a + 27) 1 1/3
1604 3 (--------------- - -)
1609 (%i6) solve (x^3 - 1);
1610 sqrt(3) %i - 1 sqrt(3) %i + 1
1611 (%o6) [x = --------------, x = - --------------, x = 1]
1615 (%i7) solve (x^6 - 1);
1616 sqrt(3) %i + 1 sqrt(3) %i - 1
1617 (%o7) [x = --------------, x = --------------, x = - 1,
1619 sqrt(3) %i + 1 sqrt(3) %i - 1
1620 x = - --------------, x = - --------------, x = 1]
1624 (%i8) ev (x^6 - 1, %[1]);
1627 (%o8) ----------------- - 1
1640 (%i11) solve (%, x);
1641 (%o11) [x = - 1, x = 1]
1644 (%i12) ev (%th(2), %[1]);
1649 The symbols @code{%r} are used to denote arbitrary constants in a solution.
1652 @c solve([x+y=1,2*x+2*y=2],[x,y]);
1656 (%i1) solve([x+y=1,2*x+2*y=2],[x,y]);
1657 solve: dependent equations eliminated: (2)
1658 (%o1) [[x = 1 - %r1, y = %r1]]
1662 See @mref{algsys} and @mref{%rnum_list} for more information.
1664 @opencatbox{Categories:}
1665 @category{Algebraic equations}
1669 @c -----------------------------------------------------------------------------
1670 @anchor{solvedecomposes}
1671 @defvr {Option variable} solvedecomposes
1672 Default value: @code{true}
1674 When @code{solvedecomposes} is @code{true}, @code{solve} calls
1675 @mref{polydecomp} if asked to solve polynomials.
1676 @c OTHERWISE WHAT HAPPENS -- CAN'T SOLVE POLYNOMIALS, OR SOME OTHER METHOD IS USED ??
1678 @opencatbox{Categories:}
1679 @category{Algebraic equations}
1683 @c -----------------------------------------------------------------------------
1684 @anchor{solveexplicit}
1685 @defvr {Option variable} solveexplicit
1686 Default value: @code{false}
1688 When @code{solveexplicit} is @code{true}, inhibits @mref{solve} from returning
1689 implicit solutions, that is, solutions of the form @code{F(x) = 0} where
1690 @code{F} is some function.
1691 @c NEED AN EXAMPLE HERE
1693 @opencatbox{Categories:}
1694 @category{Algebraic equations}
1698 @c -----------------------------------------------------------------------------
1699 @anchor{solvefactors}
1700 @defvr {Option variable} solvefactors
1701 Default value: @code{true}
1703 @c WHAT IS THIS ABOUT EXACTLY ??
1704 When @code{solvefactors} is @code{false}, @mref{solve} does not try to factor
1705 the expression. The @code{false} setting may be desired in some cases where
1706 factoring is not necessary.
1707 @c NEED AN EXAMPLE HERE
1709 @opencatbox{Categories:}
1710 @category{Algebraic equations}
1714 @c -----------------------------------------------------------------------------
1715 @anchor{solvenullwarn}
1716 @defvr {Option variable} solvenullwarn
1717 Default value: @code{true}
1719 When @code{solvenullwarn} is @code{true}, @mref{solve} prints a warning message
1720 if called with either a null equation list or a null variable list. For
1721 example, @code{solve ([], [])} would print two warning messages and return
1724 @opencatbox{Categories:}
1725 @category{Algebraic equations}
1729 @c -----------------------------------------------------------------------------
1730 @anchor{solveradcan}
1731 @defvr {Option variable} solveradcan
1732 Default value: @code{false}
1734 When @code{solveradcan} is @code{true}, @mref{solve} calls @mref{radcan}@w{}
1735 which makes @code{solve} slower but will allow certain problems containing
1736 exponentials and logarithms to be solved.
1737 @c NEED AN EXAMPLE HERE
1739 @opencatbox{Categories:}
1740 @category{Algebraic equations}
1744 @c -----------------------------------------------------------------------------
1745 @anchor{solvetrigwarn}
1746 @defvr {Option variable} solvetrigwarn
1747 Default value: @code{true}
1749 @c MAYBE THIS CAN BE CLARIFIED
1750 When @code{solvetrigwarn} is @code{true}, @mref{solve} may print a message
1751 saying that it is using inverse trigonometric functions to solve the equation,
1752 and thereby losing solutions.
1753 @c NEED AN EXAMPLE HERE
1755 @opencatbox{Categories:}
1756 @category{Algebraic equations}
1760 @c =============================================================================
1761 @node Examples for algsys, References for equations, Functions and Variables for Equations, Equations
1762 @section Examples for algsys
1764 @var{algsys} often fails to solve problems that have solutions. The following examples
1765 provide some solution strategies.
1767 @subsection Strategies
1769 Many users try to solve the most general problem imaginable, with multiple
1770 free parameters. Unfortunately the size and complexity of individual solutions
1771 increases rapidly with
1772 the number of parameters, as can be seen in the examples below.
1773 This 'expression swell' makes it difficult for a computer
1774 algebra system to confirm symbolically that solutions satisfy the
1775 input equations so solutions can be incorrectly rejected by a solver.
1776 Every effort should be made to reduce the complexity of, and number of
1777 parameters in, the equations to be solved.
1779 @subsection Example 1: Intersection of two circles
1781 We wish to find the intersection points of two circles: one centered
1782 at (a,b) with radius r
1783 and the second centered at (c,d) with radius s.
1785 @var{algsys} does not find a solution to the original problem.
1787 @c eq1: (x-a)^2+(y-b)^2-r^2;
1788 @c eq2: (x-c)^2+(y-d)^2-s^2;
1789 @c algsys([eq1,eq2],[x,y]);
1793 (%i1) eq1: (x-a)^2+(y-b)^2-r^2;
1795 (%o1) (y - b) + (x - a) - r
1798 (%i2) eq2: (x-c)^2+(y-d)^2-s^2;
1800 (%o2) (y - d) + (x - c) - s
1803 (%i3) algsys([eq1,eq2],[x,y]);
1808 @c -----------------------------------------------------------------------------
1809 @subsubheading Simplify the problem
1811 This problem can be transformed to eliminate parameters by:
1812 translating the center of the first circle to the origin;
1813 scaling so that the first circle has radius 1;
1814 and, rotating about the new origin so that
1815 the center of the second circle is located on the positive x-axis.
1819 @c eq2a:(x-C)^2+y^2-S^2;
1820 @c algsys([eq1a,eq2a],[x,y]);
1824 (%i1) eq1a:x^2+y^2-1;
1829 (%i2) eq2a:(x-C)^2+y^2-S^2;
1831 (%o2) y + (x - C) - S
1834 (%i3) algsys([eq1a,eq2a],[x,y]);
1837 (%o3) [[x = - -----------, y =
1840 sqrt(- S + (2 C + 2) S - C + 2 C - 1)
1841 - ------------------------------------------],
1845 [x = - -----------, y =
1848 sqrt(- S + (2 C + 2) S - C + 2 C - 1)
1849 ------------------------------------------]]
1854 It is not necessary to rescale these equations to obtain
1858 @c eq1b:x^2+y^2-r^2;
1859 @c eq2b:(x-C)^2+y^2-s^2;
1860 @c algsys([eq1b,eq2b],[x,y]);
1864 (%i1) eq1b:x^2+y^2-r^2;
1869 (%i2) eq2b:(x-C)^2+y^2-s^2;
1871 (%o2) y + (x - C) - s
1874 (%i3) algsys([eq1b,eq2b],[x,y]);
1877 (%o3) [[x = - ------------, y =
1880 sqrt(- s + (2 r + 2 C ) s - r + 2 C r - C )
1881 - -------------------------------------------------],
1885 [x = - ------------, y =
1888 sqrt(- s + (2 r + 2 C ) s - r + 2 C r - C )
1889 -------------------------------------------------]]
1894 @c -----------------------------------------------------------------------------
1895 @subsubheading Simplify the equations
1897 Another strategy is to simplify the equations.
1898 The expression @var{eq1-eq2} is linear in unknowns @var{x} and @var{y}.
1899 @var{algsys} can solve the simpler system of equations @var{[eq1,eq1-eq2]}.
1901 Note the complexity of the solution at (%o4).
1904 @c eq1: (x-a)^2+(y-b)^2-r^2;
1905 @c eq2: (x-c)^2+(y-d)^2-s^2;
1906 @c eq3: expand(eq1-eq2);
1907 @c soln:algsys([eq1,eq3],[x,y]);
1908 @c ratsimp(subst(soln[1],[eq1,eq2]));
1909 @c ratsimp(subst(soln[2],[eq1,eq2]));
1913 (%i1) eq1: (x-a)^2+(y-b)^2-r^2;
1915 (%o1) (y - b) + (x - a) - r
1918 (%i2) eq2: (x-c)^2+(y-d)^2-s^2;
1920 (%o2) (y - d) + (x - c) - s
1923 (%i3) eq3: expand(eq1-eq2);
1925 (%o3) 2 d y - 2 b y + 2 c x - 2 a x + s - r - d - c + b + a
1928 (%i4) soln:algsys([eq1,eq3],[x,y]);
1930 (%o4) [[x = - ((d - b) sqrt(- s
1932 + (2 r + 2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a ) s - r
1934 + (2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a ) r - d + 4 b d
1936 + (- 2 c + 4 a c - 6 b - 2 a ) d
1938 + (4 b c - 8 a b c + 4 b + 4 a b) d - c + 4 a c
1940 + (- 2 b - 6 a ) c + (4 a b + 4 a ) c - b - 2 a b - a )
1942 + (c - a) s + (a - c) r + (- c - a) d + (2 b c + 2 a b) d
1944 - c + a c + (a - b ) c - a b - a )
1946 /(2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a ),
1948 y = ((c - a) sqrt(- s + (2 r + 2 d - 4 b d + 2 c - 4 a c
1950 + 2 b + 2 a ) s - r + (2 d - 4 b d + 2 c - 4 a c + 2 b
1952 + 2 a ) r - d + 4 b d + (- 2 c + 4 a c - 6 b - 2 a ) d
1954 + (4 b c - 8 a b c + 4 b + 4 a b) d - c + 4 a c
1956 + (- 2 b - 6 a ) c + (4 a b + 4 a ) c - b - 2 a b - a )
1958 + (b - d) s + (d - b) r + d - b d + (c - 2 a c - b + a ) d
1960 + b c - 2 a b c + b + a b)/(2 d - 4 b d + 2 c - 4 a c
1962 + 2 b + 2 a )], [x = ((d - b) sqrt(- s
1964 + (2 r + 2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a ) s - r
1966 + (2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a ) r - d + 4 b d
1968 + (- 2 c + 4 a c - 6 b - 2 a ) d
1970 + (4 b c - 8 a b c + 4 b + 4 a b) d - c + 4 a c
1972 + (- 2 b - 6 a ) c + (4 a b + 4 a ) c - b - 2 a b - a )
1974 + (a - c) s + (c - a) r + (c + a) d + (- 2 b c - 2 a b) d
1976 + c - a c + (b - a ) c + a b + a )
1978 /(2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a ),
1980 y = - ((c - a) sqrt(- s + (2 r + 2 d - 4 b d + 2 c - 4 a c
1982 + 2 b + 2 a ) s - r + (2 d - 4 b d + 2 c - 4 a c + 2 b
1984 + 2 a ) r - d + 4 b d + (- 2 c + 4 a c - 6 b - 2 a ) d
1986 + (4 b c - 8 a b c + 4 b + 4 a b) d - c + 4 a c
1988 + (- 2 b - 6 a ) c + (4 a b + 4 a ) c - b - 2 a b - a )
1990 + (d - b) s + (b - d) r - d + b d
1992 + (- c + 2 a c + b - a ) d - b c + 2 a b c - b - a b)
1994 /(2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a )]]
1997 (%i5) ratsimp(subst(soln[1],[eq1,eq2]));
2001 (%i6) ratsimp(subst(soln[2],[eq1,eq2]));
2006 @c -----------------------------------------------------------------------------
2007 @subsubheading Simplify the equations using poly_reduced_grobner
2009 Sometimes the system of equations can be solved after preprocessing
2011 @mref{poly_reduced_grobner} from the @var{grobner} package.
2013 The reduced Gröbner basis returned at (%o4) consists of two polynomials
2014 in unknowns @var{x} and @var{y}:
2015 the first is bilinear in the unknowns;
2016 the second is quadratic in @var{y} only. This confirms there
2017 are two (perhaps multiple) solutions, as we know geometrically.
2020 @c eq1: (x-a)^2+(y-b)^2-r^2;
2021 @c eq2: (x-c)^2+(y-d)^2-s^2;
2022 @c /* load grobner package */
2024 @c poly_reduced_grobner([eq1,eq2],[x,y]);
2025 @c soln:algsys(%,[x,y]);
2026 @c ratsimp(subst(soln[1],[eq1,eq2]));
2027 @c ratsimp(subst(soln[2],[eq1,eq2]));
2031 (%i1) eq1: (x-a)^2+(y-b)^2-r^2;
2033 (%o1) (y - b) + (x - a) - r
2036 (%i2) eq2: (x-c)^2+(y-d)^2-s^2;
2038 (%o2) (y - d) + (x - c) - s
2041 (%i3) /* load grobner package */
2045 (%i4) poly_reduced_grobner([eq1,eq2],[x,y]);
2047 (%o4) [(2 d - 2 b) y + (2 c - 2 a) x + s - r - d - c + b
2049 + a , (4 d - 8 b d + 4 c - 8 a c + 4 b + 4 a ) y
2051 + (d (4 s - 4 r + 4 b ) + b (4 r - 4 s ) - 4 d + 4 b d
2053 + a c (8 d + 8 b) + c (- 4 d - 4 b) + a (- 4 d - 4 b) - 4 b )
2055 y + s + c (a (4 s + 4 r - 4 d - 4 b ) - 4 a )
2057 + b (2 s - 2 r ) - 2 r s + d (- 2 s + 2 r - 2 b )
2059 + c (- 2 s - 2 r + 2 d + 2 b + 6 a )
2061 + a (- 2 s - 2 r + 2 d + 2 b ) + r + d + c - 4 a c + b
2066 (%i5) soln:algsys(%,[x,y]);
2068 (%o5) [[x = - ((d - b) sqrt(- s
2070 + (2 r + 2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a ) s - r
2072 + (2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a ) r - d + 4 b d
2074 + (- 2 c + 4 a c - 6 b - 2 a ) d
2076 + (4 b c - 8 a b c + 4 b + 4 a b) d - c + 4 a c
2078 + (- 2 b - 6 a ) c + (4 a b + 4 a ) c - b - 2 a b - a )
2080 + (c - a) s + (a - c) r + (- c - a) d + (2 b c + 2 a b) d
2082 - c + a c + (a - b ) c - a b - a )
2084 /(2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a ),
2086 y = ((c - a) sqrt(- s + (2 r + 2 d - 4 b d + 2 c - 4 a c
2088 + 2 b + 2 a ) s - r + (2 d - 4 b d + 2 c - 4 a c + 2 b
2090 + 2 a ) r - d + 4 b d + (- 2 c + 4 a c - 6 b - 2 a ) d
2092 + (4 b c - 8 a b c + 4 b + 4 a b) d - c + 4 a c
2094 + (- 2 b - 6 a ) c + (4 a b + 4 a ) c - b - 2 a b - a )
2096 + (b - d) s + (d - b) r + d - b d + (c - 2 a c - b + a ) d
2098 + b c - 2 a b c + b + a b)/(2 d - 4 b d + 2 c - 4 a c
2100 + 2 b + 2 a )], [x = ((d - b) sqrt(- s
2102 + (2 r + 2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a ) s - r
2104 + (2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a ) r - d + 4 b d
2106 + (- 2 c + 4 a c - 6 b - 2 a ) d
2108 + (4 b c - 8 a b c + 4 b + 4 a b) d - c + 4 a c
2110 + (- 2 b - 6 a ) c + (4 a b + 4 a ) c - b - 2 a b - a )
2112 + (a - c) s + (c - a) r + (c + a) d + (- 2 b c - 2 a b) d
2114 + c - a c + (b - a ) c + a b + a )
2116 /(2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a ),
2118 y = - ((c - a) sqrt(- s + (2 r + 2 d - 4 b d + 2 c - 4 a c
2120 + 2 b + 2 a ) s - r + (2 d - 4 b d + 2 c - 4 a c + 2 b
2122 + 2 a ) r - d + 4 b d + (- 2 c + 4 a c - 6 b - 2 a ) d
2124 + (4 b c - 8 a b c + 4 b + 4 a b) d - c + 4 a c
2126 + (- 2 b - 6 a ) c + (4 a b + 4 a ) c - b - 2 a b - a )
2128 + (d - b) s + (b - d) r - d + b d
2130 + (- c + 2 a c + b - a ) d - b c + 2 a b c - b - a b)
2132 /(2 d - 4 b d + 2 c - 4 a c + 2 b + 2 a )]]
2135 (%i6) ratsimp(subst(soln[1],[eq1,eq2]));
2139 (%i7) ratsimp(subst(soln[2],[eq1,eq2]));
2144 @c -----------------------------------------------------------------------------
2145 @subsection Example 2: Equations with irrational coefficients
2147 The presence of irrational coefficients can prevent @var{algsys}
2148 from finding solutions. Replacing the constant with a symbol
2149 allows a solution to be found.
2152 @c eq1: %pi*y + x - 1;
2154 @c algsys([eq1,eq2],[x,y]);
2155 @c /* Substitute p for %p and magically algsys finds solutions */
2156 @c eq1a:subst(p,%pi,eq1);
2157 @c s:algsys([eq1a,eq2],[x,y]);
2158 @c /* substitute %pi for p */
2159 @c s:subst(%pi,p,s)$
2160 @c /* Check the solution */
2161 @c ratsimp(subst(s[1],[eq1,eq2]));
2162 @c ratsimp(subst(s[2],[eq1,eq2]));
2163 @c ratsimp(subst(s[3],[eq1,eq2]));
2164 @c /* numerical values of solution */
2165 @c rectform(float(s));
2169 (%i1) eq1: %pi*y + x - 1;
2173 (%i2) eq2: 1 - x^2*y;
2178 (%i3) algsys([eq1,eq2],[x,y]);
2182 (%i4) /* Substitute p for %p and magically algsys finds solutions */
2183 eq1a:subst(p,%pi,eq1);
2187 (%i5) s:algsys([eq1a,eq2],[x,y]);
2189 (%o5) [[x = - ((2 sqrt(3) %i + 2 )
2191 (3 sqrt(27 p - 4 p) - 27 p + 2)
2193 + (3 sqrt(27 p - 4 p) - 27 p + 2)
2195 ((9 2 %i - 2 3 ) sqrt(27 p - 4 p)
2197 + (2 3 %i - 27 2 ) p - 2 sqrt(3) %i + 2 ) - 8)/24,
2199 y = ((2 sqrt(3) %i + 2 )
2201 (3 sqrt(27 p - 4 p) - 27 p + 2)
2203 + (3 sqrt(27 p - 4 p) - 27 p + 2)
2205 ((9 2 %i - 2 3 ) sqrt(27 p - 4 p)
2207 + (2 3 %i - 27 2 ) p - 2 sqrt(3) %i + 2 ) + 16)
2209 /(24 p)], [x = ((2 sqrt(3) %i - 2 )
2211 (3 sqrt(27 p - 4 p) - 27 p + 2)
2213 + (3 sqrt(27 p - 4 p) - 27 p + 2)
2215 ((9 2 %i + 2 3 ) sqrt(27 p - 4 p)
2217 + (2 3 %i + 27 2 ) p - 2 sqrt(3) %i - 2 ) + 8)/24,
2219 y = - ((2 sqrt(3) %i - 2 )
2221 (3 sqrt(27 p - 4 p) - 27 p + 2)
2223 + (3 sqrt(27 p - 4 p) - 27 p + 2)
2225 ((9 2 %i + 2 3 ) sqrt(27 p - 4 p)
2227 + (2 3 %i + 27 2 ) p - 2 sqrt(3) %i - 2 ) - 16)
2229 /(24 p)], [x = - (- 2 (3 sqrt(27 p - 4 p) - 27 p + 2)
2231 + (3 sqrt(27 p - 4 p) - 27 p + 2)
2233 (2 3 sqrt(27 p - 4 p) + 27 2 p - 2 ) - 4)/12,
2235 y = (- 2 (3 sqrt(27 p - 4 p) - 27 p + 2)
2237 + (3 sqrt(27 p - 4 p) - 27 p + 2)
2239 (2 3 sqrt(27 p - 4 p) + 27 2 p - 2 ) + 8)/(12 p)]]
2242 (%i6) /* substitute %pi for p */
2246 (%i7) /* Check the solution */
2247 ratsimp(subst(s[1],[eq1,eq2]));
2251 (%i8) ratsimp(subst(s[2],[eq1,eq2]));
2255 (%i9) ratsimp(subst(s[3],[eq1,eq2]));
2259 (%i10) /* numerical values of solution */
2261 (%o10) [[x = 1.0980298583288306 - 1.1920356507617584 %i,
2262 y = 0.37943673232099623 %i - 0.031203873047263193],
2263 [x = 1.1920356507617584 %i + 1.0980298583288306,
2264 y = - 0.37943673232099623 %i - 0.031203873047263193],
2265 [x = - 1.1960597166576612, y = 0.6990275184621078]]
2269 @c -----------------------------------------------------------------------------
2270 @subsection Example 3: Assumptions on parameters
2272 @var{algsys} may require assumptions on parameters to obtain a solution.
2273 No general guidance can be provided. Users may be able to use their knowledge
2274 of the problem to restrict the range of parameters appropriately.
2277 @c eqs:[y-x=0, g*x*y-h=0, z+(x+1)/y-x-1=0];
2278 @c /* without assumptions no solution is found */
2279 @c algsys(eqs,[x,y,z]);
2281 @c algsys(eqs,[x,y,z]);
2282 @c /* With a different assumption the solution has a different form */
2283 @c (forget(h>0),assume(h<0));
2284 @c algsys(eqs,[x,y,z]);
2288 (%i1) eqs:[y-x=0, g*x*y-h=0, z+(x+1)/y-x-1=0];
2290 (%o1) [y - x = 0, g x y - h = 0, z + ----- - x - 1 = 0]
2294 (%i2) /* without assumptions no solution is found */
2295 algsys(eqs,[x,y,z]);
2303 (%i4) algsys(eqs,[x,y,z]);
2304 sqrt(h) sqrt(h) h - g
2305 (%o4) [[x = -------, y = -------, z = ---------------],
2306 sqrt(g) sqrt(g) sqrt(g) sqrt(h)
2307 sqrt(h) sqrt(h) h - g
2308 [x = - -------, y = - -------, z = - ---------------]]
2309 sqrt(g) sqrt(g) sqrt(g) sqrt(h)
2312 (%i5) /* With a different assumption the solution has a different form */
2313 (forget(h>0),assume(h<0));
2317 (%i6) algsys(eqs,[x,y,z]);
2318 %i sqrt(- h) %i sqrt(- h)
2319 (%o6) [[x = - ------------, y = - ------------,
2321 sqrt(- h) (%i h - %i g)
2322 z = - -----------------------],
2324 %i sqrt(- h) %i sqrt(- h)
2325 [x = ------------, y = ------------,
2327 sqrt(- h) (%i h - %i g)
2328 z = -----------------------]]
2333 @c -----------------------------------------------------------------------------
2334 @subsection Example 4: Preproccess equations with poly_reduced_grobner
2336 In this example the direct solution of the system of equations
2337 using @var{algsys} finds four real solutions.
2338 After preprocessing with @mref{poly_reduced_grobner}, ten
2339 solutions are found.
2341 Inspection of the reduced Gröbner basis returned at (%o5) shows that it
2342 comprises a degree-10 polynomial in @var{y} and an expression
2343 linear in @var{x} and of degree-8 in @var{y}. There can be at most
2344 10 solutions for y, and exactly one @var{x} solution for each @var{y}
2345 solution, for a maximum of ten solutions overall.
2348 @c p1:-x*y^3+y^2+x^4-9*x/8;
2349 @c p2:y^4-x^3*y-9*y/8+x^2;
2350 @c algsys([p1,p2],[x,y]);
2351 @c /* load grobner package */
2353 @c eqs:poly_reduced_grobner([p1,p2],[x,y]);
2354 @c algsys(eqs,[x,y]);
2358 (%i1) p1:-x*y^3+y^2+x^4-9*x/8;
2360 (%o1) - x y + y + x - ---
2364 (%i2) p2:y^4-x^3*y-9*y/8+x^2;
2366 (%o2) y - x y - --- + x
2370 (%i3) algsys([p1,p2],[x,y]);
2372 (%o3) [[x = -, y = 1], [x = -, y = -], [x = 1, y = -],
2377 (%i4) /* load grobner package */
2381 (%i5) eqs:poly_reduced_grobner([p1,p2],[x,y]);
2383 (%o5) [- 200704 y + 437832 y - 263633 y + 53010 x,
2385 4096 y - 10440 y + 7073 y - 729 y]
2388 (%i6) algsys(eqs,[x,y]);
2390 (%o6) [[x = 0, y = 0], [x = 1, y = -], [x = -, y = -],
2392 1 sqrt(3) %i - 1 sqrt(3) %i + 1
2393 [x = -, y = 1], [x = --------------, y = - --------------],
2395 sqrt(3) %i + 1 sqrt(3) %i - 1
2396 [x = - --------------, y = --------------],
2400 [x = -----------, y = - -----------],
2404 [x = - -----------, y = -----------],
2406 sqrt(3) %i - 1 sqrt(3) %i + 1
2407 [x = --------------, y = - --------------],
2409 sqrt(3) %i + 1 sqrt(3) %i - 1
2410 [x = - --------------, y = --------------]]
2415 @subsection Example 5: Intersection of a sphere with two paraboloids
2417 This problem is the intersection of a sphere with two paraboloids
2418 (@ref{allgower,,Allgower et al 1992}, Example 2, p841).
2420 There are two real solutions y = z = (sqrt(5)-1)/2,
2421 x = +/- sqrt(z-y^2) = +/- sqrt(sqrt(5)-2).
2424 @c algsys([x^2+y^2+z^2-1,z-x^2-y^2,y-x^2-z^2],[x,y,z]);
2428 (%i1) algsys([x^2+y^2+z^2-1,z-x^2-y^2,y-x^2-z^2],[x,y,z]);
2429 sqrt(5) - 1 sqrt(5) + 1
2430 (%o1) [[x = sqrt(2) %i, y = -----------, z = - -----------],
2432 sqrt(5) + 1 sqrt(5) - 1
2433 [x = sqrt(2) %i, y = - -----------, z = -----------],
2435 sqrt(5) - 1 sqrt(5) + 1
2436 [x = - sqrt(2) %i, y = -----------, z = - -----------],
2438 sqrt(5) + 1 sqrt(5) - 1
2439 [x = - sqrt(2) %i, y = - -----------, z = -----------],
2441 sqrt(5) + 1 sqrt(5) + 1
2442 [x = sqrt(- sqrt(5) - 2), y = - -----------, z = - -----------],
2445 [x = - sqrt(- sqrt(5) - 2), y = - -----------,
2447 sqrt(5) + 1 sqrt(5) - 1
2448 z = - -----------], [x = sqrt(sqrt(5) - 2), y = -----------,
2450 sqrt(5) - 1 sqrt(5) - 1
2451 z = -----------], [x = - sqrt(sqrt(5) - 2), y = -----------,
2459 @c =============================================================================
2460 @node References for equations, , Examples for algsys, Equations
2461 @section References for equations
2465 @item @anchor{beyer}
2466 (Beyer 1984) Beyer, William A.,
2467 Solution of Simultaneous Polynomial Equations by Elimination in MACSYMA,
2468 @url{ http://udspace.udel.edu/handle/19716/1399 ,
2469 Proceedings of the 1984 MACSYMA Users' Conference}, pp 110-120
2472 @item @anchor{allgower}
2473 (Allgower et al 1992) Eugene L. Allgower, Kurt Georg and Rick Miranda,
2475 Resultants for Computing Real Solutions of Polynomial Systems,
2476 SIAM Journal on Numerical Analysis, Vol 29 No 3, Jun 1992, pp 831-844
2477 @url{https:/doi.org/10.1137/0729051, doi:10.1137/0729051}