0% found this document useful (0 votes)
42 views174 pages

NM Manual

The document provides a comprehensive overview of numerical methods, including techniques for solving linear and nonlinear equations, interpolation, differentiation, and integration. It discusses the importance, advantages, and limitations of numerical methods in computational mathematics, emphasizing their role in engineering and scientific applications. Additionally, it covers error analysis, including types of errors encountered in numerical computations and their implications.

Uploaded by

080bct035
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
42 views174 pages

NM Manual

The document provides a comprehensive overview of numerical methods, including techniques for solving linear and nonlinear equations, interpolation, differentiation, and integration. It discusses the importance, advantages, and limitations of numerical methods in computational mathematics, emphasizing their role in engineering and scientific applications. Additionally, it covers error analysis, including types of errors encountered in numerical computations and their implications.

Uploaded by

080bct035
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 174
lm Orel MeL Le 115) SECOND EDITION Oe ON bm System Inception’ Insights a Numerical Methods i ¥ 7 eB CBBC Saw E MC HLy i Gauss Plimination Method with Pivoting Strategies s Gauss Jordan Method s 3.4.1 Inverse of Matrix using Gauss Jordan Method 57 LU finctorization a Jacobi Method and Gauss. Seidel Method (Iterative Method) 63 Figen value and Figen Vector Using Power Method. 67 SOLUTION TO EXAMINATION & IMPORTANT QUESTIONS ovo. 71 - INTERPOLATION Programming in Numerical nance of Compute Newton's Interpolation 18 ek E 4.1.1 Newton's Forward and Backward Difference Siena De TION & IMPORTANT QUESTIG UEP ON nn desu ADD sontos TOEXAMINE 4.1.2. Newton Divided Difference Method... seuss 126 Central Difference Interpolation ...sssrennennee BO 4.2.1 Stirling's FORMU. ..snnsnuinnininnenees BO - 4.2.2 Bessel’'s Formula 132 section Method (Bina : {etnod or Bolzano's Method) Lagrange’s Interpolation, sone senseesees 133 Method or False Position Method Reg Curve Fitting by Least Square Method .....0... 135 fomspolion Method. Spline Interpolation [Cubic Spline} .:..:escsseseee 141 23. Newton-Raphsoa Method. SOLUTION TO EXAMINATION & IMPORTANT QUESTIONS ossuou. 145 24 Secant Method. 25 Fixed Point Iteration Method nn “omparison of erative Methods. NUMERICAL DIFFERENTIATION 448 . AND INTEGRATION [SOLUTION TO EXAMINATION & IMPORTANT QUESTIONS. RATION __ a Numerical Differentiation Formula. 181 5.1.1 Numerical Differentiation Formula Using Newton ‘SOLUTION OF SYSTEM OF LINEAR ALGEBRAIC Forward Difference Formula...necsesnme sve 181 _ _EQUATIONS 5.1.2. Numerical Differentiation Formula Using Newton (Gauss Elimination Method. Backward Difference Formula...... : 183, Maxima and Minima... 186 -_— | ture Formula age General Qual | INTRODUCTION, APPROXIMATION AND | ERRORS OF COMPUTATION .gendre Formula 2 os « IMPORTANT QUESTIO) pexawnrsTION & sap TION 70 1,1 Introduction to Numerical Methods ‘There are many situations where analytical methods fail to produce desirable results such as in solving non-linear differential equations, in finding roots of transcendental equations, in drawing plausible inferences from a given set of data, etc. On such and many other occasions, numerical methods find its importance. These days, numerical methods have become indispensable tools in the hands of engineers and OF ORDINARY SOLUTION OF ORDINA DIFFERENTIAL EQUATION ied Euler's Method sihods for First and Second Order scientists. ial Equations a Numerical methods are techniques by which mathematical problems are formulated so that they can be solved with arithmetic and logical operations. In fact, numerical methods are algorithms that are used to obtain numerical solutions of a mathematical problem. Importances/Advantages: Boundary Value Problem by Finite Method and Shooting Method. ‘SOLUTION TO EXLMINATION & IMPORTANT QUESTIONS, NUMERICAL SOLUTION OF PARTIAL DIFFERENTIAL EQUATION ‘The importances/advantages of numerical methods can a be listed as follows: Ce a Numerical methods include iterative methods, so use of iterative methods in science and engineering provides higher accuracy. b. Complex numerical expression can be solved by using numerical approximation & interpolation method with larger accuracy & efficiency. © Solving the problem with the application of, computational approach benefits in time saving and good understanding, a. 30 Use of numerical method helps in generating numerical stability. 73 Sobsaom of Laplace Equation 74 Solving of Poisons Equations... 75 Solutio of Blip Eqution by Relaxation Method... Solution of One Dimeasioal Heat Equation SOLUTION TO EXAMINATION & TuPoRTaNT QUESTIONS 6 ll BIBLIOGRAPHY pc ree tee eee Introduction, Approximation and Errors of Computation|1| a __~ of numerte al metho some atesypcstn el Nene rion of a system of ordi ‘ ee un equired compute ivory of aspaceetil — ety of car crashes, the “ of car crashes. § squations mnulations lifferential & ically rene penal methods to calculate * Henatives more precisely: Disadvantages (limitations): Numencal techiigu proximation which may M os the method of interpolati not converge the solution enact slut shod procedure sometimes may not metimes. faces stabil “ Numerical met clegant and exact as analytic solution son ‘The solution of some numerical problems condition problem proximation and Errors in Computation “Approsimaons and errors are an integral part of computation Errors have different forms: some can be eliminated while some cannot be avoided (but minimized) Following types of errors are encountered in any ‘numerical computation: i. Inherent errors (input errors): Errors which are already present in the statement of a problem before its solution are called inherent errors, These are 4. Data errors (empirical errors}: Data error arises While collecting data for a problem by some experimental means, and are therefore of limited accuracy and precision. This type of error is due to the limi ‘n instrumentation and reading. 12] Insights on Numerical Methods b. Conversion’ errors (representation errors): Conversion errors occur due to the limitations of the computer to store the data exactly, Numerical errors (procedural errors}: Numerical errors are introduced during the process of implementation of a numerical method. ‘The total numerical error is the sum of roundoff error and truncation error: a, Roundoff errors: This type of errors occur when a fixed number of digits are used to represent exact numbers. Roundoff is used at the end of every arithmetic operation, b, Truncation errors: This type of errors occur when approximation is used instead of exact: mathematical procedure. That is, truncation error arise because of the truncation of the mathematical process. solute and Relative Errors Absolute error (E,): Absolute error is the difference tween the calculated (or measured value) and true value £, = [true value ~ calculated value] ‘The absolute error is inadequate due to the fact that it does not give any details regarding the importance of the error. While measuring distances between cities kilometers apart, an error of a few centimeters is negligible and is irrelevant. Consider another case where an error of centimeters when measuring small machine parts is a very significant error. Both the errors are in the order of centimeters but the second error ismore severe than the first one. Relative error (E,): The deviation of the difference of calculated value and true value with respect to true value is called relative error or normalized absolute error. true value ~ calculated value} [true value] absolute error 5 =" true value Introduction, Approximation and Errors of Computation|3] {4 Newton's Finite Difference Consider a function f(x) whose function values f(a), f(%:), {{%:), -»»» {@%) are known. Let these function values be denoted as fy fir, of» The difference between any two consecutive function values is called the finite difference. ‘The difference in function values f(x.1) ~ f(x) is known asthe first forward difference of f(x) at taf The k* forward difference of f(x) at x = x, is defined as —edenedt absolute error x, and is given. by - je, The relative error of AMfi= ACA) = Ale sfes — Ath, J the absolute ror of INE urement ShOWS hoy The difference in function values f(x)) — f(x.-1) is known rmesrenest 008 HY ge the error Is in relation Bs the frst backward difference of f(x) at x = x, and ls given by Tree theeror actual” | the true value 3, Example: _ value of th the If the true val 5 ie te vat Thigh of a building is 3059 eight ofa balding er] cm but an engineer where A is called the forward difference operator and V. = 7 000m, on measures 3000 cm, then iscalled the backward difference operator. smeasures 3000 | 0s0-300]=500m |g 3050=3000) _ 9 6,4 The difference in function values f(Xie1/2) — f(%i-1/2) is = __ 3050 known as the first central difference of f(x) at x = x, and is given eee sity 13 Taylor Series Vii= fifi The k** backward difference of f(x) at x = x\is defined as (Ve) = Vig — ye Sf = fia fiae ‘The Taylor series is of great value in the study of fi . sameria) aabods lh essence, the Taylor series ‘provides The k* central difference of f(x) at x = xis defined as ‘means to predict a function value at one point in terms of the BH = 80H) = Beare — BML function vale an its derivatives at another point. where 8 is called the central difference operator ‘The Taylor sertes is expressed as For any two function with dependent and independent Fou) ty +A, Ae, Od, variable there will be some changes in either variable due to fay, 2 3 change of other variables. The study of any. change in nt P+ Re, dependent variable of a function due to the change in h fone independent variable of that function is called Newton's finite where R,= ee ‘em, step size (8) = xn xi difference. Newton finite differences are classified as forward, backward, central, and divided difference. |4| Insights on Numerical Methods TS _—— Introduction, Approximation and Errors of Computation|5] ) Newton For ce of data are with eaiere a fant variables 0 at) ‘a’ is the fo ji, Newton's Central Difference When the equidistance variables of x produces output by the function y = f(x) itis applied to approximate the value of y atany f(x). is the central difference operator, The central difference table can be formed as follow: [=] | alterence- | a aitarence | sw aference | svc | ey | re [xo vo. »5¥ 1/2 =¥i-Yo apn Tei Van = VV a By, = By. 2-85 BY sia = Vs abe Newton's Backward Di Interpolation ttisapplcable when the diffrence of data are with equal incevas ie, ifthe equidstance variables of x produces cut y forthe function y = fix). ‘Vis the backward (flerence operator used ilference/Newton Backwar ‘The bucward difference table can be formed as follows: Newton's Divided Difference This method is applicable when the difference or data are with unequal intervals i produces output y for the given function y = f(x). The divided difference table can be generated as below: if the unequal variable of x Yo x] ¥ | Ddivided | 2° divided 37 divided difference Ay| difference Ay | difference 4% Ha] Yo Ye¥o_ Ye Introduction, Approximation and Errors of Computation|7| 5 ana aT CRG PI Methods ming in Numerical Importances/advantages of computer programming in jumerical analysis are: Application of computer programming in’ numerical analysis makes our output error free. Saves the effort, cost & calculation time with more clear i approach. peremtial on for dif Several manual iterations can be easily performed by computers. The solution generated by the application of computers provides higher rate of convergence. Solution can be obtained with higher rate of efficiency, accuracy and precision, 5, shiftoperator Those problems, their solutions and the method used for no dplacementoreansacon operator, Ge solving can be stored for future references as well. nit or dspace }_Elsdefinedas aoa Bf Most valuable digits in a given number is called aha significant digit. Leading zeros—{00qs083{}+— Trailing zero Leading zeros are not valuable digits so they are not counted. ‘Above equation may also be written as “8 fu) = e+ kh) where h= 6. Inverse operator Inverse operator denoted by Eis defined as Trailing zeros are valuable digits so they are counted. Ef) = #0) So, B(x) = s-h) Ex) = ek) 7. Averaging operator ‘Averaging operator denoted by jis defined as whe 181 igh on Ramer eta ae Introduction, Approximation and Errors of Computation|9| IMPORTANT QI solution ynaTiOn® f a we is on TO EXAMIN inte and) a w ” SOUT ace between absolute a X | ¥_ |dlttorence| airterence| aitferencelatforenco pias ee 4 )} ay | ay | a tor watnexal 1) M4 Habel, fast] 0 : S14, solution - Relative error, | a at F angotute 08 ohne ass 2) 18 jeg | 2 1 | 1 miseinedas 4a]. absolute error ste | Fe rue ale AMG Tne : Sei} 6 vale | vo value cael | a rue valuio| 5 6 | ae i} 13 sa tield. The relative error gf The absolte i how! measurement shows: 6 [19 ment shows ho measure large the error Is In rela - = - - gti eras | rae Uh oO Ine Discuss the limitations of solving mathematical . _ problems by numerical techniques rather than 1 Example: 3. Hxample Alcally. {2078 Bhedray Ws the true value of the| 16 the true value of thy ete 5 : " ght of a building is aosp eight of building i 3050) height / I qe tat an engineer] ch but on engines, ‘antages (limitations): measures 3000, then | meastires 3000 cm, then |. Numerical techniques use the method of interpolation & approximation which may not converge the solution to exact solution, 8050-3000), |i, ‘They may not be elegant and exact as analytic solution sometimes, lik The solution of certain problems faces stability condition problem, 4. Discuss the pros and cons in solving mathematical problems using numerical methods. {2000 Bihatny Solution: The pros in solving mathematical problems using ‘numerical methods are as follows: Introduction, Approximation and Errors of Computation|11| po ee | SOLUTION OF NONLINEAR EQUATIONS _ Ego toste ilies P 4 else dis; = Step 7: Stop. splay root = x3 241 Insights on Numerical Method ™" ‘Solution of Nonlinear Equations | 25 | arta g0 jnt Iteration for Fixed Point Iteral pseudocode f 1 Sart 2. Define function as 3) 3. Define convergent form g(X) 4 tpt Initial guess x» b, Tolerable error € ¢. Maximum iteration N Inline iteration counter: step = an) xe etx) step = step 1 ifstep>N Print Nom convergent” Stop End if wen While abs fa) > 7. Printrostas; 8 Stop {261 lights on Nmereataancay Find the square root of 8 by using fixed Point iteration method, lution: Given function is; f(x) = -8 We can write ree mom If iteration is done root is not converging so the equation is further manipulated, Adding x both sides, 8 xtxeyex B+x 2x. oes = B(%a) @ Where, 60) =22* now, Let the initial Guess be 1 n | xe | Xe ih 3 2 |3 2.8333, | 3 |2.333 |2.6284 4 |28284 [2.9284 ‘The value of x»s1 in 3"! and 4° iteration is same upto 41h decimal value so, root of equation x = 8 is 2.8284, Calculator tricks: A: = function g(A) Solution of Nonlinear Equations|27] ie compen na shed {Find the root of equation 2x3 + 4x2 = 4x6 2 0 ual ig simplest med - 7 1. . sis linea! = bisection method and correct upto two decimal = Convergene fesow butsteagy aces Convergence {2063 Jestha} | pisection Method | sition Method ‘Solution: eee 7 eis inear rst ord) Given function, converge vergence faster than tha of bisection foeoes hen x-6 Secant Method Letus assume two initial guess 1 and 2 + Secant Me ante of convergence (1) = 4 men) a Noguarante of on gut this method once converges, £(2) = 18 sa(2) f convergence is faster than that of false prom (1) ced method i {(1)»f(2)<0 which implies that root lies in between 1 & 2 Convergence is superlinear. ) a a b Xe £(&a) . eee Pah 5 Ts ee onverges conditional \— | : ae ee (second order), 2 a LS 1.25, -0.8438 | . Rate of convergence is fastest of all the 3__|1.25 1.5 1.375 1.2617 | es methods. | 4 |1as. 1.375 13125 0.1626 | 7 * Fixed Point Method 5__ [12s 13125 1.2813 |-0.3512 = Convergence is linear. 6 1.2813 1.3125 1.2969, 0.0972 « Leastused method, 7 1.2969 1.3125 1.3047 10,0320 8 1.2969, 1.3047 1.3008 |-0.0327 Form the above table we can see the value of x, is epeated in 7 and 8% iteration so the root of the non. linear equation is 1.3008, Calculate the root of nonlinear equation f(x) = sinx = xed using secant method. The absolute error of functional value or calculated root should be less th )-3, 1281 igh on amare am 10-9, (2065 esta] Solution of Nonlinear Equations|29] ee solution x x | fe) | tu) | x Given function. 1 [2 3 0.5979 |0.2313 |2.7210 | fiyyesime= 287 peoand - 2 8 2.7210 |5.8588 |0.0291 [2.7145 | einital guess PF | eee aase-*) 3 [27210 [27145 |oa3ze |-o.00064|2.1366 caleulatng U1)* — 2.7145 |2.7136 Jo - | goy=16) ve wich implies that th 4 0158 |-0.00053|2.7406 | y= <0 (ee 5 _|2.7136 |2.7406 [0.0143 |-o.00048|2.7406 eengand — _aytabular form, Te its) _| fx) 1 [0585 (0.03355 0.00725 Joe631 (0.0931 [0.03355 From the above table the value of x, at 4% and 5 iteration is same so root of given equation is 2.7406. ——sja root of &* = 3x using Nowion RS {Find a root of ex = 3x using Newton-Raphson method and correct up to 3 decimal places. {2069 Brae} [ose [-n00725 [0.000577 aaa ‘Herein the above table Xe has the same value upto 3 Given equation is: | veima place in 3° and 4 iteration. So root of function f(x) =e*-3x | fx) sink -2x+ 115 08878 It's derivative is f'(x) = e«- 3 . S 5 Find the approximate root of xlogiox ~ 1.2 = 0 using Let the initial guess be 0.5. ‘secant method upto 3 decimal places of accuracy. — (2087 aa w]e | fed | 080) | xe =e Solution oni 1 |os |o14e7 -13512| 0.6100 fx) =alogix-12=0 2 |0.6100\0.0103 -1.15947] 0.6189 (ato tahis peat ha Zand 3 3 |0.6127\0.008 -1.14294| 0.6127 Calculating (2) = -05979 <0 (Le. ve) (3)=023123> (8.0) 4 [0.6127|0.0035, -1.1428| 0.61903 {2)-42)<0 (oe) wich imps thatthe oot et 5 |o.6190/0.000035 | -1.1428| 0.61906 87 ho aera agg We find the value same upto 4 decimal place at 4 and 5 iteration. So, root of f(x) = e* - 3xis 0.6190, an roar OSes Solution of Nonlinear Equations|31] C—O using the bisection method, find a reat r of th eal root of the cateatate 8" gecima equation (0) = 3x -VT¥ sing g accurate of" decimal points, ‘orrect up to three method - — _ 2072 erin cotton solution rhe given equation is eo x)= 3x- VE + sink a abguess bea Lot the initial guess be 0 and 4 S qoy=-} . qqu)= 1.9913 <0 0176(48) Here, {(0) * (1) < 050 the root lies in between 0 & 1 070 Now by tabular form, : a { a b as e 7 0s 0.4956 5 0 [0.5 0.25 -0.2522 - I 0.25 10.5 0375 |o.1217 mais lo9s7s 025 [0375 |o3i2s |-ooesz : alias Josias oss Jo3736 oozes fH : 7 Taos a7 To. ee 0.3125 (0.3438 0.3282 |-0.0184 Tose 0922 | 03282 |o3438 |osze6 fooost + ; Conn a _ Jesse 0.32282 0.3360 0.3321 |-0.0066 : 0.3321 0.3360 |0.3341 |-o.0008 (0.3341 [0.3360 0.3351 [0.0022 (0.3341 0.3351 {0.3460 0.00639 12 Joss41_|o3346 oases [oooor | 0.9981 one (0.9961 10.9961 0.9971 Jo9971 [ogee (0.9976 L 12 [o9971 [09976 [o9976 From the above table we see that the root of given equation is 0.3344. At 119 and 12° iteration value of x has similar value therefore the root of given equation is 0.9976, 132] Insights on Numerical Methods ‘Solution of Nonlinear Equations|33) Let initial guess be -2 & 0 {(xs) =-f(-2) = 3.38 f(x) = f(0) f(x) «fa) tion method myosin Dise! 0 [3.3884 x | te) | fe) | fo |3 -0.9391 [2 |o 0.9391 |-3 “1.4424 |-1.8088 | 3 [09391 [1eoae |-r4424 laioze ba2920 cootlies between 2 &2.5 t 25)<0son [ 4 |-1.8088 |-12929 |21026 |-0.3569 |-1.3677 | [ 5 |-1.2929 |-1.3677 |-0.3569 |-0.0739 |-1.3872 [6 1.3677 |-1.3872 |-0.0739 |3.3311 |-1.3863 2375 | 7 [13872 |-1.3863 Jo.03331 |-0.0027 5 23 1.3863 t L 2312s [2375_|23438_f Since, 5! and 6 iteration the value of x, has same value “paq38 2375 (23594 | up to 4 decimal place so the root of given equation is 7094 12375 jp3672 -1.38637. 2375 [23711 2375 |2.3731 75 9, Find the real root of the equation sinx + 3x-2=0 correct to six decimal using fixed-point iteration 237912375 237481 |. method. {2074 Bhacra} 23731_|23741 (23736 Solution: 27% 237123739 0 Given equation is wz [237% [23739 |23738 From the 11% & 12* iteration the value of xq has f(x) = sinx + 3x-2=0 Separating the variable x, same vase upto three decimal places so x} x - 11 20) ee taste oot 23738, 2-sinx 3 x= B(x) where g(x) = 2= Sit ‘Solution of Nonlinear Equations [35] neh cle Be 6 [0.7187 |0.6875 _ 7 0.6875 L [3 0.6953 yea76i4 [9 [0.6992 |o.6953 1 annie (0662987 | 10__|0.6972 [o. _ Pe 2009 _| I 6963 0. | ~jnso2987 086280 [ose loses louse on 62809 j0.662810 since, at 11" iteration the value of a & b has identical to 09620107 ’ upto 3 decimal places so the root of equation is 0.6963. 5 [ossz610 an i the value Of Kopi IS he root of the equal 1, Find a real root of the equation 3x + the ro to 3 decimals using false-position (regula-falsi) method. — {2076 Ashwin, 2079 Ashwin} mod rb asin, Since, at iteration 4 sp to.6® decimal places. S 2 0s 0.662810. root af the equation x¢sinx-ee bisection method, lution: ode * ee Given function is correct to 3 decimals using 2 f(x) = 3x sinx-e* Let the initial guess be 1 & 2, (2) = 13541 (1) =0.2991 Here, f(x:).£(x2) < 0 (-ve) So the root lies between 1 & 2. Solution: i equation ffx)=¥sine-e142=0 Let’ cose two guess be O and 1. f{t) = -07008 (-ve) 0)» 1 (ove) to) ce 0) =-¥e a | navn u x.) [peste oem er betwnen 10 1 2h 1.1809 pene | E be = 2] 2 [11809 [1.3318 |o.2307 + los _|oasa4 3 | 27 [13318 [1.4290 [01373 _| 075 |-0.1096 4 | 2 [14290 [1.4016 - [0.0706 lnezs o.z60 [Ls | 2 Irssie [15073 |o0336 losers joo169 {6 | 2 [15073 [15192 loose “lorie? ~T-ooass 7 | 2 [15192 [1.5246 |ooo7 Solution of Nonlir ear Equations|37| ere form 11% and 120 iteratio Sih tere 7 root of equation f(x) = 0 print Incorrect i guesses” Goto3 EndIf 5. Do xq = Xo — ((ox0 = X21) * F%0))/ (£00) ~ £0) If (x0) * £02) <0 pensrts fel [aj +5 [-02se6 [12 __ “ys MEX [2 fos (075 (0.674496 oe Ts 'los 0750-625 [0.161026 Gem Fy Tos__os25 |os62s_{-0. 06055 ag While abs (f(x2)) > © ' [7s |ose25 10.625 (0.59375 _|0.047308 1g Jo-s62s (059375 Jos7e12s |-7.3535 17 [0.570125 Jos9375 1058593 (0.01979 {@ Joss7e125 Josese3 [056209 [6.16 10° [9 Tos:7e125 |0.58209 |0.s80100 |-4.99 « 10" F fo Jos 80100 os8209 |ose1095 |2.923 « 107 [ir Josios _[o581095)0.50059_|1.198 x 10° [2 Joscor {oseoso [oseose [323% 10% 6, Print root as x: 7. Step mn sinx + cosx + e*- 8=0 correct upto 3 decimal Ja. Find a real root of equatio using Bisection method places. Solution: Given equation sone is sinx + cosx + e*~ Fonction of Nontinesr Equations|391 738] insights on Numerical Methods ) <0.sothat @ liss7s 19453 [1.9454 the root ofthe given ee 0.0080 Here the value of is same for last 7% and 8% iteration Hence the solution ofthe function f(x) Bis 19454 Solution: X + COsK + er i 1S. Write a pseudo-code to find real root of a non-linear quation using secant method, 078 Kari, 279 Basha Pseudo-code to find real root of a non-linear uation using secant method: les derivative is 1 Stan £9 K-13 ; Define function as (x) Let the initial gress be 0.5 1 Input 2 ida pssst "| = | mo | ree 1 Tolenbleerore, 1] os | azersea_|-1779425| _o@z7006 € Maximum eran 2 |6278%6] -0.00699 |-1.807443] 0624167 | 6999s 100 4 ‘Stina E 3 {0624187|-0.00000456|-1.898437] _o.6za1e45 _|-as644» 10 Mon counter step= 1 4 [0624105] -oo0000108|-1.024435] _o.czaie4s | 1.0088 » 10 401 eset on Ramana eiogs Do If fx) = fe) Print “Error” Stop End if ffxz)x1 - fa )xe (2) ~ fu) xi =x & Ifstep >N x =% Print “Not Convergent" Stop Endif While abs f(xs) > e 6. Print root as x2 7. Stop Te. Using Newton Raphson mahed Gee 16, Using Newton-Raphson method, find the positive root of cosx .3x correct upto six decimal places. [2079 Baiehakny Solution: Given, f(s) = cosx - 1.3x Solution of Nonlinear Equations|41] «decimal place at 624184, Let us assume initial guesses so that the root lies 1.3xis 0. t between two guess. (2) = 7.38 (1) = -4.2815 re upto 0sx- Here f(2) f(1) < 0 so that the root of the given equatic lies between ‘I’ &'2', ni orbisection method n a b Xn f(s) ‘Algorithm aa gerror (E) Al 1 2 15 -0.1429 1 bet i uss 2 15 2 175 | 3.11445 2, Sean viene 3 15 175 1625 | 1.36983 3, Find {0 fx) othen root doesn't lie betwe 4 15 1.625 | 1.5625 | 0.58580 4. ne) otherwise 5 15 | 15625 | 153125 [0.21467: 5. mr cothenset a= 8D 6 15, 153125 | 1515 | 0.03418 aes i 15 1515_| 15075 | -0.05834 setaemeb=X |e 15075 | 1515 | 1.51125 |-o.0157: 6 ing ota =a fd) 9 151125 |_ 1515 | 15131 | 5.6168 sie) then 10 1.51125 1.5131 1.5121 | -0.00521 7. Mis) > 0 (Le, positive), M1 15121 | 15131 | 15126 - Set b= Xo 0.000365 Otherwise Here, the value of x» is same for three decimal places i 10% & 11" iteration. Hence the solution of the functio fQ9) = x8 + e* - cos(x) ~ 7 is 1.512. 19. Write a program code in C/C* for finding a real roo of a non-linear equation using the secant metho with provision for handling problematic conditio like division by zero and infinite iterations. feo Baisna Solution: Find a real root of the following equation ¢OH three decimal places using the bisection Program code in C for finding a real root of a non linear equation using the secant method: Ce ne Solution of Nonlinear Equations|43 Given function is (x) = + e*~ cos(x) 7 nio.h? include coon" sincude iol? nh include aaetne 9) ae iin ( ye Define equation ' C printf ('not convergen Fonts E mee \ ) intstep= Ni ; prim nent nee \n"} scant ("HF 90" &x0, axl): a ome, penne ceptable error E: \n") Se scanf{"96F BE); oe C preter maximum iteration: \n"); Ff scani("96d" &N) ee pin \estep 0 2 VEE) 70, Write a pseudo-code to find a real root of a non ( _linear equation using false position method. poe shin i Solution: " Pseudo-code to find a real root of a non-linear 0); ten sl equation using false position method: 1. Start : f= f(x); if(fo==f1) 2. Define function f(x) print(("\n mathematical computation failed” : a a a, lower and upper guesses xo and x ; b. tolerable error e x2 = x1 ~ (x1 - x0) * F1/(Al - £0); eo Slam Print "Incorrect initial guesses” Drinf("d \t \t 96F\ESAF EF. 6F\n step, x0, x1, x2, £2) ee x0= x1: ia = {44{ tnsghts on Numerical Methods Se _ ie SOLUTION OF SYSTEM OF LINEAR ALGEBRAIC EQUATIONS ‘analysis of linear equations is very important in gineering and science. Many real world problems are linear sr can be approximated linearly as well, Determining the qutput of @ manufacturing plant, analysis of an electrical network and electronic circuits, estimating the cost of a product in a factory subjected to various constraints, etc. need fo ind the solution of linear algebraic equations. net EndIf hile abs fx) ? © 6. Print root as%2 7, Stop. Ga real root of the following equation Linear equations having n variables take the form 1 pace eee rapt ‘An example of a linear equation with variables x and y is 4 3x4 2y=4 eens St There are two basic methods to solve systems of linear —() algebraic equations 1 (-ve) + Elimination method f{1) =17 (ove) Gauss elimination method Now. 20290- Fay, *108) Gauss elimination with pivoting method fila» | go) oe Gauss-Jordon method ji] o [4 A 171 LU decomposition method [2] 1 Tose) 171 0.4685 | 05032 Matrix inverse method | 3 |03676] 05032] 04665] 0.1674 | 0.5785 erative method iz | 0032 | 05785 | -o1674 0.03200 | 0.56651. [5 [0575 jesse 0.93200 | 1.68765 OSS L6 {0.56651/0.56711|-1.66765) — 5} -1.58064 | 0.56712 + Jacobi iteration method + Gauss-Seidel method 34 Gauss Elimination Method Hence, from the above iteration We find the root of given equation xe* = cosx is 0.5671, In Gauss elimination method, the unknown values are ‘lminated successively and the system is reduced to a upper 46| insights on Namaral ly a sy Methods SS repel hpeieg ene te Solution of System of Linear Algebraic Equations |47| onsider a system of linear equations xe auytanz=d x4 any + ant = di We first write the augmented matrix as: reduce form. fa aw aids) > Grz) Now, the unknown values are evaluated using backward substitution as auz= db 4 or2= 4 any tanz= ds ‘Since z is already known, we can calculate y. anx+ any +ay2= ds , Since y and z are already known, we can calculate x. Solve the system of linear equation by using Gauss elimination method. 2xi+ 204126 4x; + 2x2 + 3x3 148] insights on Numerical Methods ne unknown values are det hen, the wi ng sy performing sequence of row operations, we the augmented matrix to get in the following pee e augmentei 22 1:6 3:4 (4-1 1:0 4 matrix of piven syst stem i Elimination of'x’ from second and thirg and third row, applying Ro— Re~ 2Ry, Ry Ry 2 22 1:6 0-2 1:-8 \o -2 05:-: Eliminating 'y' from third row Applying Rs — Ri ~ (22 1:6 0-2 1:-8 0 0 -1/2:5 Using backward substitution, From Rs: sles que xs=-10 From Ro: -2xa + x3 = 8-10 nF From Ri; Ix; + 2xz + x= 6 2x, =6+2+10 med “oution of System of near Algebra Equations 491 ‘Solution: ‘The augmented matr 14 a5 (123) \g4 aa/ Eliminating ‘2’ in Rs and, “Applying Rx» Re Ro, Ro > Ri~ ORS 25 0:4 a7 7 -6:-36 3-1-4 ‘Elimination y in Rz, xx of given matrix is 5 Applying Rs Ri~7Re my7 0 0:119/7 17-7 (0:36 3-2 nth Using forward substitution From Rix = 2 a 150] Insights on Numerical Methods ae ‘The pivot element is the element of a matrix, which is jected firstby an algorithm to do certain calculation. We have oo they are: x= 16479 prom Re: “17+ 7y=-36 y=-1140 prom Rs: 3X-y-2=4 = 2.0845 1.6479 Gauss Elimination Method with Pivoting Strategies pes of pivoting strategies in Gauss elimination method i, Partial pivoting ii, Complete pivoting partial pivoting: The following are the steps followed by partial pivoting method: Find the largest absolute value in the first column of the augmented matrix and exchange the first row with row containing the largest absolute value. by Eliminate the x from remaining rows by row and column operation. 1d the largest absolute value in the second diagonal position leaving ess for a Now fin column and locate it in the 4 row and keep doing the same Proc: respective column. @. Continue the process the variables so that gauss forw method can be applied. for (n - 1) column eliminating ard elimination as using partial pivoti Mave the inear a0 pede 5 3x, + 28:7 38 : ee Solution: ce augmented form she given matrix int (3.2 -3:6/ ; ‘ 1 the largest abst checking the 2 clomn fo se a co wh TOM saa pest ae Here in column FEL Ro is pee oon becuse 3s te ares element 4 Rok 32-36 (; 35:3 (a -12 ; step 2: liminatingxin 24 3% FOW Applying Re Ro Ry R~9R 32 -3:6 05/3 7:-7 0 1/3 0:0 Step 3: Checking for largest value in column second and exchanging. Ry is pivot equation so, it is not needed to exchange because itis already in required position. 752} insights on Numerical Methods a Linear Algebraic Equations) 53 1 gRR-5 applvin 32 73:6 {oss 7-7 \g 0 -7/5:7/5 now applying backward substitution methods, from Roi a rom Rei 5/30* 78 wel = 5 = complete pivoting: Following are the steps followed by complete pivoting: a, Find the largest abst from the augmented column so that the appears as first element of the augme b, Follow the same process aS of method, ‘lute value among all the values ‘matrix and exchange row and largest coefficient of unknown nnted matrix. partial pivoting Note: For complete pivoting, the whole matrix system iS pivoting zone. Solution of Syste of linear equi yystem folowing SY" saive the f complete pivolné gue ays 207? fonesye4n= 16 axe 6y +226 — Solution: | 232:2) } 10 3 4:16 suep 1: Locating the largest values among: rep 1: Loca interchanging FOW. Rie 10s 416 | 2322 \3 6 1:6 Suep 2: Eliminating 1* variable in Rand Rs Alvng Re Ro— AER, Ry-¥ R= GER W346 (: 12/5. 6/5:-6/5 © 51/10 -1/5:6/5 ‘Aga interchanging Rs and Ry 3 416 (' 51/10 1/5:6/5 0 12/5 6/5:-6/5 AppbyingRs +B, ‘541 ison Ramat ge y1o 3 4:16 {9 sis10 -1/5:6/s (ig 0 22/17:-30/17 sy backward substitution method, From Re: 2n/17 2= -30/7 =-15/11 From Re: 51/10y - 2/5 = 6/S y=2/id From Rr 10x+3y+4z=16 40x+3«2/11 +4 x-15/11=16 x= 230/11 x 10= 23/11 y=2/11 =-15/11 ‘33_Gauss-Jordan Method In Gauss-Jordan method (which is a application of Gauss climination method), the augmented matrix is converted into a agonal matrix rather than a triangular matrix. Consider a system of linear equations, auxt any +az= di ax + any + a2 = de ank+ any + anz= dy Ws augmented matrix is: au az asi dy Aa azz az d2 @31 32 asa: dy Solution of System of Linear Algebrale Equations|55] colum! jowing f + he following for™ \o 9 49:58 applying Ri Ri # BR, Ry—> Ry~9Ry 10 420:421 01 58:59 \o 0 -473:-473 applying Rs Ro/-473 10 420:421 Jo1 58:59 salve the f Gauss jordan me loo at tox ty* . ea0y* Applying Ri—> Ri ~ 420 Ry, Rr Re BBR says (: 00:1 Solution 10:1 ‘te augmented form ofthe above equatl (oon 10 1 1:12 ‘The required solution is } 2 10 4:13 xl i 14 8:7 yat Now, applying Rs # Rs ~9Rs zl sae 44 inverse of Matrix using Gauss-Jordan Method iste Applying Gauss-Jordan method inverse of a mats at 11 8:7 vedetmined A matrix X i std to be inverse of Ail AK 1 Appling Re Re=2Rs, Ry» Ro~Ps erga unit matrix, Let us assume the following form for Toa aes finding inverse of a matrix. 0 26 89:15 an aw ay\ (x1 xn x) (100 0 9 49:58 an an am || x01 x2 x [=| 010 fay yz asx 7 \ Xai X32 X88 oot 756] sighs on Namek sees canton of Sytem aver Misra Eavatos1°7

You might also like