Opening the Editor Arithmetic In Math Mode

advertisement
Opening the Editor
When you first open Maple you will be presented with a screen that has several
choices. Select New Document to get going.
A new tab will open ready for you to type in. If you type, you will notice that the
text is italic and surrounded by a dashed box. This is because the editor is in Math
Mode. If you want to simply type, you need to put it in Text Mode. To switch
between the two modes press F5. As you might guess, Math Mode is for entering
and evaluating mathematics, while Text Mode is for typing Text into your
document.
You will use Text Mode to explain your work or give explanations during the
exercises. Math Mode will be used to do the required calculations.
If you look at the top of the editor window, you will notice that you have most
of the basic word processing functions that you get with Google Docs or Word
such as Bold, Italic, Underline, and text alignment.
Alternate way to get into Text Mode: CTRL-t
Alternate way to get into Math Mode: CTRL-r (yes, r)
Exercise 1:
Switch back and forth between the two modes using F5. Type in text mode and
in math mode. Pay attention to the difference.
Arithmetic In Math Mode
On a new line in your document, switch the editor into Math Mode. You can now
use Maple as a very fancy calculator. Addition and subtraction work just as you
would expect. For instance if you type 3+5 and hit enter, you will see:
8
(2.1)
With the expression you entered on the left and the output of that expression in
the center. Let's see some others:
Subtraction:
14
Division:
(2.1.1)
When you type / in Math Mode, it will automatically turn into a fraction bar. So
it is important to enclose your numerators and denominators in parentheses!
For example, if I want to divide 3+5 by 2 + 4, I need to enter: (3+5)/(2+4). This
is what you get when you type this in:
4
3
(2.2.1)
If you don't put in the parentheses, and just type, you get 3+5/(2+4). Like so:
23
6
(2.2.2)
Note that the above gives fractions as an answer. What if you want decimals?
Converting Answers to Decimals:
There are two ways to convert values into decimals.
1. If you know that you want a decimal answer, then simply add a decimal
point to your calculation. So if I want 5/3 to produce a decimal, I would
type in: 5/3.0 or 5.0/3.
2. If you would like to convert a given answer to a decimal, highlight the blue
value and right click. A menu will appear. Select Approximate and then
pick how many digits you would like.
3. Maple has a function called evalf() that will evaluate to any degree of
presicion you request.
Note: When you use evalf() or the right click menu, Maple will produce a
result with the requested number of "digits." This includes values to the left
of the decimal point!
Here are all three of these options laid out below:
5
3
(2.3.1.1)
1.666666667
(2.3.1.2)
1.666666667
(2.3.1.3)
Using the highlight and right-click, with 5 digits of precision:
5
3
(2.3.1.4)
1.6667
(2.3.1.5)
at 5 digits
Note that the above does not give 5 decimal places for 5/3! It gives 4 decimal
places and 1 leading digit!
Let's use evalf() to find 5/3:
1.666666667
(2.3.1.6)
O.k., but what if we wanted the result to 2 decimal places? Then we note that
we already have a lead digit of 1, so if we wanted two decimal places, we must
request 3 digits:
1.67
(2.3.1.7)
Done!
Before we quit, let's find
to 5 decimal places.
2.44949
(2.3.1.8)
We know that the square root of 6 is bigger than 2 but less than 3, so there
must be a single lead digit. If we want 5 decimal places, we should ask evalf()
for 6 digits!
Multiplication:
Multiplication between numerical quantities can be done in two ways: one is with
the asterisk (shift+8) * , the other is with parentheses. When you type * in Math
Mode, Maple automatically converts it into a multiplication dot! Warning: Maple
is very sensitive with its use of parentheses. 3(6) is o.k., (3)(6) is o.k., but (3)6 is
not o.k! When multiplying with paretheses wrap both factors in parentheses and
put a space between them!
Using 3*6:
18
(2.4.1)
18
(2.4.2)
18
(2.4.3)
Two parentheses with a space:
Some of the weirdness with parentheses:
Error, missing operation
Exponents and Square Roots:
Exponents are obtained by using the carat ^ (shift+6). So 3^2 is 3 squared and
3^4 is 3 to the fourth power. Maple will automatically jump your cursor
position into the exponent after you hit ^. So anything you type after this goes
in the exponent. If you want to leave the exponent, simply hit the right arrow
until your cursor is to the right of the exponent.
3^2 will become:
9
(2.5.1)
1
4
(2.5.2)
And 4^-3+2 will become:
But if I leave the exponent after the -3 (by pressing the right arrow) before I hit
+ then I have:
129
64
(2.5.3)
[The last expression was: 4^-3(Right Arrow)+2]
To get the square root we type sqrt( ). So we have:
4
(2.5.4)
(2.5.5)
1.118033989
(2.5.6)
(2.5.7)
Note that the last answer shows us that I is how maple represents sqrt(-1) or i.
You can simply type I if you want.
The Exponential and Logarithms:
The natural log is ln() and the exponential e is given by exp(1). So to get we
write exp(2) and to get ln(4) we simply write ln(4). The editor will give
expressions like
as answers, but you cannot type e directly into the Math
Mode. (Sorry!)
e3
(2.6.1)
20.08553692
(2.6.2)
1
(2.6.3)
3
(2.6.4)
(2.6.5)
1.609437912
(2.6.6)
The number :
To get the exact number
into your calculation, just type Pi. That's it. So:
(2.7.1)
Note: Capitalization matters! The P is capital and the i is lowercase.
If you want a decimal approximation of Pi, use evalf(Pi):
3.141592654
(2.7.2)
Pi can be used in arithmetic calculations:
(2.7.3)
Tip: If you type Pi followed by the shift+6 (i.e - ^) , Maple will convert Pi into
. If you don't want an exponent, just arrow out of the exponent.
Last Thoughts on Arithmetic:
Maple follows PEMDAS.
Maple will dynamically adapt your input as you type. If you hit /, you will be
in a denominator, if you type ^, you will be in an exponent. If you don't track
where your input is, you will end up making mistakes.
Maple is a CAS (Computer Algebra System). Its goal is to give an algebraic
simplification to any calculation you give it. This means it will keep a large
number of quantities exact unless you explicitly tell it to give you a
numerical value. evalf() and using a decimal point in your calculations are
two ways to do this.
How Do I delete Stuff?!
Usually a backspace or delete key press will delete what you want, but
sometimes this doesn't work - In particular, it will not delete the blue output
from Math Mode. To force delete elements in your document, here are two
options:
1. Highlight what you want to delete, then hit delete. This works, even on the
blue output.
2. Place your cursor inside the element you want gone and hit Ctrl-Delete. This
will nuke anything that is a part of the object you selected. Use with caution,
because if what you aren't careful, you can end up deleting whole paragraphs!
Exercises 2:
1. Start a new document.
2. Enter Text Mode, center the text, bold the text, underline the text, and write:
Maple Practice Assignment.
3. Underneath this, still in the center, undo the bold and underline and write
your name (last name, first)
4. Then skip two lines, unbold the text, and left justify the text.
5. For each of the following expressions: Type the expression below in text
mode exactly as you see it (including the letter next to it). On the next line use
Math Mode to find the value of the expression.
a) 2-4+5/9
b) 3^2 + 2/(7+5)
c) 3^2 + 2/(7+5) to 10 decimal places (use evalf)
d) 3^2 + 2/(7+5) to 3 decimal places
e) e^5 - 2*sqrt(3) to 4 decimal places; note, you cannot just use e in math mode!
You must use exp()!
f) ln(5) + 7 rounded to 7 decimal places.
g) 3 Pi - 2Pi^2 rounded to 3 decimal places. (Try the shift+6 trick to get Pi to
look like in math mode.)
6. When you are done, save your work either by Ctrl-s or going to File>Save.
7. Print your document, either by hitting Ctrl-p, or going to File>Print.
Just so there's no confusion, the top of your completed exercise should look
like (your first output will be numbered (1) not (2.10.1) ):
Maple Practice Assignment
Awesome, Professor
a) 2 - 4 + 5/9
(2.10.1)
Download