Sophie

Sophie

distrib > Mandriva > 9.0 > i586 > by-pkgid > 8d125f3514d54b70bf040165a2f5d2e4 > files > 323

maxima-5.6-1mdk.i586.rpm

<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.52
     from maxima.texi on 25 April 2001 -->

<TITLE>Maxima Manual - Equations</TITLE>
<link href="maxima_21.html" rel=Next>
<link href="maxima_19.html" rel=Previous>
<link href="maxima_toc.html" rel=ToC>

</HEAD>
<BODY>
<p>Go to the <A HREF="maxima_1.html">first</A>, <A HREF="maxima_19.html">previous</A>, <A HREF="maxima_21.html">next</A>, <A HREF="maxima_41.html">last</A> section, <A HREF="maxima_toc.html">table of contents</A>.
<P><HR><P>


<H1><A NAME="SEC63" HREF="maxima_toc.html#TOC63">Equations</A></H1>



<H2><A NAME="SEC64" HREF="maxima_toc.html#TOC64">Definitions for Equations</A></H2>

<P>
<DL>
<DT><U>Variable:</U> <B>%RNUM_LIST</B>
<DD><A NAME="IDX510"></A>
 default: [] - When %R variables are introduced in solutions
by the ALGSYS command, they are added to %RNUM_LIST in the order they
are created.  This is convenient for doing substitutions into the
solution later on.  It's recommended to use this list rather than
doing CONCAT('%R,J).
</DL>

</P>
<P>
<DL>
<DT><U>Variable:</U> <B>ALGEXACT</B>
<DD><A NAME="IDX511"></A>
 default: [FALSE] affects the behavior of ALGSYS as follows:
If ALGEXACT is TRUE, ALGSYS always calls SOLVE and then uses REALROOTS
on SOLVE's failures.  If ALGEXACT is FALSE, SOLVE is called only if
the eliminant was not univariate, or if it was a quadratic or
biquadratic.  Thus ALGEXACT:TRUE doesn't guarantee only exact
solutions, just that ALGSYS will first try as hard as it can to give
exact solutions, and only yield approximations when all else fails.
</DL>

</P>
<P>
<DL>
<DT><U>Function:</U> <B>ALGSYS</B> <I>([exp1, exp2, ...], [var1, var2, ...])</I>
<DD><A NAME="IDX512"></A>
solves the list of
simultaneous polynomials or polynomial equations (which can be
non-linear) for the list of variables.  The symbols %R1, %R2, etc.
will be used to represent arbitrary parameters when needed for the
solution (the variable %RNUM_LIST holds these).  In the process
described below, ALGSYS is entered recursively if necessary.
    The method is as follows:
(1) First the equations are FACTORed and split into subsystems.
(2) For each subsystem Si, an equation E and a variable var are
selected (the var is chosen to have lowest nonzero degree).  Then the
resultant of E and Ej with respect to var is computed for each of the
remaining equations Ej in the subsystem Si.  This yields a new
subsystem S'i in one fewer variables (var has been eliminated).  The
process now returns to (1).
(3) Eventually, a subsystem consisting of a single equation is
obtained.  If the equation is multivariate and no approximations in
the form of floating point numbers have been introduced, then SOLVE is
called to find an exact solution.  (The user should realize that SOLVE
may not be able to produce a solution or if it does the solution may
be a very large expression.)
    If the equation is univariate and is either linear, quadratic, or
bi-quadratic, then again SOLVE is called if no approximations have
been introduced.  If approximations have been introduced or the
equation is not univariate and neither linear, quadratic, or
bi-quadratic, then if the switch REALONLY[FALSE] is TRUE, the function
REALROOTS is called to find the real-valued solutions.  If
REALONLY:FALSE then ALLROOTS is called which looks for real and
complex-valued solutions.  If ALGSYS produces a solution which has
fewer significant digits than required, the user can change the value
of ALGEPSILON[10^8] to a higher value.  If ALGEXACT[FALSE] is set to
TRUE, SOLVE will always be called.
(4) Finally, the solutions obtained in step (3) are re-inserted into
previous levels and the solution process returns to (1).
The user should be aware of several caveats:
    When ALGSYS encounters a multivariate equation which contains
floating point approximations (usually due to its failing to find
exact solutions at an earlier stage), then it does not attempt to
apply exact methods to such equations and instead prints the message:
        "ALGSYS cannot solve - system too complicated."
    Interactions with RADCAN can produce large or complicated
expressions.  In that case, the user may use PICKAPART or REVEAL to
analyze the solution.  Occasionally, RADCAN may introduce an apparent
%I into a solution which is actually real-valued.  Do EXAMPLE(ALGSYS);
for examples.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>ALLROOTS</B> <I>(poly)</I>
<DD><A NAME="IDX513"></A>
finds all the real and complex roots of the real
polynomial poly which must be univariate and may be an equation, e.g.
poly=0.  For complex polynomials an algorithm by Jenkins and Traub is
used (Algorithm 419, Comm. ACM, vol. 15, (1972), p. 97).  For real
polynomials the algorithm used is due to Jenkins (Algorithm 493, TOMS,
vol. 1, (1975), p.178).  The flag POLYFACTOR[FALSE] when true causes
ALLROOTS to factor the polynomial over the real numbers if the
polynomial is real, or over the complex numbers, if the polynomial is
complex.  ALLROOTS may give inaccurate results in case of multiple
roots.  (If poly is real and you get inaccurate answers, you may want
to try ALLROOTS(%I*poly);) Do EXAMPLE(ALLROOTS); for an example.
ALLROOTS rejects non-polynomials.  It requires that the numerator
after RATting should be a polynomial, and it requires that the
denominator be at most a complex number.  As a result of this ALLROOTS
will always return an equivalent (but factored) expression, if
POLYFACTOR is TRUE.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>BACKSUBST</B>
<DD><A NAME="IDX514"></A>
 default: [TRUE] if set to FALSE will prevent back
substitution after the equations have been triangularized.  This may
be necessary in very big problems where back substitution would cause
the generation of extremely large expressions.  (On MC this could cause
storage capacity to be exceeded.)

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>BREAKUP</B>
<DD><A NAME="IDX515"></A>
 default: [TRUE] if FALSE will cause SOLVE to express the
solutions of cubic or quartic equations as single expressions rather
than as made up of several common subexpressions which is the default.
BREAKUP:TRUE only works when PROGRAMMODE is FALSE.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>DIMENSION</B> <I>(equation or list of equations)</I>
<DD><A NAME="IDX516"></A>
The file "share1/dimen.mc"
contains functions for automatic dimensional analysis.  LOAD(DIMEN);
will load it up for you.  There is a demonstration available in
share1/dimen.dem.  Do DEMO("dimen"); to run it.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>DISPFLAG</B>
<DD><A NAME="IDX517"></A>
 default: [TRUE] if set to FALSE within a BLOCK will inhibit
the display of output generated by the solve functions called from
within  the BLOCK.  Termination of the BLOCK with a dollar sign, $, sets
DISPFLAG to FALSE.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>FUNCSOLVE</B> <I>(eqn,g(t))</I>
<DD><A NAME="IDX518"></A>
gives [g(t) = ...]  or [], depending on whether
or not there exists a rational fcn g(t) satisfying eqn, which must be
a first order, linear polynomial in (for this case) g(t) and g(t+1).

<PRE>
(C1) FUNCSOLVE((N+1)*FOO(N)-(N+3)*FOO(N+1)/(N+1) =
    (N-1)/(N+2),FOO(N));
                                   N
(D1)               FOO(N) = ---------------
                            (N + 1) (N + 2)

</PRE>

<P>
Warning: this is a very rudimentary implementation--many safety checks
and obvious generalizations are missing.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>GLOBALSOLVE</B>
<DD><A NAME="IDX519"></A>
 default: [FALSE] if set to TRUE then variables which are
SOLVEd for will be set to the solution of the set of simultaneous
equations.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>IEQN</B> <I>(ie,unk,tech,n,guess)</I>
<DD><A NAME="IDX520"></A>
Integral Equation solving routine.  Do
LOAD(INTEQN); to access it.  CAVEAT: To free some storage, a
KILL(LABELS) is included in this file.  Therefore, before loading the
integral equation package, the user should give names to any
expressions he wants to keep.
ie is the integral equation; unk is the unknown function; tech is the
technique to be tried from those given above (tech = FIRST means: try
the first technique which finds a solution; tech = ALL means: try all
applicable techniques); n is the maximum number of terms to take for
TAYLOR, NEUMANN, FIRSTKINDSERIES, or FREDSERIES (it is also the
maximum depth of recursion for the differentiation method); guess is
the initial guess for NEUMANN or FIRSTKINDSERIES.
Default values for the 2nd thru 5th parameters are:
unk: P(X), where P is the first function encountered in an integrand
which is unknown to MACSYMA and X is the variable which occurs as an
argument to the first occurrence of P found outside of an integral in
the case of SECONDKIND equations, or is the only other variable
besides the variable of integration in FIRSTKIND equations.  If the
attempt to search for X fails, the user will be asked to supply the
independent variable;
tech: FIRST;
n: 1;
guess: NONE, which will cause NEUMANN and FIRSTKINDSERIES to use F(X)
as an initial guess.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>IEQNPRINT</B>
<DD><A NAME="IDX521"></A>
 default: [TRUE] - governs the behavior of the result
returned by the IEQN command (which see).  If IEQNPRINT is set to
FALSE, the lists returned by the IEQN function are of the form
   [SOLUTION, TECHNIQUE USED, NTERMS, FLAG]
where FLAG is absent if the solution is exact.  Otherwise, it is the
word APPROXIMATE or INCOMPLETE corresponding to an inexact or
non-closed form solution, respectively. If a series method was used,
NTERMS gives the number of terms taken (which could be less than the n
given to IEQN if an error prevented generation of further terms).

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>LHS</B> <I>(eqn)</I>
<DD><A NAME="IDX522"></A>
the left side of the equation eqn.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>LINSOLVE</B> <I>([exp1, exp2, ...], [var1, var2, ...])</I>
<DD><A NAME="IDX523"></A>
solves the list of
simultaneous linear equations for the list of variables.  The expi
must each be polynomials in the variables and may be equations.
If GLOBALSOLVE[FALSE] is set to TRUE then variables which are SOLVEd
for will be set to the solution of the set of simultaneous equations.
BACKSUBST[TRUE] if set to FALSE will prevent back substitution after
the equations have been triangularized.  This may be necessary in very
big problems where back substitution would cause the generation of
extremely large expressions.  (On MC this could cause the storage
capacity to be exceeded.)
LINSOLVE_PARAMS[TRUE] If TRUE, LINSOLVE also generates the %Ri symbols
used to represent arbitrary parameters described in the manual under
ALGSYS.  If FALSE, LINSOLVE behaves as before, i.e. when it meets up
with an under-determined system of equations, it solves for some of
the variables in terms of others.

<PRE>
(C1) X+Z=Y$
(C2) 2*A*X-Y=2*A**2$
(C3) Y-2*Z=2$
(C4) LINSOLVE([D1,D2,D3],[X,Y,Z]),GLOBALSOLVE:TRUE;
SOLUTION
(E4)                            X : A + 1
(E5)                             Y : 2 A
(E6)                            Z : A - 1
(D6)                          [E4, E5, E6]

</PRE>

</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>LINSOLVEWARN</B>
<DD><A NAME="IDX524"></A>
 default: [TRUE] - if FALSE will cause the message
"Dependent equations eliminated" to be suppressed.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>LINSOLVE_PARAMS</B>
<DD><A NAME="IDX525"></A>
 default: [TRUE] - If TRUE, LINSOLVE also generates
the %Ri symbols used to represent arbitrary parameters described in
the manual under ALGSYS.  If FALSE, LINSOLVE behaves as before, i.e.
when it meets up with an under-determined system of equations, it
solves for some of the variables in terms of others.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>MULTIPLICITIES</B>
<DD><A NAME="IDX526"></A>
 default: [NOT_SET_YET] - will be set to a list of the
multiplicities of the individual solutions returned by SOLVE or
REALROOTS.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>NROOTS</B> <I>(poly, low, high)</I>
<DD><A NAME="IDX527"></A>
finds the number of real roots of the real
univariate polynomial poly in the half-open interval (low,high].  The
endpoints of the interval may also be MINF,INF respectively for minus
infinity and plus infinity.  The method of Sturm sequences is used.

<PRE>
(C1) POLY1:X**10-2*X**4+1/2$
(C2) NROOTS(POLY1,-6,9.1);
RAT REPLACED 0.5 BY 1/2 = 0.5
(D2)                               4

</PRE>

</DL>
<P>
<DL>
<DT><U>Function:</U> <B>NTHROOT</B> <I>(p,n)</I>
<DD><A NAME="IDX528"></A>
where p is a polynomial with integer coefficients and
n is a positive integer returns q, a polynomial over the integers, such
that q^n=p or prints an error message indicating that p is not a perfect
nth power. This routine is much faster than FACTOR or even SQFR.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>PROGRAMMODE</B>
<DD><A NAME="IDX529"></A>
 default: [TRUE] - when FALSE will cause SOLVE, REALROOTS,
ALLROOTS, and LINSOLVE to print E-labels (intermediate line labels) to
label answers.  When TRUE, SOLVE, etc. return answers as elements in a
list.  (Except when BACKSUBST is set to FALSE, in which case
PROGRAMMODE:FALSE is also used.)

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>REALONLY</B>
<DD><A NAME="IDX530"></A>
 default: [FALSE] - if TRUE causes ALGSYS to return only
those solutions which are free of %I.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>REALROOTS</B> <I>(poly, bound)</I>
<DD><A NAME="IDX531"></A>
finds all of the real roots of the real
univariate polynomial poly within a tolerance of bound which, if less
than 1, causes all integral roots to be found exactly.  The parameter
bound may be arbitrarily small in order to achieve any desired
accuracy.  The first argument may also be an equation.  REALROOTS sets
MULTIPLICITIES, useful in case of multiple roots.  REALROOTS(poly) is
equivalent to REALROOTS(poly,ROOTSEPSILON).  ROOTSEPSILON[1.0E-7] is a
real number used to establish the confidence interval for the roots.
Do EXAMPLE(REALROOTS); for an example.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>RHS</B> <I>(eqn)</I>
<DD><A NAME="IDX532"></A>
the right side of the equation eqn.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>ROOTSCONMODE</B>
<DD><A NAME="IDX533"></A>
 default: [TRUE] - Determines the behavior of the
ROOTSCONTRACT command.  Do DESCRIBE(ROOTSCONTRACT); for details.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>ROOTSCONTRACT</B> <I>(exp)</I>
<DD><A NAME="IDX534"></A>
converts products of roots into roots of products.
For example,

<PRE>
ROOTSCONTRACT(SQRT(X)*Y^(3/2)) ==&#62; SQRT(X*Y^3)
</PRE>

<P>
When
RADEXPAND is TRUE and DOMAIN is REAL (their defaults), ROOTSCONTRACT
converts ABS into SQRT, e.g.

</P>

<PRE>
ROOTSCONTRACT(ABS(X)*SQRT(Y)) ==&#62; SQRT(X^2*Y)
</PRE>

<P>
There is an option ROOTSCONMODE (default value TRUE),
affecting ROOTSCONTRACT as follows:

</P>


<PRE>

Problem            Value of        Result of applying
                  ROOTSCONMODE        ROOTSCONTRACT
	      
X^(1/2)*Y^(3/2)      FALSE          (X*Y^3)^(1/2)
X^(1/2)*Y^(1/4)      FALSE          X^(1/2)*Y^(1/4)
X^(1/2)*Y^(1/4)      TRUE           (X*Y^(1/2))^(1/2)
X^(1/2)*Y^(1/3)      TRUE           X^(1/2)*Y^(1/3)
X^(1/2)*Y^(1/4)      ALL            (X^2*Y)^(1/4)
X^(1/2)*Y^(1/3)      ALL            (X^3*Y^2)^(1/6)
</PRE>

<P>
The above examples and more may be tried out by typing 

</P>

<PRE>
EXAMPLE(ROOTSCONTRACT);
</PRE>

<P>
When ROOTSCONMODE is FALSE, ROOTSCONTRACT contracts only wrt rational 
number exponents whose denominators are the same.  The key to the 
ROOTSCONMODE:TRUE$ examples is simply that 2 divides into 4 but not 
into 3.  ROOTSCONMODE:ALL$ involves taking the lcm (least common multiple)
of the denominators of the exponents.
ROOTSCONTRACT uses RATSIMP in a manner similar to LOGCONTRACT (see the 
manual).  

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>ROOTSEPSILON</B>
<DD><A NAME="IDX535"></A>
 default: [1.0E-7] - a real number used to establish the
confidence interval for the roots found by the REALROOTS function.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>SOLVE</B> <I>(exp, var)</I>
<DD><A NAME="IDX536"></A>
solves the algebraic equation exp for the variable
var and returns a list of solution equations in var.  If exp is not an
equation, it is assumed to be an expression to be set equal to zero.
Var may be a function (e.g. F(X)), or other non-atomic expression
except a sum or product. It may be omitted if exp contains only one
variable.  Exp may be a rational expression, and may contain
trigonometric functions, exponentials, etc.  The following method is
used:
Let E be the expression and X be the variable.  If E is linear in X
then it is trivially solved for X.  Otherwise if E is of the form
A*X**N+B then the result is (-B/A)**(1/N) times the Nth roots of
unity.
If E is not linear in X then the gcd of the exponents of X in E (say
N) is divided into the exponents and the multiplicity of the roots is
multiplied by N.  Then SOLVE is called again on the result.
If E factors then SOLVE is called on each of the factors.  Finally
SOLVE will use the quadratic, cubic, or quartic formulas where
necessary.
In the case where E is a polynomial in some function of the variable
to be solved for, say F(X), then it is first solved for F(X) (call the
result C), then the equation F(X)=C can be solved for X provided the
inverse of the function F is known.
BREAKUP[TRUE] if FALSE will cause SOLVE to express the solutions of
cubic or quartic equations as single expressions rather than as made
up of several common subexpressions which is the default.
MULTIPLICITIES[NOT_SET_YET] - will be set to a list of the multiplicities of
the individual solutions returned by SOLVE, REALROOTS, or ALLROOTS.
Try APROPOS(SOLVE) for the switches which affect SOLVE.  DESCRIBE may
then by used on the individual switch names if their purpose is not
clear.
SOLVE([eq1, ..., eqn], [v1, ..., vn]) solves a system of simultaneous
(linear or non-linear) polynomial equations by calling LINSOLVE or
ALGSYS and returns a list of the solution lists in the variables.  In
the case of LINSOLVE this list would contain a single list of
solutions.  It takes two lists as arguments.  The first list (eqi,
i=1,...,n) represents the equations to be solved; the second list is a
list of the unknowns to be determined.  If the total number of
variables in the equations is equal to the number of equations, the
second argument-list may be omitted.  For linear systems if the given
equations are not compatible, the message INCONSISTENT will be
displayed (see the SOLVE_INCONSISTENT_ERROR switch); if no unique
solution exists, then SINGULAR will be displayed.  For examples, do
EXAMPLE(SOLVE);

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>SOLVEDECOMPOSES</B>
<DD><A NAME="IDX537"></A>
 default: [TRUE] - if TRUE, will induce SOLVE to use
POLYDECOMP (see POLYDECOMP) in attempting to solve polynomials.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>SOLVEEXPLICIT</B>
<DD><A NAME="IDX538"></A>
 default: [FALSE] - if TRUE, inhibits SOLVE from
returning implicit solutions i.e. of the form F(x)=0.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>SOLVEFACTORS</B>
<DD><A NAME="IDX539"></A>
 default: [TRUE] - if FALSE then SOLVE will not try to
factor the expression.  The FALSE setting may be desired in some cases
where factoring is not necessary.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>SOLVENULLWARN</B>
<DD><A NAME="IDX540"></A>
 default: [TRUE] - if TRUE the user will be warned if he
calls SOLVE with either a null equation list or a null variable list.
For example, SOLVE([],[]); would print two warning messages and return
[].

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>SOLVERADCAN</B>
<DD><A NAME="IDX541"></A>
 default: [FALSE] - if TRUE then SOLVE will use RADCAN
which will make SOLVE slower but will allow certain problems
containing exponentials and logs to be solved.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>SOLVETRIGWARN</B>
<DD><A NAME="IDX542"></A>
 default: [TRUE] - if set to FALSE will inhibit printing
by SOLVE of the warning message saying that it is using inverse
trigonometric functions to solve the equation, and thereby losing
solutions.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>SOLVE_INCONSISTENT_ERROR</B>
<DD><A NAME="IDX543"></A>
 default: [TRUE] - If TRUE, SOLVE and
LINSOLVE give an error if they meet up with a set of inconsistent
linear equations, e.g. SOLVE([A+B=1,A+B=2]).  If FALSE, they return []
in this case.  (This is the new mode, previously gotten only by
calling ALGSYS.)

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>ZRPOLY</B>
<DD><A NAME="IDX544"></A>
 - The IMSL ZRPOLY routine for finding the zeros of simple
polynomials (single variable, real coefficients, non-negative integer
exponents), using the Jenkins-Traub technique.
To use it, do:  LOADFILE("imsl");
The command is POLYROOTS(polynomial);
For more info, do: PRINTFILE("zrpoly.usg");
For a demo do: DEMO("zrpoly.dem"); 
For general info on MACSYMA-IMSL packages, PRINTFILE(IMSL,USAGE,SHARE2);

</P>

</DL>
<P>
<DL>
<DT><U>Function:</U> <B>ZSOLVE</B>
<DD><A NAME="IDX545"></A>
 - For those who can make use of approximate numerical
solutions to problems, there is a package which calls a routine which
has been translated from the IMSL fortran library to solve N
simultaneous non-linear equations in N unknowns.  It uses black-box
techniques that probably aren't desirable if an exact solution can be
obtained from one of the smarter solvers (LINSOLVE, ALGSYS, etc).  But
for things that the other solvers don't attempt to handle, this can
probably give some very useful results.  For documentation, do
PRINTFILE("zsolve.usg");.  For a demo do
batch("zsolve.mc")$

</P>
</DL>

<P><HR><P>
<p>Go to the <A HREF="maxima_1.html">first</A>, <A HREF="maxima_19.html">previous</A>, <A HREF="maxima_21.html">next</A>, <A HREF="maxima_41.html">last</A> section, <A HREF="maxima_toc.html">table of contents</A>.
</BODY>
</HTML>