Sie sind auf Seite 1von 19

NumericalAnalysis(Dr.

OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

ChapterFive
NumericalDifferentiation
Firstderivative:
Forafunction

ofavariable ,itsfirstderivationisdefinedas:
lim

1Forwarddifferenceapproximation:

Here isstepsize.Inordertodotheerroranalysis,wetaketheTaylorseriesexpansionof
about ,as:

Subtracting

frombothsidesanddividingbothsidesbythestepsize yields:

where

denotesatruncationerrortermproportionalto .

Thismeansthattheerroroftheforwarddifferenceapproximationofthefirstderivativeis
proportionaltothestepsize

2Backwarddifferenceapproximation:

TakingtheTaylorseriesexpansionof

about ,as:

Bysomerearrangements:

118

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

Thisequationhasalsoanerrorof

3Centraldifferenceapproximation:
Inordertoderiveanotherapproximationformulaforthefirstderivative,wetacktheTaylor
&

seriesexpansionof

Dividethedifferencebetweenthesetwoequationsby2 togetthecentraldifference
approximationforthefirstderivativeas:
2

Whichcanberegardedasanimprovementoverforwardandbackward,sinceithasthe
truncationerrorof

for| |

1.

Example:
ln usingthedifferenceformulatofind

1.8 ,if

0.1&

0.01.

Solution:
Forwardformula:

Backwardformula:

Centralformula:

Exactsolution

ln

1.8

1.9

1.8

0.555555

0.1
Forwardformula:

1.8

0.540672

1.8

1.7
0.1

0.571584
2.88%

Centralformula:

0.1

2.68%

Backwardformula:

1.8

1.8

1.9

1.7
0.2

0.556128
0.10%

119

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

0.01
Forwardformula:

1.81
1.8
0.01

1.8

0.27%

Backwardformula:

1.8

1.8

0.557104
0.28%

1.81

1.8

1.79
0.01

Centralformula:

0.554018

1.79

0.555561

0.02

0.001%

Example:
find

2 ,usingthedifferencemethodwith

0.2&

0.02.

Solution:
Exactsolution

0.353553

0.2
Forwardformula:

2.2
0.2

1.8
0.2

0.362864
2.63%

Centralformula:

0.345130
2.38%

Backwardformula:

2.2

1.8

0.353997

0.4

0.12%

0.02
Forwardformula:

0.352674

1.98
0.02

0.354442
0.25%

Centralformula:

2.02
0.02

0.25%

Backwardformula:

2.02

1.98
0.04

0.3535578
0.0012%

120

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

Fivepointformula:
FromTaylorseries:

Subtractingequation(2)fromequation(1):
2 !

2 !

FromTaylorseries:
2

4
2

5
Subtractingequation(5)fromequation(4):
2

Multiplythetermsinequation(3)by[8]andsubtractequation(6)fromit(toeliminatethe
term

);

8
8

2
8

2
2

12

12
Firstderivationoforder

12

.
2

12

Example:
usethreeandfivepointsformulatofind

2 if

0.5.

Solution:
Exactsolution

0.5

121

22.167168

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

Threepointformula:

2
2.5
2

1.5

23.7337013

0.5

7.06%

Fivepointformula:
2

12
1

8 1.5
12

8 2.5
0.5

22.0552135

0.5%

Secondandhigherderivative:
Inordertoobtainanapproximationformulaforthesecondderivative,wetaketheTaylor
&

seriesexpansionof

Addingthesetwoequations:
2
Subtracting2

2 !

frombothsidesanddividingbothsidesby
2

yields:

Whichhasatruncationerrorof

Centraldifferenceapproximationforthethirdderivative:

!
!

Subtractingequation(2)fromequation(1):
2 !

2 !

FromTaylorseries:
2

122

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

5
Subtractingequation(5)fromequation(4):
2

Multiplythetermsinequation(3)by[2]andsubtractitfromequation(6);(toeliminatethe
term

);
2

2
2

Centraldifferenceapproximationforthefourthderivative:

Addingequation(1)and(2):
2

2 !

2 !

4
2

5
Addingequation(4)&(5):
2

Multiplythetermsinequation(3)by[4]andsubtractitfromequation(6);(toeliminatethe
term

);
2

2
2

4
2

123

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

Centraldifferenceformulasoforder

2
2
2
2

2
6

Centraldifferenceformulasoforder
2
2

8
12
30
12

16

13

16

13

8
3

12

39

56
6

39

12

Forwarddifferenceformulasoforder
3
2
5

2
2
4

18

24

2
2

14

3
3

14

26

24

11

124

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

Backwarddifferenceformulasoforder
3
2
5

2
2
4

18

14

24

26

2
3

14

24

11

Problem:
,

UsetheTaylorexpansionsfor

2 ,

2 andderive

thecentraldifferenceformula:
2

Example:
sin ,where ismeasuredinradians.Calculateapproximationto

Let
0.8 ,

0.8 ,

0.8 with

0.1andcomparewithitsexactvalues.

Solution:

0.8

cos

sin

Exactsolution:

0.696706

0.8

sin

0.717356

0.8

cos

0.696706

2
0.9
2

0.8

0.7
0.1

0.695546

0.16%

2
0.8

0.9

2 0.8
0.1

0.7

0.716758

0.08%

2
0.8

2 0.9
2 0.7
2 0.1

0.6

0.694967

125

0.25%

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

Example:
Thedistance

traveledbyanobjectisgiveninthetablefollowing:

17.453

21.460

10

25.752

11

30.301

12

35.084

a)Findthevelocity 10 bynumericaldifferentiation.
70

