Collections 

Several items (numbers, variables, expressions, etc.) separated by commas form a sequence.  A sequence can be assigned to a name. 

> x,sqrt(2),evalf(Pi);
 

x, 2^(1/2), 3.141592654 

> s:= %;
 

x, 2^(1/2), 3.141592654 

If you enclose a sequence in brackets [], you get a list.  Many Maple commands accept lists as arguments, and you can extract one or more of the members of a given list. 

> L:= [s,s];
 

[x, 2^(1/2), 3.141592654, x, 2^(1/2), 3.141592654] 

> L[3];
 

3.141592654 

> L[2..5];
 

[2^(1/2), 3.141592654, x, 2^(1/2)] 

If you enclose a sequence in braces {}, you get a set.  In a set, the elements have no fixed ordering and duplicates are removed. 

> T:= {s,1,sqrt(2)};
 

{1, x, 2^(1/2), 3.141592654} 

To convert a list or set back into a sequence, use the command op. 

> op(L);
 

x, 2^(1/2), 3.141592654, x, 2^(1/2), 3.141592654 

> op(T);
 

1, x, 2^(1/2), 3.141592654 

 

Equations 

An equation in Maple is an expression with an equals sign in it. Remember, = and := are quite different to Maple. 

> x^2 = 1;
 

x^2 = 1 

> x^2 := 1;
 

Error, invalid left hand side of assignment 

You can solve many simple equations (and even some not-simple ones) using solve. If multiple solutions are found, a sequence is returned. 

> solve( x^2=1, x );
 

1, -1 

> solve( x^4=1, x );
 

-1, 1, I, -I 

Notice that you can get complex numbers (I is the square root of -1) as results. We are not interested in those solutions for this course. 

You don't always get every possible solution. The following equation has infinitely many solutions, of course. 

> solve( sin(theta)=1/2, theta );
 

1/6*Pi 

In some cases, solve doesn't give you the kind of information you might really want. When this happens, you may be able to get numerical answers using evalf. 

> solve( sin(x^2)=tan(x)+1, x );
 

RootOf(tan(_Z)-sin(_Z^2)+1) 

> evalf(%);
 

-.5858173541 

Or, you can try fsolve to get purely numerical (and approximate) answers. 

> fsolve( sin(x^2)=tan(x)+1, x );
 

-.5858173541 

You can give fsolve a starting approximation. This can affect the answer and reveal solutions missed by solve. 

> fsolve( sin(x^2)=tan(x)+1, x=2 );
 

2.057865867 

You can also try to solve a set of equations with a set of unknown variables.  

> eqns:= { u^2+2*u*v=2, u-v+v^2=1 };
 

{u^2+2*u*v = 2, u-v+v^2 = 1} 

> solve( eqns, {u,v} );
 

{v = RootOf(_Z^2-4*_Z^3+4*_Z+_Z^4-1, label = _L24), u = RootOf(_Z^2-4*_Z^3+4*_Z+_Z^4-1, label = _L24)-RootOf(_Z^2-4*_Z^3+4*_Z+_Z^4-1, label = _L24)^2+1}
{v = RootOf(_Z^2-4*_Z^3+4*_Z+_Z^4-1, label = _L24), u = RootOf(_Z^2-4*_Z^3+4*_Z+_Z^4-1, label = _L24)-RootOf(_Z^2-4*_Z^3+4*_Z+_Z^4-1, label = _L24)^2+1}
{v = RootOf(_Z^2-4*_Z^3+4*_Z+_Z^4-1, label = _L24), u = RootOf(_Z^2-4*_Z^3+4*_Z+_Z^4-1, label = _L24)-RootOf(_Z^2-4*_Z^3+4*_Z+_Z^4-1, label = _L24)^2+1}
 

Here we show that allvalues is another way to locate multiple solutions. This may be useful when you get RootOf in your results. 

> evalf(%);
 

{u = 1.186986879, v = .2489758561} 

> evalf(allvalues([%%]));
 

[{u = 1.186986879-0.8154495437e-10*I, v = .2489758558-0.1624245242e-9*I}], [{v = 1.291366890+0.2768809307e-9*I, u = .623738445-0.4382288021e-9*I}], [{v = 3.379878124-0.1311034851e-9*I, u = -7.04369800...
[{u = 1.186986879-0.8154495437e-10*I, v = .2489758558-0.1624245242e-9*I}], [{v = 1.291366890+0.2768809307e-9*I, u = .623738445-0.4382288021e-9*I}], [{v = 3.379878124-0.1311034851e-9*I, u = -7.04369800...
[{u = 1.186986879-0.8154495437e-10*I, v = .2489758558-0.1624245242e-9*I}], [{v = 1.291366890+0.2768809307e-9*I, u = .623738445-0.4382288021e-9*I}], [{v = 3.379878124-0.1311034851e-9*I, u = -7.04369800...
[{u = 1.186986879-0.8154495437e-10*I, v = .2489758558-0.1624245242e-9*I}], [{v = 1.291366890+0.2768809307e-9*I, u = .623738445-0.4382288021e-9*I}], [{v = 3.379878124-0.1311034851e-9*I, u = -7.04369800...
[{u = 1.186986879-0.8154495437e-10*I, v = .2489758558-0.1624245242e-9*I}], [{v = 1.291366890+0.2768809307e-9*I, u = .623738445-0.4382288021e-9*I}], [{v = 3.379878124-0.1311034851e-9*I, u = -7.04369800...
[{u = 1.186986879-0.8154495437e-10*I, v = .2489758558-0.1624245242e-9*I}], [{v = 1.291366890+0.2768809307e-9*I, u = .623738445-0.4382288021e-9*I}], [{v = 3.379878124-0.1311034851e-9*I, u = -7.04369800...
[{u = 1.186986879-0.8154495437e-10*I, v = .2489758558-0.1624245242e-9*I}], [{v = 1.291366890+0.2768809307e-9*I, u = .623738445-0.4382288021e-9*I}], [{v = 3.379878124-0.1311034851e-9*I, u = -7.04369800...
 

In this answer, the results appear to be complex, but the imaginary parts are so small that they probably just represent arithmetic rounding errors in floating-point calculations. 

Solving equations is done not for fun but for some purpose. You need to keep the application in mind in order to find meaningful and reasonable solutions to such problems.