next up previous
Next: Substituting a Value Up: COMMANDS FOR MATH Previous: Getting Help in

Time Saving Tricks

bullist

Use space between characters judiciously, not too much and not too little, to make error detection easier. The following three lines do exactly the same thing (solve two equations for x,y) but the first is preferred over the other two. In the first line, note how the command, the equations and the variables are judiciously spaced so that the different units stand out.

solve( {2*x+y=1, 3*x-2*y=7}, {x,y} );                Good
solve({2*x+y=1,3*x-2*y=7},{x,y});                    Bad
solve({2*x+y=1, 3*x-2*y = 7},{x,y}  );               Bad
To refer to the output of the previous computation use " e.g. try the following
diff( x^2 , x); 
int( ", x );
The first line differentiates with respect to x and the second line integrates the output of the first command to return . If the output of a certain calculation is to be used later, it is best to give it a name and choose a meaningful name e.g.
myder := diff( x^2 , x);  
int( myder, x );

Occasionally Maple responds to a command with "syntax error". e.g. try

diff( x^3 + 3x^2 - x, x );
Maple responds with the error message. Also note that it points to the probable source. Can you determine the error ? The error is that 3x^2 should have been entered as 3*x^2. Now instead of retyping the whole line it is quicker to correct the old line - as follows. Use the arrow keys to move to the red command line which is incorrect, correct it, then hit Return. Remember modify only the red colored lines. To use part of an old command one can use the copy and paste technique. Type
diff( (x^2)*sin(x^3) + x*exp(x), x );                  Hit Return
Now suppose we want to integrate the same function from 2 to 5. Instead of retyping it we copy this function. Do the following carefully - left click at the beginning of the red colored expression to be copied, ( starting at (x^2)) then right click at the end of the expression to be copied. This highlights the expression to be copied. With the help of the arrow keys, move the cursor to a new line, and type
int( middle click the mouse here , x = 2..5 ) ;
You should obtain
int( (x^2)*sin(x^3) + x*exp(x) , x = 2..5 ) ;            Hit Return



next up previous
Next: Substituting a Value Up: COMMANDS FOR MATH Previous: Getting Help in



Peter Monk
Tue Aug 29 14:41:29 EDT 1995