__Some Basics of Maple__

*Gregory Clark*

Equations, etc. must be terminated with an ":" or an";". The former suppresses Maple output for that line whereas the latter does not.

**Fundamentals**

Maple uses the same kind of mathematical syntax as most spreadsheets and programming languages. Each line that you type in (Maple commands) must end with either a semicolon (if you want to see Maple's interpretation of it, i.e., the output) or a colon (to suppress the output). Expressions can be given names using ":=", but a few terms are reserved (e.g., Pi).

`> `
**5+(2-3);**

`> `
**y:=3*2/4;**

Note that Maple outputs the ratio as a fraction. To see it in decimal form, use the evalf Maple function. note also the use of the "%" sign to indicate to Maple to use the result of the previous calculation. This feature can save you some typing! To access the output from two lines before, use "%%" as the input. Many standard functions are part of the Maple library, such as sine, cosine, tangent, exponential, logarithms, etc. Use Maple's extensive Help system to check on the syntax of each and/or use the pull-down View menu and go to View > Palettes > Expression to access a great shortcut toolbar (there is a similar one for symbols). Keep in mind that Maple assumes all angles are in radians, just like spreadsheets.

`> `
**evalf(%);**

`> `
**x:=sin(y);**

`> `
**evalf(%);**

You can also name equations, which can come in real handy when dealing with systems of equations:

`> `
**eqn1:=w=z+3;**

You can assign functions of whatever variables you like and then use them do do all sorts of things:

`> `
**f:=r->5*r^2;**

`> `
**f(3);**

To plot a function of one variable, use the "plot" command. To do so, you specify the function AND the range of the dependent varaible.

`> `
**plot(f(r), r=-10...10);**

To do a quick plot with labels, type the equation directly into the plot command and follow this format (also, note the difference between using axes=boxed and the default axes in the previous example):

`> `
**plot(5+4*t+7*t^2, t=-2...4, title= "x vs. t", labels=["time (s)", "dist. (m)"], axes=boxed);**

To do more than one plot on the same graph, put the list of functions to plot in square brackets, separated by commas:

`> `
**plot([4*t^2-3*t,100*sin(8*t)],t=0..8);**

`> `
**with(plots):**

To do logarithmic plots (or semilog plots) use loglogplot (or logplot or semilogplot - type ?logplot for details). You must type with(plots): first in order to use this function.

`> `
**loglogplot(2/((4+1/(6*w^2))^(1/2)),w=1..1000);**

Calculus is pretty easy to do. To take a derivative, for example, use the "diff" function" (you must specify the variable that you are differentiting with respect to). Integrals work in a similar way.

`> `
**diff(f(r),r);**

`> `
**int(f(r),r);**

**The next step**
: Defining a function of one (or two!) variable(s):

`> `
**f:=x->2*x^2-3*x+4;**

`> `
**h:=(x,y)->sin(x)*cos(y);**

Now we can evaluate (or plot) these:

`> `
**f(4);**

`> `
**f(a+b);**

`> `
**h(1,2);**

`> `
**evalf(%);**

`> `

`> `