Next: VECTORS and MATRICES Up: A Short Maple Primer Previous: SIMPLIFICATION

EQUATIONS

The call solve(eq,var); solves the equation eq w.r.t. var. If there is no = in eq the right hand side is supposed to be zero, and if var is left out all variables occurring are considered unknown. If there are several solutions to eq then solve returns an expression sequence, i.e. several expressions separated by commas. It is up to the user to collect the solutions in a set or a list etc. An equation system is given as a set of equations; in this case the second argument is a set of variables.


> eq:=x^2-x+1=0:
> solve(eq);
                                    1/2               1/2
                       1/2 + 1/2 I 3   , 1/2 - 1/2 I 3   

> S:=[solve(2*z^3-z^2+11*z-21)];

                                    1/2                 1/2
          S := [3/2, - 1/2 + 3/2 I 3   , - 1/2 - 3/2 I 3   ]

> solve({x*y-y,x^2-y^2});

            {x = 0, y = 0}, {x = 1, y = 1}, {x = 1, y = -1}

Sometimes Maple answers using RootOf, which is short for ``the solution of the equation''. This function uses the global parameter _Z. To force a (numerical) solution, use fsolve or allvalues.

To solve the differential equation deq with y as unknown, type > dsolve(deq,y(x));

An example of deq:

> deq:=diff(y(x),x,x)-y(x)=0;Initial conditions are treated like this:

> deq:={diff(y(x),x,x)-y=0,y(0)=1, D(y)(0)=0};

You can also solve a DE numerically with a 4-5:th order Runge-Kutta. Type

> ?dsolve[numeric] for more information about this.


bondaren@thsun1.jinr.ru