Numerical differentiation and integration notes, Exams of Mathematical Methods for Numerical Analysis and Optimization

Numerical differentiation and integration notes Numerical differentiation and integration notes

Typology: Exams

2025/2026

Available from 09/16/2025

Joejoski
Joejoski 🇺🇸

4.2

(48)

3.2K documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Numerical differentiation and integration notes and more Exams Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

NUMERICAL DIFFERENTIATION AND INTEGRATION Introduction In this chapter, we will consider the application of some of the interpolating formulas obtained in the preceding chapter to evaluate the derivatives and definite integrals of functions. The process of finding approximate values of derivatives by using interpolation formulas is Numerical differentiation and that of definite integrals Numerical integration NUMERICAL DIFFERENTIATION Consider a function » =f (x) and suppose 5 V5 Vp5 esse > ¥, corresponding to the equidistant values x), %,, X,, 0.2.0... , x, of x. Suppose we wish to find y’ -(2) 5 dx 1 ( dy a \ dx? derivatives are obtained by use of forward, backward and central difference formulas according : . 1 as xX is nearer to x,, nearer x,, or nearer to the middle valuc al% + x] . The methods are described below. Derivatives using the Forward Interpolation Formula We recall that the Newton’s forward interpolation formula is given by; P(p-l),. | pP(p-)(p-2) . | p(p-1)(p-2)(P-3) ,, Y= Yo + pAy + _ Jay, + ( 7 J aty, 4 ( ie ut AN Vy tosses (1) Where p= = fo and y stands for y, =y(x,) h Differentiating (1) w.rt.p, we get dy_, 2p-ly.s \, 3p’-6p+2/,;.), 4p'-18p*+22p-6/ ., eNOS (A*y,)4 F (A*y.)+ oa (Aig )onnnnetnenaten en (2) ay are BN ponies BM dx dpdx dph dx oh dy 1 2p-l;.> 3p"*-6 vi) 4p*-18p"+22p-6 a Faye sa i a (819) oe) This gives y' at any point x=x, + ph. At the point x,, we have p= 0, and expression (3) becomes 1 ay, —2(a8y)+4(a°v)-2 (a'r) (0s -F(atn)+| ccceseeeeseesssassee (4) This formula may be used to compute y’ at any of the values of x where ) is specified. Differentiating (1) again w.r.t.x, we get dy _d (2) d (e)e-14(2) de? dx\dx) dp\dx)dx hdp\dx 1{2/.5 \ 6p-6 12p* -36p+22 ) = Bl gem) F—(4'1)+—* van (a°n)+-] @y Alps 6p? -18p+l11 EZ (a'ne)o(o-mla'yn) SEPA ats) | This gives yp” at any point x=x, + ph At the point x, where p» = 0, expression (5) becomes ay Ufie ay, ly Sis ABT fe... Se ar [la yo) (A wa) ola va)-2(A vt (Al ine [La nstaectne nase nit sill} This formula may be used to compute y” at any of values of x where y is specified. ” Similarly, by differentiating (5) successively we obtain formulas for y”, y”. Note: The formulas derived above are used to compute the derivatives of y at any point nearer to the starting value x in the table for y= f(x) L x 10 #12 #14 #16 #18 20 2.2 2 Example 1. Given » find & and ay at y 2.72 3.32 4.06 4.96 6.05 7.39 9.02 dx dx x=12. Solution: Note that 4 = 0.2 and form the difference table as below : y Ay Ay My Atty Ay A’y 1.0 2.72 0.60 1.2 3.32 0.14 0.74 0.02 1.4 4.06 0.16 0.01 0.90 0.03 0.02 1.6 4.96 0.19 0.03 0.07 1.09 0.06 -0.05 1.8 6.05 0.25 —0.02 1.34 0.04 2.0 7.39 0.29 1.63 [2.2 9.02 For first derivative we use formula (4) ‘ Wi of ge, Tipe Va Mtneey i f to-c ar Ya (A°Me)+54(4 vs) _otgeensacag srpmenemenygentcee di) From the table we have Ay, =0.128, A’y, = 0.288, A’y, = 0.048, Atyy =0. Using (i) and (ii), we get f'(Ly) = A [0428-F(0m8)] =0.63 5 1 i | r(iij= -{ 0288-30048) = 6.6 (0.2) 2 } Exercises . x 1.00 1.05 1.10 LES 1.20 125 1.30 1. Given . find y' and y" y 1.00 1.0247 1.0488 1.0723 1.0954 1.1180 1.1401 at x=1 2. Find y' and y"at x=1.5 given that % ILS 2.0 2.5 3.0 35 4.0 y 3.375 7.000 13.625 24.000 38.875 59.000 3. The following table gives the values of sin@ for various valucs of 0 a 0° 10° 20° 30° 40° sin? 0.000 0.1736 0.3420 0.5000 0.6428 Find the value of cos10° Derivatives using the backward interpolation Formula Recall the Newton’s backward interpolation formula, see below P(ptl)o., p(p+l)....(p+n-l) y, (x)=y, + pVy, + 7 serene t EV ly, snwareeenseneee (Ul X-X, Where p= a and yp WHERE Y= yj, cseveeneret siaeneeeaytameenier reenemneenmen mene (2) h Differentiating (1) w.r.t p, we get avy, + “5 } (vy,)+-Z 82"? (o'y, J PENA gs, AP BFA P ES (oy, ll 2 3 mh Vy. 4 2p Hl ivay dx oh , This gives »’ at any point x=x,+ ph. At the point x,, we have 7 =0 and expression (4) becomes 4 dy 1 1 fase. Las Ts yea = —| Vy +—(V"y, Jt—(Voy, JHa(V"y, | one |e eee cece cece ence eeee te eeesearetenerened 35) ty, L(v'y,)eLvrn tv.) ( This formula is uscful to compute y’ at any of the values of x where y is specified. Returning to (4), differentiate it w.r.t x, we get dy d (=). d (£)#-2(2) de dx\dx) dp\dx)dx dp\deJh 1[_> \, 6p? +18p+11 1 LM (oey(vs,) HSE ABPANP (ory) _ _Savnesicitior I histone (6) This formula gives y" at any point x =x, + ph. At the point x, (where p = 0), expression (6) becomes dy 1 5 [y». +(V'y, 4 (Wr,)#2(V%r, )+Z2(v%,) = | seeapesenasencoanceadl (7) de br This formula is used to compute y" at any of the values of x where } is specified. Similarly, by differentiating (6) successively, we obtain formulas for y”, y”, ...... Note: The formulas derived above are used to compute the derivatives of y at the points near to the final value of x in the Table for y= f(x). . x 10 12 14 #16 18 #20 22) . Example 1. Given > find y’ and y" at y 2.72 3.32 4.06 4.96 6.05 7.39 9.02 x=2.2. Solution: Note that 4 =0.2 and form the difference table as below x yp Ay Ay My Aty Ary ASy 1.0 2.72 0.60 1.2 3.32 0.14 0.74 0.02 1.4 4.06 0.16 0.01 0.90 0.03 0.02 1.6 4.96 0.19 0.03 0.07 1.09 0.06 0.05 1.8 6.05 0.25 —0.02 1.34 0.04 2.0; 7.39) 0.29 1.63 2:2. 9,02, dé 1 1 1 —(8)= =] -6.2-—(0.07)-— (1.6) | =-3.11875 a! ) Al ag! ) a4! | i This means that at ¢ = 8sces , the body cools at the rate of 3.11875" /sec. The negative sigh indicates that the temperature decreases with time. Exercises 1. For the function y= (x) described by the following table, find y’ and y” at x= 2.2 we 14 1.6 1.8 2.0 2.2 y__ 4.00552 4.9530 6.0496 7.3891 9.0250 : g 9 2 3 2. Given |” 1.96 198 2.00 2.02 2.04 , find y' and y" at x=2.03 y__0.7825 0.7739 0.7651 0.7563 0.7473 NUMERICAL INTEGRATION Consider a function y = f(x) and suppose y,, } , ¥, are values of y corresponding to the equidistant valucs x,, x,, X,,....., x, Of x. Suppose we wish to find an approximate valuc of the definite integral =] F(a) i cpocccensenawonriapnet wanna nenonrnatcdeanenennnecmenwiinrneed (ql) The process of finding an approximate value J by using the specified values y,, },, ¥y,..-.5 ¥, of y=f (x) is called method of quadrature’s. The method is described below. Quadrature formula In (1), suppose we set x =a, +/t where h=x,—x,_,, 7=1,2,......”, 80 that f=0 when x=x, and t=n when x=x,. We get r=[ Fl + ht) hdt By employing the Newton’s forward interpolation formula (sce last section) to the integrand, we obtain the formular given below (see below) This formula gives the values of J in the form of a series. This is known as the Newton-Cote’s quadrature formula. By truncating the scrics at appropriate stages, we obtain approximate values of I to the desired degrees of accuracy. ref) Day EMA, MAME oa ty fn? m)\p.5 Lf >.) a, 4 Lf 3 1 ra = o,+8(an)+2{ 2-2) %ol* ail a oa Oar (rar 5 -3t (ay, )+.. 243 2 3! 4! i? 1f? P\ 3) uf 3 Pr 3 af n° lin ‘i aad nZone pe Ela wal got +P An) alga ta 3 (A ‘Yo)+ =n c n| ne 35, 50 \ nin Sn* 225 274 . —| —-2n? + =n? —-—n +12 |( Arp, )+ —| — ——4.17n? — =? — 2+ 60 |(APyp 5!| 6 4 3 I ») ale 2 4 3 I ) Seis Betis nibs olbsitiisin\eeitsnme eal itientaendacidésitltalthonendiiit (2) Below we consider some particular cases of formula (2) Trapezoidal Rule Let us take » =1 in the quadrature formula (2) and neglect terms containing A*y,, A’y,, ... Then we get Here 1 =10, x, =0, x, =1, so that we take h=0.1 Le haa 7 =O . We compute the values of y= f(x)=e* For x, =0, x, =0.1, x, =0.2,......, 4) =1 and record the values in the form of the table below x 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 S(x) 1 0.9048 0.8187 0.7408 0.6703 0.6065 0.5488 0.4966 0.4493 0.4066 0.3679 The trapezoidal rule now gives i — fetar= rid [(% +30) 420% tts tHe TPs tM AY, tH tIs) | : 1 0.9049 + 0.8187 +0.7408 + 0.6703 + 0.6065 + = 5x0-1x) (140.3678) +2 (0.5488 + 0.4966 + 0.4493 + 0.4066 1 ofem dx = 0.632635 : The exact value is 1 Jer dx =-€ 0 Comparing both solutions, the result obtained from trapezoidal rule agrees with the exact result up to third of decimal =1—0.3679 = 0.63212 lo \ Example 3. Evaluate [= by trapezoidal by considering cight sub-intervals of the interval oite [9,1]. Hence find an approximate value of log2 Solution xX) =0, x, =1 so that we take h = 7 First we compute the values of y = = corresponding to +x the values x, =0, x, =1/8, x, =1/4,....., x, =7/8, x, =1 and record the values in the following table. Q 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1.0 y: 1 0.8889 0.8 0.7273 0.6667 0.6154 0.5714 0.5333 0.5 ee Now the trapezoidal gives 1 He ler =SA[(9) + ¥s)+2(, +9249, 4+¥, tH tH. +9) ) 2 The exact value of the integral is 1 dx 1 Jee [log (1+) ], =log2 = 0.694125 10 dx 1 [Bajo 125x{ (1.5) +2(4.803) ] L pe lg 0 = 0.694125 Exercise 1. A plan area is bounded by a curve, the x—axis and two extreme ordinates. The area is divided into five parts by equidistant ordinates 2cms apart, the heights of the ordinates being 21.65, 21.04, 20.35, 19.61, 18.75 and 17.80 cms respectively. Find the approximate valuc of the arca. Ans =198.95 2. Evaluate f logx dx, by using the Trapezoidal rule, given that 4 oo 4.0 4.2 4.4 4.6 4.8 5.0 52 logx: 1.3863 1.4351 1.4816 1.5261 1.5686 1.6094 1.6487 Ans =1.8276 Simpson’s one-third Rule In the Newton’s-Cotes (see formula (2)) suppose we take n =2 and neglect terms containing AP yg: A*yg5 vseees Then we get Jf (ar= 24] v + Ay, + ta] Using the results Ay, =¥,-y,, A’y, =, -2y, + yy, this becomes [res [y +4, +¥,] Similarly, j i (x) sal Va t4y, + Ye | Proceeding like this, we get, finally fre) )dx = SLs, 2+ 4y, ity] (This is valid ~~ when n is even) Adding all these integrals we obtain Jy . i | f()a= 3h [(¥o + ¥n)FA(M + Ys Hot Ips + Da) A 20 Ig Feta tne) | Xo This formula is known as the Simpson’s 1/3 rule, or just the Simpson’s rule. It should be emphasized that this rule is applicable only when n is an even number. Ad We first tabulate the values of y= f(x)=e” for x,=0. x, =0.1, 4, =0.2, 0... +X =1; the computations are summarized below Bae} 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 y: 1 0.99005 0.96080 0.91393 0.85214 0.77880 0.69768 0.61263 0.52730 0.44490 0.36788 The Simpson’s rule now gives f "4 I a (l +0.36788) + 4(0.99005 + 0.91393 + 0.77880 + 0.61263 + 0.44490) e* dx =—x0.1* F “ 5 3 +2 (0.96080 + 0.85214 + 0.69768 + 0.52730) = oh 36788 +.4(3.74031) + 2(3.03792) | = 0.746832 Example 4. A rocket is launched from the ground. Its acceleration f is registered during the first 80seconds and is tabulated below. Using Simpson’s rule find the velocity of the rocket at ¢=80seconds : tsecs 0 10 20 30 40 50 60 70 80 f (cm/sec”) 30 31.63 33.34 35.47 37.75 40.33 43.25 46.69 50.67 Solution t If v is the velocity at time ¢, we have =f so that v= fs dt. The velocity at ¢=80 is given 0 80 by; v= fra LE ° From the table we note that 4 =10 and n =8. Therefore, Simpson’s rule gives (30+50.67)+4(31.63 +35.47 + 40.33 + 46.69) 20 v= | fai=tx10 , 1 3 | +2(33.34437.75+43.25) = [0.67 +616.48+ 228.68] = 30.861m/sec. Exercise aj2 1. Evaluate J (cos 0 d@ by dividing the interval into eight equal parts (Ans =1.1911) c 2. Consider the curve 3y = x° bounded between the ordinates x =0 and x =2. By using Simpson’s 1/3rule, with # =0.5, find; 0 (i) The area below the curve, [are is given by A = Ir | 13 + 2) (ii) The are-length of the curve [Arent is given bys =[f+oy} ‘ 0 (iii) The volume of revolution when the curve is rotated about x-axis 2 \ [vane is given by 7 = Jar dx 0 } Simpson’s three-eighth rule In the Newton-Cote’s formula (see formula 2), let us take n =3 and neglect terms containing At yy: AY ps cess Then we have [r(@ax =3h r.3, 3 1 Yor SAV + GAY + in| = elt. +3y,+3y,+y;) Here we have used the results Ay, = y,— 5, A°¥y = 2-29, + Pos AM) =) —3) +39, Similarly, [Fla)ae= aly, +3y,+3y, + Ye] Proceeding like this, we get, finally { f (x)ax = whl. +3y,.+3y,.4 y,] (this is valid ool when n is a multiple of three) Adding all these integrals we obtain [r()ar=2a[(y, + ¥) )AB(Y A Vs AVG AVS bot Vag + Vg + ya) + 2(V5 + Pg beset ns) This formula is known as the Simpson’s (3/8) th tule. This rule is applicable only when ni isa multiple of 3. Example 1. The following table gives 6 valucs of an independent variables y= f (x) xt 0 1 2 3 4 5 6 ¥: 0.146 0.161 0.176 0.190 0.204 0.217 0.230 5 Evaluate f7e@) dx , by Simpson’s (3/8)th rule. ° Solution Here 6 values of x and the corresponding values of y are given. Also #=1. Hence the Simpson’s (3/8) th tule to be used is 14 3 [r(xax =FAL(r Sy JER FAY A AY tM EM) +20 +9) ] Now yields the required area as ax =30.2«(0.7738+3%3.0793+ 21.0957) ‘e = 0.9152 The exact result is a=f(% Has= (i 2 \ar=[x-2tan~J* vA +h) + =1.8-2(tan™ 2.8-tan“'1) =1.8-2(1.2278-0.7854) = 0.9152 Comparing the two results, the result computed with Simpson’s (3/ 8) th rule agrees with the exact up to fourth place of decimal. Exercises a2 1. By using Simpson’s (3/8)th rule, evaluate j 2’ dO. Take n=3 a 2. By using Simpson’s (3/8) th rule, evaluate — dividing the interval into six 1V3+2x-x" equal parts. Hence find an approximate value of z 16