Title: Engineering Applications
1Engineering Applications
- Dr. Darrin Leleux
- Lecture 5 Numbers and Vectors
- Chapter 2
2Introduction
- 2.1 Properties of Real Numbers
- 2.2 MATLAB Computer Numbers
- 2.3 Complex Numbers
- 2.4 Vectors in Two Dimensions and Three
Dimensions
3Topics in Vector Analysis
42.1 Properties of Real Numbers
- Real numbers consist of
- Integers (, -3, -2, -1, 0, 1, 2, 3, )
- Rational Numbers (Fractions in the form p/q where
p and q are integers) - Non-terminating and repeating
- Irrational Numbers cannot be represented
exactly as a ratio of two integers, ?, e,
etc.Infinite decimal expansion. - Non-terminating and non-repeating
5Axioms for Real Numbers
- Axioms or postulates are properties assumed to be
true - Theorems are properties derived from axioms
and/or other theorems. - Basic axioms define how real numbers are
combined with addition or multiplication - Associative laws
- (x y) z x (y z)
- (x ? y) ? z x ? (y ? z)
Subtraction is not associative
(x - y) - z ? x - (y - z)
5/42
6Axioms for Real Numbers
- Commutative laws
- The order of addition or multiplication doesnt
matter for real numbers - x y y x
- x ? y y ? x
- This will not hold in general for matrix algebra
- Distributive law
- x ? (y z) x ? y x ? z
- Identity Elements
- x 0 x
- 1 ? x x
- Inverse Elements
- x (-x) 0 the negative
- If x ? 0, x ? (1/x) 1 the reciprocal
7Generalization
- All of the values of real numbers are referred to
as R - Absolute Value
- The distance of an real number from the origin is
the magnitude or absolute value - x, if x ? 0
- -x, if x lt 0
The distance between real numbers x and y is
defined as x y
82.2 MATLAB Computer Numbers
- Fixed-Point Notation
- Programmer must remember location of decimal
place - Floating-Point Notation
- Decimal point floats with the magnitude of the
number - MATLAB always works with 64-bit double precision
numbers - IEEE Standard 754
- gtgt isieee
- ??? Error using gt isieee
- ISIEEE is obsolete. MATLAB only runs on IEEE
machines. - IA-32 Intel Architecture Software Developers
Manual Volume 1 Basic Architecture - Section 4.8 has a good discussion of the
implementation in the Pentium 4 processor (4.12
MB) - http//www.intel.com/design/pentium4/manuals/index
_new.htmsdm_vol1
9IEEE Double Precision Format
ANSI/IEEE Standard 754-1985
sign
fraction
EXAMPLE m-files\bisect.m
Some machines allow these but not all.
Only Used to represent numbers Smaller than
realmin but Greater than zero.
biased exponent
3ff 5 5555 5555 5555 4/3
1.3333
0 011 1111 1111
0 1 0 1 0101 0101 0101 0101
s biased exponent e 1023
2-1 2-2 2-3 2-4
fraction
10IEEE Standard 754
10/42
11Special Values
- Indeterminate results 0/0, ?/?
- Results in NaN
- gt 1.79 x 10308 results in Inf
- lt 4.94 x 10-324 results in 0
- Use of denormalized numbers allows numbers to be
smaller than the theoretical 2.23 x 10-308 - eps 2.2 x 10-16 2-52
- Distance from 1 to the next largest floating
point number
12Calculating Limits
- Use eps for calculating limits, e.g.
- x 0
- y sin(x)/x
- Results in divide by zero error
- Use eps to perform calculation
- x 0 eps
- y sin(x)/x 1
- How would you verify this?
13lHôpitals Rule
Guillaume De l'Hôpital wrote the first calculus
text in 1692.
14Variable Precision Arithmetic
- Use the vpa command in the Symbolic Math Toolbox,
e.g. - vpa(pi, 75) will yield p to 75 digits
- vpa allows the user to obtain results of
- calculations to arbitrary precision.
15MATLAB Commands for Real Numbers
- abs Absolute value
- abs(-9.2) 9.2
- ceil Round toward infinity
- ceil(9.2) 10
- fix Round toward zero
- fix(9.2) 9
- floor Round toward minus infinity
- floor(-9.2) -10
- sign Signum function
- sign(-9.2) -1
- sign(9.2) 1
- sign(0.0) 0
- round Round to nearest integer
- round(2.51) 3
How would you perform rounding without the round
command?
15/42
162.3 Complex Numbers
- Polar Form of Complex Numbers
- Roots of Complex Numbers
- MATLAB Complex Numbers
17Complex Numbers (Cartesian)
Argand diagram
x Re z y Im z
In the x-y plane x and y are real numbers and i
is the imaginary unit, where i2 -1
Complex conjugate of z is
18Complex Numbers (Polar)
Principal value of the argument
r z where r is the magnitude of z also
called the modulus or length of z The polar
angle is called the argument of z, thus
In Polar Coordinates
19Properties of Complex Numbers
- z1x1iy1 and z2x2iy2
- (sum) z1z2(x1x2)i(y1y2)
- (negative) -z2 -x2 - iy2
- (subtraction) z1-z2(x1-x2)i(y1-y2)
- (product) z1z2(x1x2-y1y2)i(x1y2y1x2)
- (division)
20Polar Form of Complex Numbers
- z x iy r (cos? i sin? )
- z1z2 r1r2 cos(?1 ?2) i sin(?1 ?2)
- In complex analysis, a complex exponential
function is defined as ez and is shown to satisfy
the relationship - ei? cos(? ) i sin(? ) Eulers formula
- thus, eip i2 and the polar form of a complex
- number can be written as z rei?
, where ? is the argument of z
3 i4 5ei?, ? 53.1
20/42
21Roots of Complex Numbers
- Let a be a nonzero complex number.
- Then if zna,
- z is called an Nth root of a.
-
- De Moivres Theorem (1667-1754)
- (cos ? i sin ? )n cos n? i sin n?
- which follows that if
- a r (cos ? i sin ? ), then
, where p is 0, 1, , n-1
22Example 2.3
23(No Transcript)
24Complex Numbers Example
- Find the roots of z41
- ze?, where ? 2? p/4 and p 0, 1, 2, 3
- thus, ?00, ?1? /2, ?2 ?, and ?3 3? /2
- Therefore,
- z0 e0 1
- z1 ei? /2 i
- z2 ei? -1
- z3 ei3? /2 -i
- Solve z4 1 0
- roots(1 0 0 0 -1)
- ans
- -1.0000
- 0.0000 1.0000i
- 0.0000 1.0000i
- 1.0000
25Complex Number MATLAB Commands
- zxyi, zxyj Complex number
- zrexp(itheta) Polar form
- abs Magnitude
- angle Angle in radians
- conj Complex conjugate
- imag Complex imaginary part y
- real Complex real part x
- compass Draws complex numbers as arrows on
- polar plot
- feather Draws complex numbers as arrows on
- linear plot
Demo compass
25/42
262.4 Vectors in Two Dimensions and Three Dimensions
- Introduction to Vectors
- Dot Product
- Row and Column Vectors
- Projections
- Cross Product
27Introduction to Vectors
Issac Newton (1643-1727)
- 2-D vectors in physics have magnitude and
direction, e.g. - pmv
- F ma
- Number in physics that are scalars include
- Power
- Energy
- Vector quantities include
- Velocity
- Acceleration
- Momentum
28Points and Vectors
R2 is used to denote the set of all 2-D
vectors. R3 is used to denote the set of all
3-D vectors. The exponent defines the
dimension of the vectors.
29Example Application of 3-D Vectors
- In Astrodynamics, a 3-D coordinate frame is used
to define a position vector for a satellite. - Another 3-D vector is defined to represent the
velocity of the satellite.
30Addition and Subtraction of Vectors
- x y x1 y1, x2 y2, (addition)
- x y x1 y1, x2 y2, (subtraction)
- x1, x2 by a scalar r is defined by
- rxrx1, rx2
30/42
31Addition and Subtraction of vectors
-y
x (-y)
Another way to do vector subtraction is to form
the negative of the vector to be subtracted and
then use vector addition on that vector
32Length of a Vector
- Length of a vector x measures the distance from
its initial point and terminal point. - Also called the magnitude.
- Follows from the Pythagorean Theorem
- Also called the norm for vectors in vector space
R4 or greater.
33Unit Vectors
- A vector x of length 1 is called a unit vector.
- Also called normalized.
-
Only direction information is preserved. No
magnitude information
34Dot Product
- Dot Product
- Orthogonal Vectors
- Standard Unit Vectors
35Example 2.5
35/42
36Example 2.6
motion times the distance traveled and hence
defines the work done.
37Row and Column Vectors
- Dot product representation
- Also called thescalar or inner product
So in MATLAB you can also use xy for the dot
product in Addition to dot(x,y)
38Projections (Fig 2.5)
Projxy
39Projections (cont.)
40Example 2.7
40/42
41Cross Product
scalar part
vector part
42Cross Product of Two vectors
- Use right-hand rule to determine
- Direction of cross product.