|
Maple Syntax and Built-in Data Capabilities
Syntax
As with any computer language, Maple has its own syntax. As a new user of Maple, you can save yourself
a lot of head-scratching if you get to know these symbols.
Enter the commands given or make up similar problems.
|
Symbol
|
Description
|
Examples
|
Sample Output
|
| ; |
End-of-line. Tells Maple to process the line and show the output. |
hello; |
hello
|
| : |
End-of-line. Tells Maple to process the line and hide the output. |
hello: |
|
| := |
Assignment. Lets you assign values to variables. |
a := 3;
a; |
a := 3
3
|
| +, - |
Addition, subtraction. |
1 + 3;
1 - 3; |
4
-2
|
| *, / |
Multiplication, division |
3*412;
1236/3;
7/3; |
1236
412
7/3
|
| ^, sqrt |
Power, square root |
2^3;
sqrt(2);
2^(1/2); |
8
|
| evalf, . |
Floating-point (decimal) evaluation |
evalf(7/3);
7.0/3; |
2.333333333
2.333333333
|
| I,Pi |
Imaginary number, Pi. |
2 + 3*I;
(2*I)^2;
evalf(Pi); |
2+3I
-4
3.141592654
|
| %, %% |
Recall the last output, recall the second-to-last output, etc. |
%;
%%%; |
3.141592654
-4
|
Some syntactical caveats:
- Maple is case sensitive. foo, Foo,
and FOO are three different things.
- Using the % operator can give confusing results.
It always returns the last output from the Kernel, which may have nothing to do with where the cursor is (or which
worksheet is active).
- If Maple doesn't recognize something, it will assume it is a variable. For example, typing i^2 will give you i2,
while you may have wanted -1.
- You can move your cursor up to a previous line, press Enter, and the line will re-execute.
- When copying and pasting using a mouse, by sure to also highlight the execution group symbol ([). If
you don't, the lines will be pasted in reverse order due to a bug.
- Spaces are optional.
- Greek letters may be entered by spelling their name.
Built-in Data Capabilities
Maple can handle arbitrary-precision floating point numbers. In other words, Maple can store as many digits
for a number as you like, up to the physical limits of your computer's memory. To control this, use the Digits
variable.
sqrt(2.0);
1.414213562
Digits := 20:
sqrt(2.0);
1.4142135623730950488
Maple sets Digits to be 10 by default. You can also temporarily get precision results
by calling evalf with a second argument.
evalf(sqrt(2), 15);
1.41421356237310
Large integers are handled automatically.
Back to the content
|