b)Compareyouranswerwith

10

Solution:
a)Centralformula:
2

8
12
8 9

10
17.453

8 21.460

8
12

8 30.301

11
35.084

12

12

4.42475

b)
70

7
10

10

6.632120

6.632120 4.42475
6.632120

100%

33.28%

Example:
Thevoltage

inanelectricalcircitobeystheequation:

where isresistance,and isinductance.Use


followingtable:

126

2,

0.05,andvaluefor

inthe

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

8.2277

1.1

7.2428

1.2

5.9908

1.3

4.5260

1.4

2.9122

a)Find

1.2 bynumericaldifferentiation,anduseittocompute
/

10 sin 2

b)Compareyouranswerwith

1.2 .

Solution:
a)Centralformula:
2

8
12
8 1.3
8 1.1
12 0.1

1.4
2.9122

8 4.5260
8 7.2428
1.2

1.0

8.2277

0.05

13.6824
1.2

2 5.9908

11.2974

b)
10 sin 2
20 cos 2

Fromtable: 1.2

13.679273

sin 2

0.022%

5.9908
1.2

0.05

13.679273
1.2

11.297636

2 5.9908
0.002%

127

13.6824

1.2

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

Partialdifferentialformula:
,

Thepartialderivative

of

withrespectto isobtainedbyholding fixedand

differentiatingwithrespectto .
,

Similarly,

isfoundbyholding fixedanddifferentiatingwithrespectto .

Sothecentralformulabecome:
,

2
,

2 ,

,
,

2 ,

12
,

12

Example:
Let
,
2,3 and

Calculateapproximationto

2,3 usingcentralformulawith

Comparewiththevaluesobtainedbydifferentiating

0.1.

partially.

Solution:
Exactsolution:
,
2

2,3

3 3 2
2 3

9
25

,
2

2,3

0.36

3 2 2
2 3

4
25

0.16

Numericaldifferentiation:
,
2,3

2.1,3

1.9,3
0.2

,
2

0.360144

128

0.04%

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

,
2,3.1

2,3

2,2.9

0.160064

0.2

0.04%

Example:
Let

ln 3

15 estimatevaluesof:

&

0.1:

Usingnumericaldifferentiationwith

Solution:
Exactsolution:
3
3

4
4

4
2

15

15 4
2

4
15

2
3
9

15 18
8
4
2

15

9
15

0.167714884;

0.382948986
,

0.011356794;

0.048816243

NumericalSolution:
2 ,

,
4,5.8
,

12
8 3.9,6
8 4.1,6
12 0.1

3.8,6

12
8 4,5.9
8 4,6.1
12 0.1

2 ,

4.2,6

0.1677147

,
4,6.2

0.04882019
,

129

0.3829486

0.01135671;
,

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

Derivativefromdifferencetables:
WecanuseaGregoryNewtonforwardformulatoestimatevaluesforderivatives.
FromtheNewtonforwardpolynomial:
1

