You are on page 1of 3

CEE384 – Recitation 1.

5
Problem 1
𝑓(𝑥) = 25𝑥 3 − 6𝑥 2 + 7𝑥 − 88
𝑥 = 2, ℎ = ∆𝑥 = 0.2, 𝑓(𝑥𝑖+1 ) ≅ 𝑓(𝑥𝑖 ) + 𝑓 ′ (𝑥𝑖 ). ℎ
𝑓(𝑥𝑖+1 ) − 𝑓(𝑥𝑖 )
𝐹𝐷𝐷 = 𝑓 ′ (𝑥𝑖 ) = + 𝑂(ℎ2 )

𝑥𝑖 = 2
𝑥1+1 = 2 + ∆𝑥
= 2 + 0.2 = 2.2
𝑓(2.2) − 𝑓(2)
=
0.2
𝑓(2) = 102
𝑓(2.2) = 164.56
164.56 − 102
=
0.2
= 312.8

𝑓(𝑥𝑖+1 ) − 𝑓(𝑥𝑖 )
𝐹𝐷𝐷 = 𝑓 ′ (𝑥𝑖 ) = + 𝑂(ℎ2 )

𝑥𝑖 = 2
𝑥1+1 = 2 − ∆𝑥
= 2 − 0.2 = 1.8
𝑓(2.2) − 𝑓(2)
=
0.2
𝑓(2) = 102
𝑓(1.8) = 50.96
50.96 − 102
=
0.2
= −255.2
≈ 255.2
𝐴𝑐𝑡𝑢𝑎𝑙 𝑉𝑎𝑙𝑢𝑒,
𝑓(𝑥) = 25𝑥 3 − 6𝑥 2 + 7𝑥 − 88

𝑓 ′ (𝑥) = 75𝑥 2 − 12𝑥 + 7


𝑓 ′ (2) = 283

True Value FDD BDD


283 312.8 255.2

𝑇𝑎𝑦𝑙𝑜𝑟 𝑠𝑒𝑟𝑖𝑒𝑠:
𝑓"(𝑎)(𝑥 − 𝑎)2
𝑓(𝑥) = 𝑓(𝑎) + 𝑓 ′ (𝑎)(𝑥 − 𝑎) +
2!
𝑎=2 𝑥 = 𝑎 + ∆𝑥 𝑥 − 𝑎 = ∆𝑥 = ∆ℎ
𝑓(2.2) − 𝑓(2)
𝑓 ′ (2) = = 312.8
2.2 − 2
Which is the same as FDD

Problem 2
clc
fnct = @(x) 25*x.^3-6*x.^2+7*x-88;
dfnct = @(x) 75*x.^2-12*x+7;
%-------------------------------------------------------------------------

h=0.2; % step size


x=linspace(0,2,10); % incrementing x by the step size
F=fnct(x);

xFwrd=x(1:end-1); % Forward
dFFwrd=(F(2:end)-F(1:end-1))/h;
xBckwd=x(2:end); % Backward
dFBckwd=(F(2:end)-F(1:end-1))/h;

FDD=dFFwrd
BDD=dFBckwd

FDD =

Columns 1 through 7

7.6680 12.9355 26.4335 48.1619 78.1207 116.3100 162.7298


Columns 8 through 9

217.3800 280.2606

BDD =

Columns 1 through 7

7.6680 12.9355 26.4335 48.1619 78.1207 116.3100 162.7298

Columns 8 through 9

217.3800 280.2606

You might also like