Professional Documents
Culture Documents
Figure11
Usingtrigonometric,wecanwritethetangentofangleformedbygreenlineandxaxisas
f ( x + Dx ) - f ( x )
Dy
=
Dx
Dx
Eq(1.1)
Ifwetakethelimitofthistangentas Dx approacheszero,wewillfindthederivativeofthefunctionatpoint
x asfollowing
f ( x + Dx) - f ( x)
dy
=
dx
Dx
Limit Dx 0
Eq(1.2)
Usingthisdefinition,wecanfindderivativesofanyfunction.
1.1 CommonFunctions
ConstantFunction
y = C (constant)
f ( x + Dx) - f ( x)
dy
=
=0
Dx
dx
Limit Dx0
Eq(1.3)
LinearFunction
y = ax + b
f ( x + Dx) - f ( x)
a ( x + Dx) + b - (ax + b)
dy
=
=
=a
Dx
Dx
dx
Limit Dx0
Limit Dx0
Eq(1.4)
Shahrouz Aliabadi
EN252 Lecture Notes
QuadraticFunction
f ( x + Dx) - f ( x)
( x + Dx) - x 2
dy
y = ax + b
=
=
dx
Dx
Dx
Limit Dx0
Limit Dx0
2
dy
x + 2 xDx + Dx - x
==
dx
Dx
2
2 xDx + (Dx)
=
Limit Dx0
Dx
Eq(1.5)
Dx (2 x + Dx)
Dx
Limit Dx 0
= 2x
Limit Dx0
ExponentialFunction
y = a x such that
dy
= y a = e = 2.718282
dx
Eq(1.6)
Note:Thederivativeofexponentialfunctionisdefinedtobeitself.Asaresult,inEq(1.6),thereisonlyone
valueof a = e = 2.718282 whichsatisfiesthisdefinition.Wewillproof e = 2.718282 later.
LogarithmicFunction
y = ln x such that x = e y
dx
dy
1
1
dx = e y dy e y
= y=
dy
dx e
x
Eq(1.7)
Note1:Logarithmicfunctionistheinverseoffunctionofexponentialfunction.
Note2: y = ln ( x a ) y = a ln x
Proof: y = a ln x
y
= ln x
a
Eq(1.8)
y
e a = x e y = x a y = ln ( x a )
Note3: y = ln ( AB) y = ln A + ln B
Eq(1.9)
1
ln x
ln a
Eq(1.10)
Proof: y = log a x x = a y ln x = ln a y ln x = y ln a y =
1
ln x
ln a
Eq(1.11)
Proof:
PowerFunction
y = xa
ln y = ln x a =a ln x
d (ln y ) dy
dy
dx
=a
dy ay ax
1
1 dy a
=
=
=
= ax a-1
x
y dx x
dx
x
x
Eq(1.12)
Shahrouz Aliabadi
EN252 Lecture Notes
Sin,Cos,andTanFunction
y = sin x
f ( x + Dx) - f ( x)
sin ( x + Dx) - sin x
dy dy
=
=
=
Dx
Dx
dx dx
Limit Dx0
Limit Dx 0
sin x cos Dx + sin Dx cos x - sin x
=
= cos x
Dx
Limit Dx0
Eq(1.13)
Note1: sin (-x) = - sin x, cos (-x) = cos x, tan (-x) = - tan x
Eq(1.14)
Note2:RefertoFigure12,wecanobservethat
Eq(1.15)
Figure12
Note3:Similarly,weshowthat
Eq(1.16)
Wecanshowthat
dy
= - sin x
dx
dy
2
y = tan x
= 1- tan x
dx
y = cos x
Eq(1.17)
Shahrouz Aliabadi
EN252 Lecture Notes
Usingdefinitionofderivative,wecanshowthat
y = f ( x ) + g ( x)
dy
= f ( x) + g ( x)
dx
HomeWork#1:Whatarethederivativesof
y = x 4.5 - ln x
y = sin x - x 2
y = tan x + cos x
y = 2- x
y = arcsin x = sin-1 x
Eq(1.18)
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter2.TaylorExpansion
Inmathematics,aTaylorseriesisarepresentationofafunctionasaninfinitesumoftermsthatarecalculated
fromthevaluesofthefunction'sderivativesatasinglepoint.TheconceptofaTaylorserieswasformulatedby
the Scottish mathematician James Gregory and formally introduced by the English mathematician Brook
Taylorin1715.IftheTaylorseriesiscenteredatzero,thenthatseriesisalsocalledaMaclaurinseries,named
aftertheScottishmathematicianColinMaclaurin,whomadeextensiveuseofthisspecialcaseofTaylorseries
in the 18th century. A function can be approximated by using a finite number of terms of its Taylor series.
Taylor'stheoremgivesquantitativeestimatesontheerrorintroducedbytheuseofsuchanapproximation.
ThepolynomialformedbytakingsomeinitialtermsoftheTaylorseriesiscalledaTaylorpolynomial.
TheTaylorexpansionwasderivedinthefollowingcompactform
f(
f ( x) =
n)
( x0 )
n!
n= 0
( x - x0 )
n
Eq(2.1)
n)
f ( ) ( x0 ) = f ( x0 )
0
f(
2)
( x0 ) =
d2 f
( x0 ) = f ( x0 )
dx 2
Example1:WhatistheTaylorexpansionof y = ln x around x0 = 1 ?
1
1
2
f ( x) = ln x, f ( x) = , f ( x) = - 2 , f ( x) = 3 , ....
x
x
x
Therefore
f ( x0 = 1) = ln 1 = 0
1
(1) = 1
x
1
f ( x0 = 1) = - 2 (1) = -1
x
2
f ( x0 = 1) = 3 (1) = 2
x
....
f ( x0 = 1) =
TheTaylorexpansionof y = ln ( x ) around x0 = 1 is
0( x -1)
ln x =
0!
1( x -1)
1!
1( x -1)
2!
2( x -1)
3!
Eq(2.2)
Shahrouz Aliabadi
EN252 Lecture Notes
Therefore
f ( x = 0) = sin 0 = 0
f ( x = 0) = cos 0 = 1
f ( x = 0) = - sin 0 = 0 = 0
f ( x = 0) = - cos 0 = -1
f ( x = 0) = sin 0 = 0
f ( x = 0) = cos 0 = 1
....
x3 x5 x7 x9
sin x = x - + - + +
3! 5 ! 7 ! 9 !
HomeWork#2:WhataretheTaylorExpansionsofthefollowingfunctions?
y = sin (2 x) around x0 = p / 4
y = cos x around x0 = p
y = e x around x0 = 0
y=
1
around x0 = 0
1- x
Eq(2.3)
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter3.ApplicationsofTaylorExpansion
Inpreviouschapterweshowedthat
+
f ( x) =
n= 0
f(
n)
( x0 )
n!
( x - x0 )
n
Eq(3.1)
f ( x + Dx) =
f(
n)
( x)
n!
n =0
Dx n
Eq(3.2)
Inthisformat,weemphasisthatexpansionaroundpointxshouldbeconfinedtosmallvariationof x ,called
Dx .Ifweselect Dx smallenough,then Dx > Dx 2 > Dx 3 > .ThisimpliesthattheexpansioninEq(3.2)can
becutoffat k th termwithsmallerror.Therefore
k
f ( x + Dx)
f(
n= 0
n)
( x)
n!
k +1
Dx n + Error O (Dx)
Eq(3.3)
Example1:
Calculate sin (96O ) withoutusingthe"sin"functioninyourcalculator.
Solution:NotethattheangleisgiveninDEG.FirstwemustconvertittoRAD
96O = 90O + 6O =
p 6p
p p
+
= +
2 180 2 30
Therefore
p p
p
p
sin (96O ) = sin + .Wechoose x = and Dx =
.
2 30
2
30
Weassign f ( x ) = sin ( x ) .Therefore, f ( x ) = cos ( x ) , f ( x ) = - sin ( x ) ,and f ( x ) = - cos ( x ) .UsingTaylor
expansioninEq(3.3),wecanwrite
1
1
sin ( x + Dx ) sin ( x ) + cos ( x )Dx - sin ( x ) Dx 2 - cos ( x )( x ) Dx 3 +
2
6
or
p p
p
p p 1 p p 1
p p
sin + sin + cos - sin - cos +
2 30
2
2 30 2 2 30 6
2 30
2
Usingonlythefirstthreeterms,wecanfindapproximatesolutionas
p p
p
p p 1 p p
sin + sin + cos - sin
2 30
2
2 30 2 2 30
2
p p
p
3.14159
sin + 1 + 0 - 0.5 1- 0.5
0.99452
30
2 30
30
2
Shahrouz Aliabadi
EN252 Lecture Notes
Andusingyourcalculator,youcanseethatexactvalueof sin (96O ) = 0.99452 .
Example2:
Calculate
1
usingTaylorExpansion.
48
Solution:Notethat
1
1
1 1
1
=
=
= 0.02
48 50 - 2 50 1- 2
1- 0.04
50
ThereforeIchoosethefunction y =
1
with x = 1 and Dx = -0.04 .
x
1
1
2
y = , y = - 2 , y = 3 ,
x
x
x
Letevaluatethefunction.
Dx 2
+
2
0.042
+
y (1 + (-0.04)) = y (1) + y (1) 0.04 + y ( x)
2
y ( x + Dx) = y ( x) + y ( x) Dx + y ( x)
(-0.04)
1
= 1- (-0.04) + 2
+
1- 0.04
2
1
1 + 0.04 + 0.0016 = 1.0416
1- 0.04
2
Alsowehad
1
1
= 0.02
0.021.0416 = 0.020832
48
1- 0.04
Alternatively,Icouldchoose y =
1
andexpansionthefunctionaroundzero.Iwillobtainthesameresult.
1- x
HomeWork#3:UseTaylorExpansionstofindapproximatevaluesof
a ) e-.01 ,
b) e1.1 ,
c) ln 1.1 ,
d ) cos 47 ,
e)
22
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter4.TaylorExpansionandFinance
Thereisanimportantfunctionutilizedinfinance.Thisfunctionis
y=
1- x
Eq(4.1)
TheTaylorexpansionofthisfunctionaroundzerois
+
y = 1 + x + x 2 + x3 + x 4 + = x k
Eq(4.2)
k =0
Notethatthefirstntermofthefunctionis
n
Eq(4.3)
k =0
Or
n
k =0
k =0
y = x k + x n+1 (1 + x + x 2 + x3 + x 4 + ) = x k + yx n+1
Eq(4.4)
Therefore
n
x k = y (1- x n+1 ) =
k =0
1- x n+1
1- x
Eq(4.5)
k =1
k =0
x k = x k -1 =
xk =
k =1
1- x n+1
1- x n+1 -1 + x
-1 =
1- x
1- x
x (1- x n )
Eq(4.6)
1- x
Forthefirstyear: Q( ) = P (1 + r ) (nisduetoinvestmentattheendofeachyear)
Plusforthesecondyear: Q( ) = P (1 + r )
Plusforthethirdyear: Q( ) = P (1 + r )
n-1
n- 2
n-( n-1)
Plusforthenthyear: Q( ) = P (1 + r )
= P (1 + r )
Thereforeyourtotalcapitalinvestmentattheendofnyearswillbe
Shahrouz Aliabadi
EN252 Lecture Notes
n
QTOTAL = P (1 + r ) + P (1 + r ) + P (1 + r ) + + P (1 + r ) = P (1 + r )
1
Eq(4.7)
k =1
UsingEq(46)andinserting x = 1 + r willyield
(1 + r ) 1- (1 + r )
QTOTAL = P (1 + r ) = P
1- (1 + r )
k =1
(1 + r ) (1 + r ) -1
=P
r
Eq(4.8)
Yourtotalreturncanbecalculatedas:
T=
QTOTAL
100
nP
Eq(4.9)
Example1:Invest$1000atbeginningofeachyearfor30yearswithinterestrateof6%(or0.06):
(1 + 0.06) (1 + 0.06) -1
30
QTOTAL = $1000
0.06
= $83802.7
Andyourtotalreturnandnormalizedannualreturnsareis
T=
83802.7
100 = 279%
301000
Forthefirstyearbalancewillbe: Q( ) = Q (1 + r ) - P .
Forthesecondyearbalancewillbe: Q( ) = Q( ) (1 + r ) - P = Q (1 + r ) - P (1 + r ) - P .
.
th
Forthen yearbalancewillbezero: Q
(n)
n-1
= Q (1 + r ) - P (1 + r ) = 0
n
k =0
UsingEq(45),wecanwrite
1- (1 + r )
n-1
P (1 + r ) = P
k
k =0
1- (1 + r )
(1 + r ) -1
n
=P
Eq(4.10)
Thereforewehave
(1 + r ) -1
Q (1 + r ) - P
rQ (1 + r )
=0 P=
Thepercentageofyourtotalpaymentis:
(1 + r ) -1
n
=Q
r
-n
1- (1 + r )
Eq(4.11)
Shahrouz Aliabadi
EN252 Lecture Notes
T=
nP
nr
=
Q 1- (1 + r )-n
Eq(4.12)
Example2:Youobtaina30yearloaninamountof$250,000withannualinterestrateof6%.Whatisyour
monthlypayment?
Inthiscase,theinterestratepermonthis r =
0.06
= 0.005 andtotalpaymentsare n = 3012 = 360 .
12
Therefore:
P=Q
and
T=
r
-n
1- (1 + r )
= $250000
0.005
-360
1- (1.005)
= $1498.87
nP 3601498.87
=
= 215%
Q
250000
HomeWork#4
a) Supposeyouwillinvest$100permonthatthebeginningofthemonthfor40yearswithinterestrate
of6.25%peryear.Findthetotalamountofcapitalattheendofyourinvestment.Whatpercentageis
yourtotalreturn?
b) Supposeyouborrow$25000tobuyanewcarwithyearlyinterestrateof5%.Youarerequiredtopay
theloanin60months.Howmuchisyourmonthlypayment?
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter5.ChainRuleforDifferentiation
Anyfunction y = y ( x ) canbewrittenasseriesofotherfunctions.Thefunction y = y ( x ) canbewrittenas
y = y ( s) y = y ( p) , p = p ( s)
Eq(5.1)
Bychainrule,thederivativeoffunctioniscanbedefinedas
dy dy dp
=
dx dp ds
Eq(5.2)
y ( p + Dp) - y ( p)
dy y ( p ( x + Dx)) - y ( p ( x))
=
=
dx
Dx
Dx
Limit Dx0
Limit Dx 0
2
dy
dy
1d y
1 d2y
2
2
y ( p) + Dp +
p
y
p
p
p
D
+
D
+
D
+
(
)
dp
dp
2 dp 2
2 dp 2
=
=
Dx
Dx
Limit Dx0
Limit Dx 0
Eq(5.3)
Proof:
Wealsohave
dp
1 d2 p
Dx +
Dx 2 +
dx
2 dx 2
dp
1 d2 p
2
Dp = p ( x + Dx) - p ( x) = Dx +
Dx +
dx
2 dx 2
p ( x + Dx) = p ( x) +
Eq(5.4)
CombineEq(5.3)andEq(5.4)toobtain
2
1 d 2 y dp
dy dp
1 d2 p
2
Dx + 1 d p Dx 2 + +
x
D
+
+
Dx +
2
2
2
2 dx
2 dx
dy dp dx
2 dp dx
=
Dx
dx
Limit Dx0
dy dp
=
dp dx
2
Eq(5.5)
Inaddition,forproductoftwofunctions,wecanwritethederivativeasfollowing:
y = N ( x ) M ( x)
dy
dM
dN
=N
+M
dx
dx
dx
TheproofofEq(5.6)canbeachievedbyexpandingbothfunctionsusingTaylorexpansion.
Proof:
y ( x + Dx) - y ( x)
N ( x + Dx) M ( x + Dx) - N ( x) M ( x)
dy
=
=
Dx
Dx
dx limit Dx0
limit Dx 0
Eq(5.6)
Shahrouz Aliabadi
EN252 Lecture Notes
2
2
N ( x) + dN Dx + 1 d N2 Dx 2 + M ( x) + dM Dx + 1 d M
Dx 2 + - N ( x) M ( x)
2
dx
2 dx
dx
2 dx
dy
=
Dx
dx limit Dx0
dy
dM
dN
=N
+M
dx
dx
dx
Proofinalternativeway:
y = N ( x) M ( x) ln y = ln N + ln M
1 dy
1
=
y dx N
dy
=M
dx
dN
1 dM
dy
y dN
y dM
+
=
+
dx M dx
dx N dx M dx
dN
dM
+N
dx
dx
Wealsohave
M ( x) =
1
N ( x)
M ( x) N ( x) = 1
Eq(5.7)
1
dM ( x) N ( x) + M ( x) dN ( x) = 0 dM = - 2 dN
N
if
y=
M ( x)
N ( x)
= M ( x) P ( x) dy = MdP + PdM
Eq(5.8)
Since
P ( x) =
1
1
dP = - 2 dN
N ( x)
N
Eq(5.9)
CombiningEq(5.8)andEq(5.9)resultsin
y=
M ( x)
N ( x)
dy =
N
N
N2
Eq(5.10)
Example1:
dy
Given: y = ln sin 2 ( x 2 ) ,whatis = ?
dx
dy 1
dp
dm
ds
= , p = m2
= 2m, m = sin ( s)
= cos ( s) , s = x 2 = 2 x
dp p
dm
ds
dx
1
4x
dy dy dp dm ds 1
2
2
sin
cos
2
2
=
= 2m cos ( s) 2 x =
x
x
x
=
( ) ( )
dx dp dm ds dx p
sin 2 ( x 2 )
tan ( x 2 )
y = ln [ p ]
Example2:
Shahrouz Aliabadi
EN252 Lecture Notes
Given: y = e2 x sin 2 ( x ) ,whatis
dy
=?
dx
y = MN dy = MdN + NdM
M = e2 x dM = 2e2 x dx
2x
2
2x
dy = e 2 SdS + S 2e dx
2
N = S dN = 2 SdS
or
Finally,wehave:
dy
= 2e 2 x sin x cos x + sin 2 x
dx
HomeWork#5
Findtheexactderivationsoffollowingfunctions.
a) f ( x) = ln ( 2 x) sin (3x) ,
d) f ( x) = sin-1 x, e) f ( x) = sin-1 2 x
Notethat sin-1 x is arc sin x .
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter6.NewtonRaphsonIterativeMethod
Thederivativeisveryusefulinformationtopredictthebehaviorofthefunctioninthevicinityofaparticular
point.Thisconceptcanbeusedtolinearizeanynonlinearfunction.Considerthenonlinearfunction f ( x ) = 0 .
Sincethefunctionisnonlinear,ingeneral,itcanhavemanyrealandimaginaryroots.Usingthefirsttwoterms
TaylorExpansionwecanwrite
f ( x + Dx) = f ( x) + Dx
2
df
+ Error O (Dx)
dx
Eq(6.1)
f ( x + Dx) f ( x) + Dx
df
dx
Eq(6.2)
or
NotetheequalsigninEq(6.1)isreplacedbyapproximatesigninEq(6.2)byneglectingtheerror.Wewantto
use Eq (6.2) to obtain the solutions of nonlinear equation f ( x ) = 0 . Assume that the unknown x can be
writtenas x = x0 + Dx where x0 istheknownpartand Dx isunknown.RewritingEq(6.2)intermsof x0 and
Dx resultsin
df
df
f ( x0 + Dx) f ( x0 ) + Dx ( x0 ) 0 Dx = - f ( x0 )
dx
dx
-1
( x0 )
Eq(6.3)
Herearethestepsyouneedtotaketosolvetheanonlinearequation.
Given f ( x ) = 0
Step1:Takederivativeof f ( x ) toobtain
df
dx
Step2:Guess x0 (anyguessisvalidprovided
Step3:Calculate f ( x0 ) and
Step4:Calculate Dx =
df
( x0 ) isnotzero,why?)
dx
df
( x0 )
dx
- f ( x0 )
df
x
( )
dx 0
Step5:Calculate x = x0 + Dx
Step7:Set x0 = x andrepeatfromStep3
TheabovealgorithmisreferredtoasNewtonRaphsonIterationMethod.
Example1:
Whatisthesolutionof x ln x - sin x = 0 witherroroflessthan0.01?
Solution:
Shahrouz Aliabadi
EN252 Lecture Notes
f ( x) = x ln x - cos x f ( x) = 1 + ln x + sin x
Set x0 = 1.0
x0 = 1
f (1) = -0.54
f (1) = 1.84
-0.54
= 0.2934
1.84
x = x0 + Dx = 1.2934
Dx = -
Set x0 = 1.2934
f (1.2934) = 0.206
f (1.2934) = 2.33
0.206
= -0.0884
2.33
x = x0 + Dx = 1.2934 - 0.0884 = 1.205
Dx = -
Set x0 = 1.205
f (1.205) = -0.0335
f (1.205) = 2.203
-0.0335
= 0.01521
2.203
x = x0 + Dx = 1.205 + 0.01521 = 1.22021
Dx = -
Set x0 = 1.22021
f (1.22021) = 0.007
f (1.22021) < 0.01
STOP
Thereforethesolutionis x = 1.205 .
Assumetheexactsolutionofnonlinearequation f ( x) = 0 is x = r .Usingtheabsoluteerrorwehavethe
followingrelationbetweentheexactvalueoftheroot r ,the n th iterate xn andtheerrorafter n iterations
en .
r = xn + en
or xn = r - en
Similarlyafter n + 1 iterationswehave
Shahrouz Aliabadi
EN252 Lecture Notes
r = xn+1 + en+1
or xn+1 = r - en+1
InNewtonRaphsoniterationalgorithm,wehave
xn+1 - xn= = Dxn = -
f ( xn )
= r - en+1 - r + en = en - en+1
f ( xn )
Thismaybearrangedtogive
en+1 = en +
f ( xn )
f ( xn )
1
f (r - en ) = f (r ) - en f (r ) + en2 f (r ) +
2
1
f (r - en ) = f (r ) - en f (r ) + en2 f (r ) +
2
Therefore
1
f (r ) - en f (r ) + en2 f (r ) +
2
en+1 = en +
1 2
f (r ) - en f (r ) + en f (r ) +
2
Notethat f (r ) = 0 since r istheexactrootof f ( x) .Wecansimplifytheequationas
1
-en f (r ) + en2 f (r ) +
2
en+1 = en +
1 2
f (r ) - en f (r ) + en f (r ) +
2
Or
Shahrouz Aliabadi
EN252 Lecture Notes
1
1
en f (r ) - en f (r ) + en2 f (r ) + - en f (r ) + en2 f (r ) +
2
2
en+1 =
1
f (r ) - en f (r ) + en2 f (r ) +
2
1
- en2 f (r ) + O (en3 )
2
=
f (r )
f (r )
1
f (r ) 1- en
f (r ) + en2
+
f (r )
f (r )
2
f (r )
1
1
2
e
f
r
O
e
1
= - en2 f (r ) + O (en3 )
+
+
(
)
(
)
n
n
2
f (r )
f (r )
= -en2
f (r )
+ O (en3 )
2 f (r )
HomeWork#6
Solve the nonlinear equation xe x - 0.82436 = 0 using NewtonRaphson Iteration Method". Obtain the
approximatesolutionafter5nonlineariterations.Setinitialguessas x0 = 2 .
Shahrouz Aliabadi
Chapter7.PartialDerivativeand Operator
Figure71
Thepartialderivativesoffunction s ( x1 , x2 ) isdefinedas
s
x1
s ( x1 + Dx1 , x2 ) - s ( x1 , x2 )
Dx1
x2 = constant
s
x2
Limit Dx1 0
s ( x1 , x2 + Dx2 ) - s ( x1 , x2 )
x1 = constant
Dx2
Eq(7.1)
Limit Dx2 0
Inaddition,the operatorisdefinedas
e1 +
e2 (vectoroperator)
x1
x2
Eq(7.2)
where e1 and e2 are two unit vectors in Cartesian coordinate system x1 and x2 . Consider s ( x1 , x2 ) as a
representation of a physical property such as temperature or pressure in 2D. The gradient of s ( x1 , x2 ) is
definedas
s =
s
s
e1 +
e2
x1
x2
Eq(7.3)
Shahrouz Aliabadi
EN252 Lecture Notes
Fromsimplegeometryrepresentation,asshowninFigure71,wecanwrite
s
s -s
2 1
x1
Dx1
s
s2 - s1
x2
D x2
Dx 2
= tan q
Dx1
s
x1 Dx2
s
Dx1
x2
Eq(7.4)
Figure72
Alongtheisocontourcurve,wecanwrite
Ds s 0
0
Ds s
0
s
s
Dx1 +
Dx2 s .D r 0
x1
x2
Eq(7.5)
Notethat:
D r Ds s et
Eq(7.6)
CombiningEq(7.5)andEq(7.6),wecanwrite
Ds s s Ds s et = 0
0
s et = 0
Eq(7.7)
Therefore, the gradient of s is orthogonal to tangent vector. You noticed that by using the definition of
gradient,thechangeof s ( x1 , x2 ) inanyarbitrarydirection dx = dr canbewrittenas(seeFigure73)
Shahrouz Aliabadi
EN252 Lecture Notes
ds =
s
s
dx1 +
dx2 = s dx = s dr
x1
x2
Eq(7.8)
Figure73
where ds isthetotalchangeof s .In3D,thegradientof s ( x1 , x2 , x3 ) isdefinedas
s =
s
s
s
e1 +
e2 +
e3
x1
x2
x3
Eq(7.9)
ds =
s
s
s
s
s
dt + s dx =
dt +
dx1 +
dx2 +
dx3
x1
x1
x1
x2
x3
Eq(7.10)
Totaltimederivative(notpartialderivative)of s (t , x1 , x2 , x3 ) canbeobtainedbydividingEq(7.10)by dt .
Eq(7.11)
Herevector
u=
Eq(7.12)
isthevelocity.
In physical terms, the divergence of a three dimensional vector field is the extent to which the vector field
flowbehaveslikeasourceorasinkatagivenpoint.Itisalocalmeasureofits"outgoingness"theextentto
whichthereismoreexitinganinfinitesimalregionofspacethanenteringit.Ifthedivergenceisnonzeroat
somepointthentheremustbeasourceorsinkatthatposition.(Notethatweareimaginingthevectorfield
tobelikethevelocityvectorfieldofafluid(inmotion)whenweusethetermsflow,sinkandsoon.)More
rigorously,thedivergenceisdefinedasderivativeofthenetflowofthevectorfieldacrossthesurfaceofa
smallregionrelativetothevolumeofthatregion.Formally,
A =
A1 A2 A3
(resultisascalarfunction)
+
+
x1 x2 x3
Eq(7.13)
Shahrouz Aliabadi
EN252 Lecture Notes
Here A1 , A2 , A3 are components of vector A . We learned the divergence of a vector filed provide
information about outgoingness of the vector (source or sink at a point). The curl operator provides
rotationallyinformationofvectorfiled.
e1
A =
x1
e2
x2
A1
A2
e3
A A
A A
A A
= 3 - 2 e1 - 3 - 1 e2 + 2 - 1 e3
x1 x3
x3 x2 x3
x1 x2
A3
Eq(7.14)
Example1:
Given velocity filed u = x 2i + y 2 j - tk and scalar function T = tx 2 + xyz - z with i , j , k unit vectors in
Cartesiancoordinatesystemof ( x, y , z ) .Find u , u , uT .Inthiscoordinatesystem,wehave
i+
j + k
x
y
z
2
u = i +
j + k x i + y 2 j - tk = 2 x + 2 y - 0 = 2 ( x + y)
x
y
z
u =
x
x2
T =
y
y2
k
2
2
2
2
-t
( ) ( y ) (-t ) ( x ) ( y ) ( x )
i -
j +
=
k = 0
x
z y
z x
z
-t
T T T
i+
j+
k = (2tx + yz ) i + xzj + ( xy -1) k
x
y
z
HomeWork#7
Given
temperature
and
velocity
filed
as
following,
T (t , x, y , z ) = e-2t ( x 2 + y 2 + z 2 ) ,
dT
atpoint p ( x = 1, y = 2, z = 3) andtime, t = 2 .
u (t , x, y , z ) = 2txi + xyj + xyzk ,find T , u , uT ,
dt
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter8.NumericalMethodsDifferentiation
Using Taylor Expansion, we can drive four interpolation schemes for the first and second derivatives (as
shownintheclass).Forthefirstderivativewehavethreeschemesasfollowing:
f ( x)
f ( x ) - f ( x -Dx )
+ Error (Dx )
Dx
(Backward Scheme)
Eq(8.1)
f ( x)
f ( x + Dx ) - f ( x )
+ Error (Dx )
Dx
(Forward Scheme)
Eq(8.2)
f ( x)
f ( x + Dx ) - f ( x -Dx )
2 (D x )
+ Error (Dx )
(Center Scheme)
Eq(8.3)
Forthesecondderivative,wedrovethecentralschemeas:
f ( x )
f ( x + Dx ) - 2 f ( x ) + f ( x -Dx )
(D x )
+ Error (Dx )
(Center Scheme)
Eq(8.4)
Example1:
Given y = xe x , find exact and approximate first and second derivatives at x = 1 . Use Dx = 0.01 to obtain
approximatederivatives.
ExactSolution:
y = xe x
dy
d2y
= e x ( x +1) 2 = e x ( x +1) + e x = e x ( x + 2)
dx
dx
dy
(1) = e1 (1 +1) = 5.4366
dx
d2y
1 = e1 (1 + 2) = 8.15485
2 ( )
dx
ApproximateSolution:
UsingEq.(8.1):
f (1)
1 e1 - 0.99e0.99
5.396
0.01
UsingEq.(8.2):
f (1)
f (1.01) - f (1)
0.01
1.01 e1.01 -1 e1
5.4775
0.01
UsingEq.(8.3):
f (1)
UsingEq.(8.4):
f (1.01) - f (0.99)
2 0.01
Shahrouz Aliabadi
EN252 Lecture Notes
f (1)
HomeWork#8
YourHWistofindthefirstandsecondderivationsoffollowingfunctions.First,youneedtofindtheexactfirst
andsecondderivativesaround x = 2 .Thenfindapproximatefirstandsecondderivativesaround x = 2 using
Eqs.(8.14).Overall,youwillhave4answersforthefirstderivativewhichincludestheexactandapproximate
derivativesusingEqs.(8.13).Forthesecondderivative,youwillhavetwoanswers,theexactderivativeand
theapproximatederivativeusingEq.(8.4).Choose Dx = 0.01 tofindapproximatederivatives.
a)
f ( x) = x ln x
b) f ( x) = sin (3x)
c) f ( x) = e 2 x sin ( 2 x)
x
d) f ( x) = sin-1
10
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter9.NumericalMethodsIntegration
AsshowninFigure91,giventhefunction f ( x) andthreepoints x = a , x = b ,and m =
b
weseektofindtheapproximatevalueof f ( x ) dx .Letsdefinetheparameter h =
a
a+b
(midpoint),
2
b-a
andexpandthe
2
f ( x) aroundmidpoint m usingtheTaylorexpansionasfollowing
X2
X3
X4
+ f (m)
+ f (m)
+
2
6
24
Eq(9.1)
Figure9.1:Integrationoffunction.
Notethat dX = dx .Therefore,theintegralof f ( x) betweenthetwopoints a and b canbewrittenas:
b
X2
X3
X4
f ( x )dx = f (m) + f (m) X + f (m)
+ f (m)
+ f (m)
+ dX
2
6
24
-h
Eq(9.2)
X2
X3
X4
X5
f ( x )dx = f (m) X + f (m)
+ f (m)
+ f (m)
+ f (m)
+
2
6
24
120
-h
3
5
h
h
f (m) +
f (m) +
= 2hf (m) +
3
60
Eq(9.3)
or
b
CASEI:Errororder (h3 )
b
ThisschemeiscalledMidpointRule.
Eq(9.4)
Shahrouz Aliabadi
EN252 Lecture Notes
CASEII:Errororder (h5 )
FromTaylorExpansionweknow:
f (m) =
+ error O (h 2 )
Eq(9.5)
Forfunction f ( x ) ,wecancombineEq(9.3)andEq(9.5)andwrite:
b
h3
3
f ( a) - 2 f (m) + f (b)
h5
2
+
error
O
h
(
)
+ 60 f (m) +
h2
h
f (a) + 4 f (m) + f (b) + error O (h5 )
a + b
(b - a)
=
+ f (b) + error O (h5 )
f (a) + 4 f
2
6
=
Eq(9.6)
Thisschemeiscalled"Simpson'sRule".
CASEIII:Errororder (h3 )
Ifweexpandthefunction f ( x ) aroundpoint a ,weobtain:
f ( x ) = f (a ) + f (a ) X + f (a )
X2
X3
+ f (a )
+
2
6
Eq(9.7)
X2
X3
f ( x )dx = f (a ) + f (a ) X + f (a )
+ f (a )
+ dX
2
6
a
0
b
2h
Eq(9.8)
or
f ( x)dx = 2hf (a ) +
(2h )
(2h)
f (a ) +
3
f (a ) +
(b - a )
= (b - a ) f ( a ) +
(b - a )
f (a ) +
Eq(9.9)
f (a ) +
FromTaylorExpansion,weknow
f ( a) =
f (b) - f (a)
b-a
+ O (2h)
Thenforanygeneralfunction f ( x ) wecanwrite:
Eq(9.10)
Shahrouz Aliabadi
EN252 Lecture Notes
b
f ( x)dx (b - a)
f (a) + f (b)
+error O (h3 )
Eq(9.11)
This scheme is called "Trapezoidal Rule". Note that the error in Case I and III are the same order, but the
valuescalculatedaredifferentifthefunctionisnonlinear.
Using this concept, we can divide the integration of any complex function into series of small areas each
approximatedwithaconstant,oralinearfunction,oraquadraticfunctionasshowninFigure92.
Figure92:Integrationoffunction f ( x ) byapproximation
Theresultofintegrationissimplythesummationofsmallareas.
b
f ( x) dx DAi
Eq(9.12)
i =1
3 3
2
3
3
(3x +1) dx = 3 x + x x=2 = 2 + 2 -(1 +1) = 8
1
Now,let'sfindtheresultsofthesameintegrationusingTrapezoidalRuleinEq(9.11).Letschoose4equally
dividedintervals(n=4).
Dx =
2 -1
= 0.25
4
Shahrouz Aliabadi
EN252 Lecture Notes
x1 = 1 + (1 - 1)Dx = 1
x2 = 1 + (2 - 1)Dx = 1.25
x3 = 1 + (3 - 1) Dx = 1.5
x4 = 1 + (4 - 1)Dx = 1.75
x5 = 1 + (5 - 1) Dx = 2.0
Also,
f ( x1 ) = 312 + 1 = 4
f ( x2 ) = 31.252 + 1 = 5.6875
f ( x3 ) = 31.52 + 1 = 7.75
f ( x4 ) = 31.752 + 1 = 10.1875
f ( x5 ) = 3 22 + 1 = 13
UsingEq(9.11),theintegrationcanbeapproximatedas:
2
(3x
1
f ( x1 ) + f ( x2 ) f ( x2 ) + f ( x3 ) f ( x3 ) + f ( x4 ) f ( x4 ) + f ( x5 )
+ 1) dx Dx
+
+
+
2
2
2
2
f ( x1 ) + f ( x5 )
Dx
+ f ( x2 ) + f ( x3 ) + f ( x4 )
2
4 + 13
0.25
+ 5.6875 + 7.75 + 10.1875
2
8.03125
Usingthisapproximation,thepercentageoferroris:
Error =
8.03125 - 8
8.03125
100 = 0.39%
Clearly,wecanimprovetheresultsbeusingngreaterthan4orusingSimpson'sRuleasdescribedinEq(6).
HomeWork#9
Givenfunction f ( x) = e3x
1)Whatistheexactintegrationof f ( x ) from x = 1 to x = 2 ?
2)UsebothTrapezoidalRuleand Simpson'sRuletofindnumericalintegrationof f ( x ) from x = 1 to x = 2
using4equallyspacedinterval( n = 4 ).Whatisthepercentageofnumericalintegrationerrorforbothcases?
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter10.CoordinateSystems
Coordinatesystemsareformedbyintersectionofsurfacesatconstantvalues.Consider u ( x1 , x2 ) and v ( x1 , x2 )
atdifferentconstantvalues, (u1 , u2 , u3 , ) and (v1 , v2 , v3 , ) .
v ( x1 , x2 ) = v1
x2
v ( x1 , x2 ) = v2
v ( x1 , x2 ) = v3
u ( x1 , x2 ) = u3
u ( x1 , x2 ) = u2
u ( x1 , x2 ) = u1
x1
Figure101:CurvelinearCoordinateSystem.
Any point with value p ( x1 , x2 ) can be expressed as p (u , v) . For example p (u3 , v2 ) is a point located
at (u3 , v2 ) .
Cartesiancoordinatesystemisconstructedwithtwo(in2D)orthreesurfaces(in3D).Thesesurfacesare
x = constant
y = constant
Eq(10.1)
z = constant
Theunitvectorsorthogonal(normal)tosurfaces x , y ,and z are i , j ,and k ,respectively.
Apositionvectoriscalled r anddefinedas:
r = xi + yj + zk
Eq(10.2)
Velocityorrateofchangeofpositionvectorisdefinedas:
v = vx i + v y j + vz k
Eq(10.3)
Wealsoknowthat
v=
d r dx dy dz
+ yj
+ zk
= i+
j + k = xi
dt
dt
dt
dt
where"."referstotimederivative.Therefore:
Eq(10.4)
Shahrouz Aliabadi
EN252 Lecture Notes
vx =
dx
dy
dz
, v y = , vz =
dt
dt
dt
Eq(10.5)
Acceleration, a = ax i + a y j + a y k ,istherateofchangeofvelocitydefinedas:
a=
d v dvx dv y dvz d 2 x d 2 y d 2 z
+ yj + zk
i+
j+
k = 2 i + 2 j + 2 k = xi
=
dt
dt
dt
dt
dt
dt
dt
Eq(10.6)
or
dv x d 2 x
= 2 = x
dt
dt
dv y d 2 y
ay =
= 2 = y
dt
dt
dv
d 2z
a z = z = 2 = z
dt
dt
ax =
Eq(10.7)
dy
= - 3e - t a y =
= 3e - t
y = 3e - t + 5 v y =
dt
dt
dz
dv z
= 2 cos (2 t ) a z =
= - 4 sin (2 t )
z = sin (2 t ) + 2 v z =
dt
dt
x = 2t + 1 vx =
r = constant
q = constant
Eq(10.8)
Theangleismeasuredcounterclockwisefromhorizontalline.Anarbitrarypoint, p ( r, q ) ,islocatedinpolar
coordinatebyradius r andangle q .TherelationshipbetweenthePolarandtheCartesiancoordinatesystems
areasfollowing:
r=
x2 + y2
y
q = arctan
x
Eq(10.9)
x = r cos q
y = r sin q
Eq(10.10)
Shahrouz Aliabadi
EN252 Lecture Notes
er = i cos q + j sin q
e = -i sin q + j cos q
Eq(10.11)
orwecanwrite:
er cos q sin q i
=
eq - sin q cos q j
Eq(10.12)
i = cos q - sin q er
j sin q cos q eq
Eq(10.13)
ThepositionvectorinPolarcoordinatesystemis:
r = rer
Eq(10.14)
andvelocityisdefinedas
de
dr
d
dr
v=
= (rer ) = er + r r
dt dt
dt
dt
Eq(10.15)
Asshownintheclass,
er
r
er
q
eq
r
=0
q =c
= eq
r =c
eq
q
=0
q =c
Eq(10.16)
= -er
r =c
Here q isangularvelocity.CombiningEq(10.15)andEq(10.16),wecanwrite
r + rqeq
v = re
Wecanalsowritethevelocityas
v = vr er + vq eq
Eq(10.17)
Eq(10.18)
r
vr = re
v = rq
Eq(10.19)
TherelationshipbetweenthecomponentsofvelocityinPolarandCartesiancoordinatesystemscanbe
expressedusingEq(10.12)andEq(10.13)
vr cos q sin q v x
=
vq - sin q cos q v y
Eq(10.20)
Shahrouz Aliabadi
EN252 Lecture Notes
v
v
x = cos q - sin q r
v y sin q cos q v
q
Eq(10.21)
Accelerationinpolarcoordinatesystemisobtainedbytakingderivativeofvelocitywithrespecttotime.The
finalresultis:
a = (r - rq 2 ) er + (rq + 2rq) eq
Eq(10.25)
Thefirsttwotermsaretheradialaccelerationterms:thelinearaccelerationandthecentripetalacceleration.
Thesecondtwotermsarethetangentialaccelerationterms:thelineartangentialaccelerationandthemore
obscure Coriolis acceleration. We also refer to q and q as angular velocity and angular acceleration,
respectively.
Example:
A2000kgcaristravelingatconstantspeedof70mphentersaturnwithradiusof150meter.Findtheangular
velocityofthecarandallforcesappliedtoit.
Solution:
m=2000kg
Speed=70mph=70x1.61x1000/3600=31.3meter/second
Note: r = 0 becauseradiusofturnisconstant.Thereforeyourspeedis vq = rq
Therefore,
2
2
Speed= v = r 2 + (rq) = 02 + (150q) = 150q
31.3
150q = 31.3 q =
= 0.208 Rad/s .
150
Therefore,angularvelocityis0.208Rad/s.Notethatangularvelocityisconstant,therefore q = 0
Accelerationis:
Thisiscentrifugalforcepushingcartowardthecenter.Thisforceiscreatedbyfrictionbetweenthetiresand
road.
HomeWork#10
10.1
v = ( 2 t ) i + (3 e - 2 t ) j
Shahrouz Aliabadi
EN252 Lecture Notes
a)DrawaCartesiancoordinatesystemandlocatepointP.
b)Whatispositionvector r inCartesiancoordinatesystematpointP?
c)WhatarethecomponentsofpositionvectorinthepolarcoordinatesystematpointP?
d)Expresstheunitvectors er and eq intermsof i and j atpointP.
e)Find v r and v q .
t
10.2 AracecarpositioninPolarcoordinateisgivenby r = 15t (meter) and q = 2 (Radian).Here t is
2.5
timeinsecond.
1 .4
a)FindthevelocityofthiscarinPolarcoordinatesystem.
b)FindtheaccelerationofthiscarinPolarcoordinatesystem.
c)WhatarethecentrifugalandCoriolisaccelerations?
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter11.LinearSystemsofEquations
Inmathematics,alinearsystemofequations(orlinearsystem)isacollectionoflinearequationsinvolvingthe
samesetofvariables.Forexample,
3x + 2 y - z = 1
2 x - 2 y + 4 z = -2
Eq(11.1)
-x + 0.5 y - z = 0
isalinearsystemwithunknowns x , y ,and z . Asolutiontoalinearsystemisanassignmentofnumbersto
the unknowns such that all the equations are simultaneously satisfied. For linear system in Eq (11.1), the
solutionisgivenby
x = 1, y = -2, z = -2
Eq(11.2)
Thesimplestkindoflinearsysteminvolvestwoequationsandtwounknowns.Forexample
2x + 3y = 6
4 x + 9 y = 15
Eq(11.3)
x = 3 -1.5 y
Eq(11.4)
4 (3 -1.5 y) + 9 y = 15
Eq(11.5)
This results in a single equation involving only the variable y . Solving Eq (11.5) results in y = 1 , and
substitutingthisbackintotheequationfor x yields x = 1.5 .Agenerallinearsystemof n equationswith n
unknownscanbewrittenas
a11 x1 + a12 x2 + a13 x3 + + a1n xn = b1
Eq(11.6)
an1 x1 + an 2 x2 + an 3 x3 + + ann xn = bn
Here x1 , x2 ,..., xn aretheunknowns, a11 , a12 ,..., ann andsidecoefficients,and b1 , b2 ,..., bn arerighthand
sideconstants.ThelinearsysteminEq(11.6)canbewritteninamatrixformasfollowing
a11
a21
a
n1
a12
a22
an 2
a1n x1 b1
a2 n x2 b2
=
ann xn bn
Eq(11.7)
or
Ax = b
Eq(11.8)
Shahrouz Aliabadi
EN252 Lecture Notes
where A isannnmatrix,and x and b aren1matrix(orvector).
11.1GaussianEliminationMethodtoSolveLinearSystemofEquations
InGaussianEliminationMethod,noequationissolvedforavariable.Wesimplyaddandsubtractmultiplesof
rowsfromeachotheruntilthelefthandsidematrix, A ,becomesanidentitymatrix.Wewilldemonstratethis
byanexample.Let'ssolvethefollowinglinearsystemofequationsbyGaussianEliminationMethod
3x + 2 y - z = 4
2 x + 3 y - z = 5
Eq(11.9)
4x + y - 2z = 0
Inmatrixform,thisequationsystemcanbewrittenas:
3 2 -1 x 4
2 3 -1 y = 5
4 1 -2 z 0
Eq(11.10)
Step1:Multiplythefirstrowby1/3.Then:
1
(R1 1 / 3) 3 2 -1 x 4
2 3 -1 y = 5 2
4 1 - 2 z 0
4
4
2
1
-
3
3 x 3
3 -1 y = 5
1 -2 z 0
Eq(11.11)
Here, R 1 referstoRow1.Now,let'sgetridof2and4inthefirstcolumnandsecondandthirdrows.
4
2
1
4
1
2
1
-
1
-
3
3 x 3
x
3
3 3
5
1 7
- y =
(R 2 - 2 R1 ) 2 3 -1 y = 5 0
3
3
3
(R 3 - 4 R1 ) 4 1 -2 z 0
0 - 5 - 2 - 16
3
3
3
Eq(11.12)
Inthenextstep,wewillmultiplythesecondrowby3/5tomakethediagonalentryinthesecondrowto
become1.
4
2
1
2
1
1
-
-
3
3 x 3
3
3 x 3
5
1 7
1 7
- y =
(R 2 3 / 5) 0
0 1 - y =
3
3 3
5 5
0 - 5 - 2 - 16
0 - 5 - 2 - 16
3
3
3
3
Now,wewilleliminatethethirdrow,secondcolumnentrybydoingthefollowingoperation.
Eq(11.13)
Shahrouz Aliabadi
EN252 Lecture Notes
4
2
1
2
1
1
1
-
-
3
3 x 3
3
3 x 3
1 7
1 7
0 1 - y =
0 1 - y =
5 5
5 5
z
5
R 3 + R 2
5
2
- 16
0 0 -1 -3
3
3
3
3
Eq(11.14)
Wecanmakethethirdrow,thirdcolumnentrytobecome1bymultiplyingthethirdrowby(1).
4
2
1
2
1
1
1
-
-
3
3 x 3
3
3 x 3
1 7
1 7
0 1 - y = 0 1 - y =
5 5
5 5
z
0 0 -1
-3
0 0 1 3
( R 3 (-1))
Eq(11.15)
Atthisstage,thelefthandsidematrixisanupperdiagonalmatrix.Wealsoknowthat z = 3 (why?).Wecan
proceedinthesamewaytoeliminatetheentriesinthethirdcolumn,inrows1and2byfollowingoperations.
R1 + 1 R 3
1
R 2 + R 3
4
2
1
7
1
2
-
1
0
3
3 x 3
3 x 3
1 7
0 1 - y = 0 1 0 y = 2
5 5
0 0 1 z 3
0 0 1
3
Eq(11.16)
Thelastoperationinvolvedeliminationoftheentryinthe1stand2ndcolumnby
7
R1 - 2 R 2 1 2 0
1 0 0 x 1
3
3 x 3
0 1 0 y = 2 0 1 0 y = 2
0 0 1 z 3
0 0 1 z 3
Eq(11.17)
Now,youcanseethatthelefthandsidematrixisturnedintoanidentitymatrix.Therefore, x = 1 , y = 2 ,and
z = 3 istheuniquesolution.
11.2GaussianEliminationMethodtoInvertSquareMatrix
Themethodoutlinedabovecanbeusedtoinvertamatrix.Todoso,weplacematrixAandidentitymatrix
sidebysideasfollowing:
Shahrouz Aliabadi
EN252 Lecture Notes
a11 a12 a1n
a21 a22 a2 n
a
a
n2
nn
n1
0 0
1 0
0 1
Eq(11.18)
Now,weperformgausseliminationtobothmatrices,suchthatthelefthandmatrixbecomesidentitymatrix.
Asaresult,wewillhave:
1
b21 b22 b2 n
b
b
nn
n1 n 2
0 0
1 0
0 1
Eq(11.19)
Here,thematrixontherightinEq(11.19)istheinversionofmatrixontheleftinEq(11.18).Wewillhave
a
11
a21
a
n1
a12
a22
an 2
a1n
a2 n
ann
b
b b1n 1
11 12
b21 b22 b2 n 0
b
0
b
b
nn
n1 n 2
0 0
1 0
0 1
Eq(11.20)
HomeWork#11
a) SolvethefollowinglinearsystemofequationsbyGaussianEliminationMethod.Theunknownsarex,y,
andz.
3x + 2 y - 2 z = 1
4x - 2 y + 4z = 2
2 x - 6 y - 5z = 3
b) FindtheinversionofthefollowingmatrixusingGaussElimination.
5 3 2
4 5 3
2 2 2
6 4 1
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter12.DeterminantandCofactor
Thedeterminantofa 2 2 matrixisgivenas:
a
a a
a
det A = det 11 12 = 11 12 = a11a22 - a12a21
a21 a22 a21 a22
=
()
Eq(12.1)
Thedeterminantofa 33 matrixcanbeevaluatedwithrespecttoanyrowasfollowing:
a11 a12
A = a21 a22
=
a
31 a32
a13
3
p+ k
a23 = (-1) a pk M pk
k =1
a33
Eq(12.2)
Eq(12.3)
Notethat p canbeanyrow(1,2,or3).Wecanalsocalculatethedeterminantwithrespecttoanycolumnas
following
a11 a12
A = a21 a22
=
a
31 a32
a13
3
p +k
a23 = (-1) a pk M pk
p=1
a33
Eq(12.4)
ThecofactormatrixMisdefineas
M 11
M
M = 21
=
M
n1
M 12 M 1n
M 22 M 2 n
M n 2 M nn
Eq(12.5)
andtheinversionofMatrix A isdefinedas
=
-1
A =
=
()
det A
Eq(12.6)
HomeWork#12
GivenmatrixA:
=
3.1 -1.8 2.5
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter13.ComplexNumbersandFunctions
Welearnedintheclassthatthecomplexnumber z isdefinedas:
z = x + iy
Eq(13.1)
Re ( z ) = x
Im ( z ) = y
Eq(13.2)
Thenormormagnitudeof z isdefinedas
z = x2 + y2
Eq(13.3)
Given constant real number a and two complex numbers z1 = x1 + iy1 and z2 = x2 + iy2 , we can write the
followings:
a z1 = a x1 + ia y1
z1 + z2 = ( x1 + x2 ) + i ( y1 + y2 )
Eq(13.4)
z = x - iy
Eq(13.5)
Wecanclearlyseethat
zz = ( x + iy )( x - iy ) = x 2 + y 2 = z
2
Eq(13.6)
Usingconjugate,wecannowdefinethedivisionoftwocomplexnumbersas:
= 1 2 = 1
=
z2 z2 z2 ( x2 + iy2 )( x2 + iy2 )
x22 + y22
Eq(13.8)
z1 + z2 = ( x1 + x2 ) + i ( y1 + y2 ) = (2 - 2) + i (-3 - 1) = -4i
z1 z2 = (-4 - 3) + i (-2 + 6) = -7 + 4i
z1 (-4 + 3) + i (2 + 6) -1 + 8i
1 8
=
=
=- + i
2
2
z2
5
5 5
(-2) + (-1)
As shown in the class, the complex number z can also be defined in polar coordinate system. In polar
coordinatesystem, z isdefinedas
z = reiq
Eq(13.9)
Shahrouz Aliabadi
EN252 Lecture Notes
y
where r = z = x 2 + y 2 and q = tan-1 .Also,wecanwrite:
x
Eq(13.10)
CombiningEq(13.1),Eq(13.9)andEq(13.10),wecanclearlyseethat
x = r cos q
y = r sin q
Eq(13.11)
i q +q2 )
z1
r1eiq1
r i q -q
r
= iq2 = 1 e ( 1 2 ) = 1 cos (q1 - q2 ) + i sin (q1 - q2 )
z2 r2 e
r2
r2
Eq(13.13)
13.1ComplexFunctions
Complexfunction w ( z ) isafunctionwhichchangeswithvariable z .
w = f ( z)
Eq(13.14)
u = u ( x, y ),
w = u + iv,
v = v ( x, y )
Eq(13.15)
You can think about function as mapping z from ( x , y ) plane into (u , v ) plane. Some typical complex
functionsaredefinedhere.
1)
w = z2
w = ( x + iy )( x + iy ) = x 2 - y 2 + i 2 xy
w = u + iv
u = x2 - y2 ,
v = 2 xy
Eq(13.16)
2)
w = ez
w = e x+iy = e x eiy
w = e x (cos y + i sin y )
w = u + iv
3)
w = e- z
Note: y is in radian!
u = e x cos y ,
v = e x sin y
Eq(13.17)
Shahrouz Aliabadi
EN252 Lecture Notes
w = e- x-iy = e- x e-iy
w = e- x cos (- y ) + i sin (- y )
w = e- x (cos y - i sin y )
u = e- x cos y ,
w = u + iv
Note: y is in radian!
Eq(13.18)
Note: y is in radian!
v = -e- x sin y
4)
w = eiz
w=e(
i x+iy )
= eix- y = e- y eix
w = e- y (cos x + i sin x )
w = u + iv
Note: x is in radian!
u = e- y cos x,
Eq(13.19)
v = e- y sin x
5)
w = e-iz
-i( x+iy )
= e-ix+ y = e y e-ix
w = e y cos (-x ) + i sin (-x )
w = e y [ cos x - i sin x ]
w=e
w = u + iv
u = e y cos x,
Note: x is in radian!
Eq(13.20)
Note: x is in radian!
v = -e y sin x
Note:
eiz - e-iz
=
sin
z
-iz
iz
-iz
e = cos z - i sin z
cos z = e + e
6)
eiz + e-iz
w = cos z =
w=
w=
e y + e- y
e y - e- y
cos x - i
sin x
2
2
w = u + iv
7)
eiz - e-iz
w = sin z =
2i
w=
u=
e y + e- y
cos x,
2
v =-
e y - e- y
sin x
2
2i
Eq(13.21)
Shahrouz Aliabadi
EN252 Lecture Notes
-e y + e- y
e y + e- y
cos x +
sin x
2i
2
w=
e y + e- y
e y - e- y
sin x + i
cos x
w=
2
2
w = u + iv
u=
e y + e- y
sin x,
2
v=
e y - e- y
cos x
2
Eq(13.22)
w = cosh z = cos iz =
8)
e z + e- z
Eq(13.23)
w = sinh z = -i sin iz =
9)
e z - e- z
Eq(13.24)
10)
w = ln z = ln ( reiq ) = ln r + ln (eiq ) = ln r + iq
w = u + iv
u = ln r,
Eq(13.25)
v=q
13.2DerivativeofComplexFunctions
Given complex function of w = f ( z ) , we define the derivative of the function as:
dw
=
dz
Du ( x, y) + iDv ( x, y)
Dw
=
Dx + iDy
Dz
Limit Dz 0
Limit (Dx ,Dy )0
Dx + iDy
Eq(13.26)
Case I: Lets consider a path in which Dy = 0 , therefore the derivative will reduce to
dw u ( x + Dx, y ) - u ( x, y ) + iv ( x + Dx, y) - iv ( x, y)
=
dz
Dx
Limit (Dx) 0
u
v
Dx + i Dx
u
v
x
x
=
=
+i
Dx
x
x
Limit (Dx) 0
Eq(13.27)
Shahrouz Aliabadi
EN252 Lecture Notes
Case II: Lets consider a path in which Dx = 0 , therefore the derivative will reduce to
dw u ( x, y + Dy) - u ( x, y) + iv ( x, y + Dy) - iv ( x, y)
=
dz
iDy
Limit (Dy ) 0
u
Dy + i v Dy
y
v
u
y
=
=
-i
iDy
y
y
Eq(13.28)
Limit (Dy) 0
The derivative is path independent if and only if Eq (13.27) and Eq(13.28) are equal. This means:
u
v
=+
x
y
u
v
=y
x
Eq(13.29)
This condition is called Cauchy-Riemann condition. A function w ( z ) is called analytic or regular if the
derivative of w ( z ) exists at any point.
A function h ( x, y ) is harmonic if it satisfies Laplace equation of () h = 0 . Now, lets take the derivatives
of Eq (13.29) with respect to x and y to obtain
2u
2 v
=+
x 2
xy 2u 2u
2 + 2 = 0
y
2u
2 v x
=2
y
xy
Eq(13.30)
Similarly, we can take the derivatives of Eq (4) with respect to y and x which yields:
2u
2v
= 2 =
xy y 2 v 2 v
2 + 2 = 0
x
y
2u
2v
= - 2
xy
x
Eq(13.31)
In this case, both u and v are harmonic and satisfy Lapace equation. Here we refer to v as conjugate harmonic
function of u .
13.3IntegralofComplexFunctions
The integral of complex functions are defined as
Shahrouz Aliabadi
EN252 Lecture Notes
z2
z2
z2
z1
z1
z1
Eq(13.32)
Eq(13.33)
F ds = (F) dA
c
Eq(13.34)
v u
Therefore:
Eq(13.35)
HomeWork#13
1)Given z1 = 2 + i and z2 = -3 - 2i ,dothefollowings:
a)Whataretherealandimaginarycomponentsof z1 and z2 ?
b)Locate z1 and z2 intheCartesiancoordinatesystem.
c)Whatare z1 + z2 , z1 z2 and
z1
intheCartesiancoordinatesystem?
z2
z1
inthePolarcoordinatesystem.UseEq(10)andconvertthefinalresultsintothe
z2
Cartesiancoordinatesystem.
f)Perform z1 z2 and
2)Given z = 2 + 2i find:
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter14.CurveFitting
LetsconsiderasetofdatagiveninFigure141.Incurvefitting,wechooseaappropriatecuretorepresentthe
dataascloseaspossible.
Figure141
Inthesimplestcurvefitting,weassumethedatacanberepresentedbyastraightlinewithequationof
y = Ax + B
Eq(14.1)
E1 = Ax1 + B - y1
E2 = Ax2 + B - y2
E3 = Ax3 + B - y3
Eq(14.2)
En = Axn + B - yn
or
x1
x2
x
3
x
n
y1 E1
1
y E
1
A 2 2
1 - y3 = E3
B
y E
1
n n
Eq(14.3)
Shahrouz Aliabadi
EN252 Lecture Notes
Inthematrixform,wecanwrite
M m2 N 21 - Pm1 = Em1
Eq(14.4)
Theerrorbetweenthedataandcurveareminimizedbasedonleastsquaremethod.Inleastsquaremethod,
weminimizethenormoferrorasfollowing:
2
d E =0
(
d (x
d (x
) ( A x- b) = 0
A - b )( A x- b) = 0
d A x- b
= T
= -
= -
A A x- x A b - b A x+ b b = 0
= -
= -
d x A A x+ x A A d x- d x A b - b A d x = 0
T
= -
( A A)
2 d x A ( A x- b) = 0
A ( A x- b) = 0
d x A A x+ d x
T
= -
Eq(14.5)
= -
x- d x A b - d x A b = 0
T
= -
= -
Note:Weusedfollowingidentitytoproveaboveequation:
y A x = x A y
T
= -
Eq(14.6)
Example:
Giventhefollowingdata:
We want to find A and B such that the error representing the data with straight line is minimized. We
proceedbyformingthematrixsystemasfollowing:
Shahrouz Aliabadi
EN252 Lecture Notes
x1
x
2
x3
x
4
y1 E1 1
1
1 A y2 E2 2
=
1 B y3 E3 4
y E 5
1
4 4
2 E1
1
1 A 3 E2
- =
1 B 3 E3
5 E
1
4
Asshownabove,theerrorisminimizedsuchthat:
1 1
2
1 2 4 5 2 1 A 1 2 4 5 3
=
1 1 1 1 4 1 B 1 1 1 1 3
5 1
5
12 + 22 + 42 + 52
1 + 2 + 4 + 5 A 1 2 + 23 + 43 + 55
=
2
2
2
2
1+ 2 + 4 + 5
2
3
3
5
B
+
+
+
1
1
1
1
+
+
+
46 12 A 45
HomeWork#14
Averagetemperature(incentigrade)inaparticularcitywasrecordedasfollowings:
Date
April10
Temperature 10
April20
April27
May5
May12
May30
11
13
16
20
26
Plotthedateongraph(temperaturedays).PredicttheaveragetemperatureinJuly15byusingthefirstand
secondorderpolynomialcurvefittings.
Shahrouz Aliabadi
EN252 Lecture Notes
Chapter15.SimplePendulumModel
ConsiderasimplependulumasshowninFigure16.1.Inthisfigure, q istheanglemeasuredfromverticalaxis
counter clockwise, R is the radius of pendulum, m is the mass of pendulum and g is gravitational
acceleration.Forconvenience,wewritetheequationsofmotioninthepolarcoordinatesystemasfollowing:
F
Eq(15.1)
= ma
Inthepolarcoordinatesystem,theaccelerationisdefinedas:
a = ( r - rq 2 ) er + ( rq + 2rq ) eq
Eq(15.2)
Therefore,
F = m (r - rq 2 ) er + (rq + 2rq) eq
Eq(15.3)
Figure15.1
Now,let'sdefinetheforcesactingonthependulum.Theweightofthependulumcanbedissolvedintotwo
forces, mg cos q and mg sin q as shown in Figure 15.1. In addition, we have tension, T , acting toward the
centeroftherotation.Also,wehavetwosourcesoffrictionwhichtrytoslowdownthemotionofpendulum.
Theseforcesareairandhingeresistances.Theairresistanceforceactsalwaysintheoppositedirectionofthe
motionanditisproportionaltothesquareofpendulumspeed.Fromadvancedaerodynamicsweknow:
1
Fair = rairCD AV 2
2
Eq(15.4)
1
Fair = - rairCD AR 2 q q
2
Eq(15.5)
wherethenegativesignandabsolutevalueensurethattheairresistanceisinoppositedirectionofmotion.
Shahrouz Aliabadi
EN252 Lecture Notes
Inaddition,thehingeresistancecanbemodeledas
Eq(15.6)
-T + mg cos q = m ( r - rq 2 ) intheradialdirection
Eq(15.7)
1
-mg sin q - rair CD AR 2 q q - mRChingeq = m (rq + 2rq) inthetangentdirection
2
Eq(15.8)
Furthermoretheinitialconditionsare:
q (t = 0) = q0
Rq (t = 0) = V0
Eq(15.9)
-T + mg cos q = -mRq 2
Eq(15.10)
1
-mg sin q - rairCD AR 2 q q - mRChingeq = mRq
2
Eq(15.11)
NotethatEq(15.10)hastwounknownsandEq(15.11)hasonlyoneunknown.Thereforeweproceedtosolve
Eq (1511) first to find q as a function of time. However Eq (15.11) is nonlinear secondorder differential
equation.First,let'ssimplifythisequationbyassuming:
1)Swingangle q issmall.Therefore,wecanreplace sin q by q (why?).
1
2)Assume rairCD AR 2 q = mRCair isaconstant(notabadassumptionifthemotionisslow).Usingthesetwo
2
assumptions,wecanrewriteEq(15.11)as:
Eq(15.12)
q + 2 sq + P 2q = 0,
s=
C
g
and P 2 =
R
2
Eq(15.13)
Notethattheaboveequationisordinarydifferentialequation.Thesolutioncanberepresentedby
q (t ) = e at
CombineEq(15.13)andEq(15.14)toobtain
a = -s + Q
a 2 + 2 sa + P 2 = 0 1
a
=
s
Q
2
Eq(15.14)
Eq(15.15)
Shahrouz Aliabadi
EN252 Lecture Notes
where Q = s 2 - P 2 isdefinedtosimplifytheexpressions.ThelinearcombinationsofthesolutionsinEq(15)
arealsothepossiblesolutionsofEq(13).Therefore:
q (t ) = A1e a1t + A2e a2t
= A1e(
- s+Q )t
+ A2e(
- s-Q )t
Eq(15.16)
- st
= e B1 cos (Gt ) + B2 sin (Gt )
Eq(15.17)
q (t = 0) = q0 = B1 B1 = q0
Eq(15.18)
q (t ) = -se-st B1 cos (Gt ) + B2 sin (Gt ) + e-st -GB1 sin (Gt ) + GB2 cos (Gt )
V
sRq0 + V0
q (t = 0) = 0 = -sB1 + GB2 B2 =
R
RG
Eq(15.19)
Thereforetheuniquesolutionisdefinedas:
sRq0 + V0
q (t ) = e-st q0 cos (Gt ) +
sin (Gt )
RG
andthefrequencyofoscillationis f =
G
.
2p
HomeWork#15
InEq(15.20),assume:
s = 2.4 per second, G = 2 per second, q0 = 0.25 Radian , V0 = 0 meter per second.
Plotaccurately q (t ) for 0 t 10 s
Eq(15.20)