0% found this document useful (0 votes)
147 views101 pages

Lecture 19 Maple 2017

This document provides an introduction to Maple, a computer algebra system. It discusses that Maple is useful for symbolic and numerical computations. It was originally developed at the University of Waterloo. The document then outlines some of Maple's capabilities like plotting, calculus, matrices, and more. It also provides instructions on basic Maple operations and functions. Finally, it gives examples of using Maple to solve equations, networks, and model harmonic oscillators.

Uploaded by

Stephen Alao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views101 pages

Lecture 19 Maple 2017

This document provides an introduction to Maple, a computer algebra system. It discusses that Maple is useful for symbolic and numerical computations. It was originally developed at the University of Waterloo. The document then outlines some of Maple's capabilities like plotting, calculus, matrices, and more. It also provides instructions on basic Maple operations and functions. Finally, it gives examples of using Maple to solve equations, networks, and model harmonic oscillators.

Uploaded by

Stephen Alao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 101

ECOR 1010

Lecture 19
Introduction to Maple
Maple
• Maple is computer algebra software
• Great for symbolic computations
– Historically, MATLAB has been used for numerical
calculations and MAPLE for symbolic, but both
now do both
• Originally developed at the University of
Waterloo (now Maplesoft)
– www.maplesoft.com
What Can Maple Do?
• 2D Plotting
• Great for 3D plotting
• Symbolic and numerical computations
• Differential and integral calculus
• Matrix manipulation
• Statistics and data management
• Algebraic geometry
• Differential geometry
• Much more, …
User controlled update

• We can go back and change the function


and everything is updated if we click !!!
• If you only want to update a small
‘selected’ portion of the work then click !
 see the icons circled in red at the top of the next slide
You can output your Maple file to:
• Rich text format (Word)
• LaTeX
• Adobe pdf
• .txt Text file
• .zip
• html, htm
• Hitting ‹ENTER› executes the input given. In
“document” mode
• Hitting ‹CNTR›+‹=› executes an inline expression and
displays the result inline (without linebreak).
• You can hit ‹SHIFT›+‹ENTER› for a new line while
postponing the execution of the input. (Don’t forget
the semicolon in this case.)
• In a “worksheet” or “document” you can go back,
change lines and re-execute them by hitting enter.
• In a “worksheet” or “document” you can enter
normal (formated) text which is not executed. ‹F5›
switches between entering text and math.
• ‹ESC› shows a list of possible completions. The right
mouse button displays a list of sensible operations
on the object. Executing such might write something
in text and math mode.
• Everything following # is a comment and will not be
interpreted.
• % is a placeholder for the previous expression
entered. %% and %%% are placeholders for the
second and third last expression.
There are two basic ways of displaying
and entering math in Maple.
• “1-D Math” (also called “Maple Notation”) is in plain
ascii text form. Input must be terminated by either ;
(displays the result) or : (does not display the result).
• “2-D Math” is a more graphical way of entering and
displaying math notation.
– Everything so far has been 2-D Math

ASCII stands for American Standard Code for Information Interchange. ASCII code is the
numerical representation of a character such as 'a' or '@' or an action of some sort.
Basic Operations
• Maple uses the same basic operations as in
MATLAB (+, −, *, /)
• Also, factorial ! and exponents ^
In 1-D Math mode:
Some Basic Maple Functions
Special Characters

• Spell out Greek letters


to use them in Maple
– To get θ type theta
– To get π type pi
– To use the numerical
value of π type Pi
– Use evalf to find the
numerical value
Assignment Operator
• Assign equations and
values to a variable, use
the := operator
• Value on the left of := is
assigned to the value on
the right
• The = and := operators
are not the same
• You cannot perform
recursive assignments
a := a + 1;
Using the % Operator
• Allows you to use the output from the last
command % in the next command
Evaluating Expressions
• Maple does not automatically evaluate the
numerical value of results
• Use the eval and evalf commands:
– Expression goes in the argument: see below
– Or use evalf(expression,n) for evaluation
to n significant digits
What can Maple do with
Equations?
• Factor
• Expand
• Differentiate
• Integrate
• Limits
• Solve
• Plot
Factoring
• Maple can factor
• Use the factor(expression) command
– If it can’t factor it, it will just return the expression
• Use expand(expression) to expand a
factored expression
Factor & Expand Examples
Solving an Equation
• Use solve(expr,var)
• If you do not specifiy an equation, it sets the
expression to zero and solves
Solving a System of Equations
• Use the following syntax
> solve({expr1,expr2,..},{var1,var2,…})
• Can return parametric solutions for the case
where infinite solutions exist
Solve Examples
Three Equations, Three Unknowns
Solve Using Maple
Mesh Current Network
R
Analysis
R1 3

V1 i1 i2 i3 R5

R2 R4

• Kirchhoff’s voltage law: the sum of the voltage


drops around any closed loop is equal to the
sum of the voltage rises. (Recall Ohm's Law: V = i R)
R1 + R2 -R2
Loop 1: i1 (6  5)  i2 5  i3  0  50
-R2 R2 + R3 + R4 -R4
Loop 2: -i1 (5)  i2 (5  18  4)  i3  4  0
Loop 3: i1 (0)  i2 4  i3 (4  4)  0
-R4 R4 + R5
Now fill in the numbers
Now fill in the numbers
Symbolic Answer
Harmonic Oscillator
• For a mass moving in
the y direction with a
linear restoring force:

F  ky
Harmonic Oscillator
• For a mass moving in
the y direction with a
linear restoring force:
d2 y
F  ma  m 2  ky
dt
Harmonic Oscillator
• For a mass moving in
the y direction with a
linear restoring force:
2
d y
F  ma  m 2  ky
dt
• The solution is:
y (t )  A sin(t   )
k 2
 
m T
Damped Harmonic Oscillator
• Friction can often be modelled with an
additional term proportional to the velocity:

2
d y dy
F  ma  m 2  ky  c
dt dt
Driven Damped Harmonic
Oscillator
• We can drive the damped oscillator with an
external force, F(t):

2
d y dy
F  ma  m 2  ky  c  F (t )
dt dt

• This is a driven damped harmonic oscillator


and the solution is more complicated.
Bungee Jumping

You might also like