SOLVE INDEX

SOLVE _ _ _ _ _ _ _ _ _ _ _ _ operator

The solve operator solves a single algebraic equation or a system of simultaneous equations.

syntax:

solve(<expression> [ , <kernel>]) or

solve({<expression>,...} [ ,{ <kernel> ,...}] )

If the number of equations equals the number of distinct kernels, the optional kernel argument(s) may be omitted. <expression> is either a scalar expression or an equation. When more than one expression is given, the list of expressions is surrounded by curly braces. The optional list of kernels follows, also in curly braces.

examples:


sss := solve(x^2 + 7); 

  Unknown: X
  SSS := {X= - SQRT(7)*I,
          X=SQRT(7)*I}


rhs first sss; 

  - SQRT(7)*I 


solve(sin(x^2*y),y); 

     2*ARBINT(1)*PI
  {Y=---------------
            2
           X
     PI*(2*ARBINT(1) + 1)
   Y=--------------------}
               2
              X


off allbranch; 

solve(sin(x**2*y),y); 

  {Y=0} 


solve({3x + 5y = -4,2*x + y = -10},{x,y});
 


         22   46
  {{X= - --,Y=--}} 
         7    7


solve({x + a*y + z,2x + 5},{x,y});
 


         5      2*Z - 5
  {{X= - -,Y= - -------}} 
         2        2*A


ab := (x+2)^2*(x^6 + 17x + 1);
 

         8      7      6       3       2
  AB := X  + 4*X  + 4*X  + 17*X  + 69*X  + 72*X + 4 


www := solve(ab,x); 

  {X=ROOT F(X6 + 17*X + 1),X=-2} 
         O            


root_multiplicities; 

  {1,2}

Results of the solve operator are returned as equations in a list. You can use the usual list access methods ( first, second, third, rest and part) to extract the desired equation, and then use the operators rhs and lhs to access the right-hand or left-hand expression o f the equation. When solve is unable to solve an equation, it returns the unsolved part as the argument of root_of, with the variable renamed to avoid confusion, as shown in the last example above.

For one equation, solve uses square-free factorization, roots of unity, and the known inverses of the log, sin, cos, acos, asin, and exponentiation operators. The quadratic, cubic and quartic formulas are used if necessary, but these are applied only when the switch fullroots is set on; otherwise or when no closed form is available the result is returned as root_of expression. The switch trigform determines which type of cubic and quartic formula is used. The multiplicity of each solution is given in a list as the system variable root_multiplicities. For systems of simultaneous linear equations, matrix inversion is used. For nonlinear systems, the Groebner basis method is used.

Linear equation system solving is influenced by the switch cramer.

Singular systems can be solved when the switch solvesingular is on, which is the default setting. An empty list is returned the system of equations is inconsistent. For a linear inconsistent system with parameters the variable requirements constraints conditions for the system to become consistent.

For a solvable linear and polynomial system with parameters the variable assumptions contains a list side relations for the parameters: the solution is valid only as long as none of these expressions is zero.

If the switch varopt is on (default), the system rearranges the variable sequence for minimal computation time. Without varopt the user supplied variable sequence is maintained.

If the solution has free variables (dimension of the solution is greater than zero), these are represented by arbcomplex expressions as long as the switch arbvars is on (default). Without arbvars no explicit equations are generated for free variables.

related:

_ _ _ allbranchswitch

_ _ _ arbvars switch

_ _ _ assumptions variable

_ _ _ fullroots switch

_ _ _ requirements variable

_ _ _ roots operator

_ _ _ root_of operator

_ _ _ trigform switch

_ _ _ varopt switch