where

1
3!
4

2!
1

2
5!

4!

3
3!

2!
10

35
5!

50

6
3!

11
4!

18

22

24

Derivativewithrespectto :

1
2!

5
Ifwewanttofind

40
;i.e.

4!

100

24

;and

105
5!

2
1

3
1

0
1

4
1

5
1

Higherorderderivatives:
Fromfirstdifferentiationformula,thehigherorderderivatives,canbeobtained;
Wehave:

1
2!

40

6
3!

105
5!

100

18

22
4!

24

Takingthesecondderivativeofthisequation:

6
3!

20

120
5!

130

12

36
4!

210

100

22

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

;i.e.

Tofind

11

12
11

12

10

12
10

12

Wehave:

6
3!

20

120

12

36
4!

210

100

5!

22

Takingthirdderivative:
6

3!

24

36
4!

60

240
5!

210

Takingfourthderivative:
24

4!

120

240
5!

Tofind

&

;i.e.

0
7

&

Soweobtain:
1

131

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

Example:
2 ,findfirst&secondderivativeat

If

1,andlet

Solution:

21

56

115

204

17

35

59

89

12

18

24
30

2
1
12
2

1
5
1

3
1
6
3
1

4
1
0
4

1
0
5

1
1

1
1

12

6
1

11

12
11
0
12

10

12
10
0
12

132

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

Example:
1.3

Fromdatabelow,estimatethefirst,second,third,andfourthderivativeat

Solution:

1.1

1.3

1.5

1.7

1.9

2.1

2.3

3.3

2.9

2.6

2.3

2.0

1.6

1.3

0.4

0.3

0.3

0.3

0.4

0.3

0.1

0.1

0.1

0.1

0.1

0.1

0.2

0.1

0.3

0.2

0.4

0.2
1
1.3

1
0.2

1
0
2

0.3

3
1
1
0
3
4

1
0.4
5

0.1

0.975

1
1.3

1
0.2

11

12

11
12

10

12

10
0.4
12

0.1

10.625

1
1
0.2

1.3

3
2

0.1

7
0.4
4

106.25

1
1.3

1
0.2

0.1

2 0.4

562.5

133

0.6

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

Problem(1):
Findthefirstderivativeof;
3
Usingthefinitedifferencemethodat
;

0.05

0.05,

0.05method.

1912.320

Problem(2):
Findthefirsttwoderivatives &

ofthefollowingfunctionusingthefinitedifference

method.Compareyourresultswithanalyticalvalues:
ln 3
;

140
140

15

0.0213609;
0.0213616;

140;

140
140

1.508541

10

1.521122

10

Problem(3):
Findthefirsttwoderivativesofthefunction;
20
0.05with

at

12

0.05byusingthefinitedifferencemethod.Findtheerrorcomparedto

theanalyticalvalue:
;

0.05

0.05

957.029967;
0.01%;

0.05

4122.5536

0.05

0.22%

DifferentiationoftheLagrangePolynomial:
ThegeneralizedLagrangepolynomialis:

TheLagrangecubicinterpolatingpolynomialthroughthefourpoints
,

, &

is:

Differentiationthispolynomial:

134

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

TheLagrangecubicinterpolatingpolynomialthroughthefourpoints
,

, &

is:

Thesecondderivationis:
2

Thethirdderivationis:
23

23

23

23

Thefourthderivationforcubicinterpolationformulaisequaltozero:
0

Substitutionof

:
2

3
2

3
2

3
2

2
0
3

135

NumericalAnalysis(Dr.OmedGharebAbdullah)UniversityofSulaimaniFacultyofSciencePhysicsDepartment

11

1

3

2
2

2 0

2 0

2 0

2
12

2
3

10

2
2
5

2
4

6

6

23

23

23

6
2

6
2
6
6

23

6
2

6
2

6
6

6
2

Problem:
StartwiththeLagrangeinterpolationpolynomialfor
,

basedonthefourpoints

, & ,derivetheformula:
2

Exercise:
Derivetheformula:
5

18

24
2

StartwiththeLagrangeinterpolationpolynomialfor
,

14

basedonthefivepoints

& .

136

Das könnte Ihnen auch gefallen