An Introduction to MathCAD

Download Report

Transcript An Introduction to MathCAD

An Introduction to
MathCAD
Finding Solutions and
Symbolic Maths
Finding Solutions
 Finding
roots of an equation
 Finding roots of a polynomial
 Solving systems of equations
MathCAD #4  dpl 1999
2
Finding roots of an
equation
 Equations
of the form f(x) = 0
 One equation in one unknown
 Define guess value for x
 Use root(f(x),x) function to find
root
 plot function to get initial guess
value(s)
MathCAD #4  dpl 1999
3
What if MathCAD can’t
find roots
 Expression
has no roots
 roots are far away from initial
guess
 local maxima or minima
between guess and root
 discontinuities between guess
and root
 complex root
 Plot function to narrow in on
solution
MathCAD #4  dpl 1999
4
Finding roots of a
polynomial
 Represent
coefficients of
polynomial at vector
 Use polyroots to find roots
 Doesn’t need initial guess
 Finds all roots simultaneously
 Finds real and complex roots
MathCAD #4  dpl 1999
5
Solving systems of
equations #1
 Solve
up to 50 simultaneous
equations in 50 unknowns
 Equations not restricted to
linear equations
 Allows equations and
inequalities
MathCAD #4  dpl 1999
6
Solving systems of
equations #2
 Assign
guess values to all
variables with :=
 Given starts solve block
 Solve block contains system of
equations
 Equations in solve block use:
–
–
–
–
–
=
<
>


<ctrl =>
<
>
<ctrl 0>
<ctrl 9>
MathCAD #4  dpl 1999
7
Solving systems of
equations #3
 Solve
block terminates with
find(a1,a2,a3,a4...)
 returns scalar for one argument
 returns vector of solutions for
more than one argument
 Only returns one solution
 Use inequalities to force other
solutions
MathCAD #4  dpl 1999
8
Symbolic algebra
 Simplify
expressions
 Derive formulae
 Solve equations symbolically
 Get exact answers to integrals
etc
 Subset of Maple symbolic
processor
MathCAD #4  dpl 1999
9
Use of symbolic
processor
 Type
equations using =
(boolean equals) <ctrl=>
 Select equation/variable to
process
 Options on symbolic menu
change depending on what is
selected
 Derivation format changes
result format
MathCAD #4  dpl 1999
10
Simplifying expressions
#1
 Use
up-arrow/space bar to
select part of expression
 Symbolic|Simplify
 Result appears as defined in
derivation format
– Horizontal
– Vertical
– With or without comments
MathCAD #4  dpl 1999
11
Simplifying expressions
#2
 Processor
will simplify
polynomials by collecting
powers
 Understands math & trig
identities
 Will simplify numeric
operations & fractions
MathCAD #4  dpl 1999
12
Expansion / Factoring of
expressions
 Select
expression
 Symbolic|Expand or
Symbolic|Factor
 Factoring will also factor
integer numbers
MathCAD #4  dpl 1999
13
Re-arranging equations
to solve for variable
 Use
= to define equation <ctrl
=>
 select variable you wish to solve
for
 Symbolic|Solve for Variable
 Need to comment after result to
remember which variable you
have solved for !!
MathCAD #4  dpl 1999
14
Use of symbolic
processor in problems
 Define
problem in terms of
known equations
 Use symbolic processor to solve
for desired result
 Copy resultant expression
 Define variables
 Paste in solution
 Evaluate for numeric solution
MathCAD #4  dpl 1999
15
Why use symbolic maths
?
 Gives
general solution
 Numeric solution only solves
for one set of conditions
 Symbolic solution shows how
solution varies with inputs
 Determine which terms are
important
MathCAD #4  dpl 1999
16
Today’s practical session
 Use
of root() & polyroots() in
conjunction with plotting to
solve simple equations
 Using a solve block to solve
simple systems of equations
 Using the symbol processor to:
– simplify expressions
– expand & factorise expressions
– solve equations
 Use
symbolic processing for a
real world problem
MathCAD #4  dpl 1999
17
Next week’s assesment
 Morning
lecture: revision
session
 Practical session 4-6
 Exam conditions
 Graded series of exercises
 Complete worksheet & email
 Marked on:
– layout & commenting
– understanding key points
– thinking for yourself
MathCAD #4  dpl 1999
18