3 views

Original Title: Numerical Methods

Uploaded by ToànNguyễnKhánh

- ShootingMethodTutorial
- CHE555 Lesson Plan
- Newton's Method
- C.P.-2.4-D-EJE-5
- An Improvement to the QUEST Algorithm - Yang Cheng and Malcolm D. Shuster
- Matlab code.pdf
- Numerical Analysis Homework
- IJAIEM-2014-01-30-080
- SOLUTION METHODS AND STABILITY ANALYSIS.ppt
- CHAPTER_2_LOCATING_ROOTS_OF_EQUATIONS_T2_1415.pdf
- MidSemCBNST
- Assgn Numec Individu Kamil
- MCP Calculus Lab Manual - Contents_24 Apr 19.doc
- Elastic Collapse
- Solutions to Load Flow Problem
- Preface
- Prob_5_5
- Mesh Shape Preservation for Flow-Induced Vibration Problems
- Numerical JA
- syllabusICA1314new

You are on page 1of 6

Numerical Methods

One type of problem you'll see over and over again is solving for x where f(x) = 0. For example, find the

solution to

y = (x-2)(x+3)

y=5-x

You can convert this to f(x) = 0 by

Guess x

Solve for y in each equation

Take the difference

The solution is when the difference is zero:

f(x) = (x - 2)(x + 3) - (5 - x)

Graphical Solution:

Guess what the answer is and plot f(x) in this range. Note that it helps to know the answer

(approximately) to find the answer. A plot of f(x) is as follows:

-->x = [-5:0.01:5]';

-->y1 = (x-2).*(x+3);

-->y2 = 5-x;

-->f = y1-y2;

-->plot(x,f)

-->xgrid(5);

-->xlabel('x');

-->ylabel('f(x)')

January 3, 2011

NDSU

Numerical Methods

Interval Halving:

Specify to points:

One where f(x1) < 0

One where f(x2) > 0

Try the midpoint between x1 and x2.

x3 = (x1 + x2)/2

If f(x3) > 0, replace x2 with x3.

If f(x3) < 0, replace x1 with x3.

For example, let the initial guess be

x1 = -1

f(x1) < 0

x2 = +5

f(x2) > 0

-->x1 = -1;

-->f1 = (x1-2).*(x1+3) - (5-x1)

- 12.

-->x2 = +5;

-->f2 = (x2-2).*(x2+3) - (5-x2)

24.

-->x3 = (x1+x2)/2

2.

-->f3 = (x3-2).*(x3+3) - (5-x3)

- 3.

This is negative, so replace the left endpoint (x1) with x3 and repeat

-->x1 = x3;

-->x3 = (x1+x2)/2

3.5

-->f3 = (x3-2).*(x3+3) - (5-x3)

8.25

(Iteration 2): Now the midpoint is 3.5 and f() is positive. Replace the right endpoint with the midpoint:

-->x2 = x3;

-->x3 = (x1+x2)/2

2.75

-->f3 = (x3-2).*(x3+3) - (5-x3)

2.0625

(Iteration 3): Again, f() at the midpoint is positive, so replace the right endpoint

-->x2 = x3;

-->x3 = (x1+x2)/2

2.375

-->f3 = (x3-2).*(x3+3) - (5-x3)

- 0.609375

2

January 3, 2011

NDSU

Numerical Methods

(Iteration 4)

-->x1 = x3;

-->x3 = (x1+x2)/2

2.5625

-->f3 = (x3-2).*(x3+3) - (5-x3)

0.6914062

(Iteration 5)

-->x2 = x3;

-->x3 = (x1+x2)/2

2.46875

-->f3 = (x3-2).*(x3+3) - (5-x3)

0.0322266

Keep going until f() is close enough to zero. The answer is close to .246875.

California Method:

This is about the same as interval halving, but interpolate to find the next guess rather than using the

midpoint. For example, for the previous figure, you'd interpolate by assuming a linear relationship for

f(x) and find the zero crossing given the endpoints. In this case, you'd guess x = +1 (the zero crossing

assuming a linear interpolation between the endpoints.) Since f(x1) is negative, replace the right endpoint

and repeat.

x x

x 3 = x 1 f(x 22)f(x1 1 ) f(x 1 )

3

January 3, 2011

NDSU

Numerical Methods

-->x1 = -1;

-->f1 = (x1-2).*(x1+3) - (5-x1)

- 12.

-->x2 = 5;

-->f2 = (x2-2).*(x2+3) - (5-x2)

24.

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

1.

-->f3 = (x3-2).*(x3+3) - (5-x3)

- 8.

(Iteration 2): This doesn't give f(x) = 0, so keep iterating. Replace the left endpoint and repeat.

-->x1 = x3;

-->f1 = (x1-2).*(x1+3) - (5-x1);

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

2.

-->f3 = (x3-2).*(x3+3) - (5-x3)

- 3.

(Iteration 3): This doesn't give f(x) = 0, so keep iterating. Replace the left endpoint and repeat.

-->x1 = x3;

-->f1 = (x1-2).*(x1+3) - (5-x1)

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

2.3333333

-->f3 = (x3-2).*(x3+3) - (5-x3)

- 0.8888889

(Iteration 4): This doesn't give f(x) = 0, so keep iterating. Replace the left endpoint and repeat.

-->x1 = x3;

-->f1 = (x1-2).*(x1+3) - (5-x1)

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

2.4285714

-->f3 = (x3-2).*(x3+3) - (5-x3)

- 0.2448980

And so on. When you get close enough to f() = 0, you have fond the solution. It's close to 2.42857.

January 3, 2011

NDSU

Numerical Methods

Newton's Method:

With Newton's method, you just need an initial guess. Find the tangent at that point and see where it

intersects the axis. This is your next guess:

-->x1 = 4;

-->f1 = (x1-2).*(x1+3) - (5-x1)

13.

(Iteration 1): f() isn't zero, so find the tangent, find it's zero crossing, and take that as your next guess:

-->x2 = x1 + 0.001;

-->f2 = (x2-2).*(x2+3) - (5-x2)

13.010001

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

2.70013

-->x1 = x3;

-->f1 = (x1-2).*(x1+3) - (5-x1)

1.6909619

(Iteration 2): f() isn't zero, so find the tangent, find it's zero crossing, and take that as your next guess:

-->x2 = x1 + 0.001;

-->f2 = (x2-2).*(x2+3) - (5-x2)

1.6983632

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

2.4716605

-->x1 = x3;

-->f1 = (x1-2).*(x1+3) - (5-x1)

0.0524268

January 3, 2011

NDSU

Numerical Methods

(Iteration 3): f() isn't zero, so find the tangent, find it's zero crossing, and take that as your next guess:

-->x2 = x1 + 0.001;

-->f2 = (x2-2).*(x2+3) - (5-x2)

0.0593711

-->x3 = x1 - (x2-x1)/(f2-f1)*f1

2.4641109

-->x1 = x3;

-->f1 = (x1-2).*(x1+3) - (5-x1)

0.0000645

ans:

x = 2.641109

Note that Newton's method converges much faster and you don't need an initial guess that's above and

below zero. You do need an initial guess, however.

It helps to know what the answer is to find the answer,

Methods with the name of 'Newton' or 'Gauss' tend to be good methods to use.

January 3, 2011

- ShootingMethodTutorialUploaded byashwin802
- CHE555 Lesson PlanUploaded byMXR-3
- Newton's MethodUploaded byLee Chu Keong
- C.P.-2.4-D-EJE-5Uploaded byAlejandro Calderón
- An Improvement to the QUEST Algorithm - Yang Cheng and Malcolm D. ShusterUploaded byalvaroroman92
- Matlab code.pdfUploaded byalexwoodwick
- Numerical Analysis HomeworkUploaded byBracika
- IJAIEM-2014-01-30-080Uploaded byAnonymous vQrJlEN
- SOLUTION METHODS AND STABILITY ANALYSIS.pptUploaded bytech
- CHAPTER_2_LOCATING_ROOTS_OF_EQUATIONS_T2_1415.pdfUploaded byvignesvaran
- MidSemCBNSTUploaded byVibhor
- Assgn Numec Individu KamilUploaded byKamil Budiman
- MCP Calculus Lab Manual - Contents_24 Apr 19.docUploaded byajakuk
- Elastic CollapseUploaded byw824rg2
- Solutions to Load Flow ProblemUploaded bykhaldoun sami
- PrefaceUploaded byBamrung Sungnoen
- Prob_5_5Uploaded byrodrigo_0909
- Mesh Shape Preservation for Flow-Induced Vibration ProblemsUploaded bykhers_zal
- Numerical JAUploaded byyizzzus
- syllabusICA1314newUploaded byAakash Jain
- Chapter1_LP.pdfUploaded byraja89
- Solving Fredholm Integral Equations of the Second Kind in MATLABUploaded byAli Al-hamaly
- Num Scheme StabUploaded byrosendo rojas barragan
- AIAAJ-svUploaded byashishgupta02
- Schweiger(2002) Benchmarking_in_Geotechnics-1_Part-I.pdfUploaded byJiménez Jorge
- ksvmUploaded bybalta2ar
- Discontinuous Galerkin (IMA Journal)Uploaded byGsbriel Gsrcis
- 07_Appendix[1].pdfUploaded bymechgroupno5
- Optimal controlUploaded byMohsin
- Solution of the Diffusion Equation by Finite DifferencesUploaded byyy_yogesh007

- lLab 3 report ece 331Uploaded byToànNguyễnKhánh
- Final ece351Uploaded byToànNguyễnKhánh
- Semiconductors HomeworkUploaded byToànNguyễnKhánh
- 02 Scilab and VisSim.pdfUploaded byToànNguyễnKhánh
- Ronaldo - Ám ảnh về sự hoàn hảo - Luca CaioliUploaded byToànNguyễnKhánh
- Speaking Ielts Part 2 sampleUploaded byToànNguyễnKhánh
- Presentation Lecture1Uploaded byToànNguyễnKhánh
- Presentation Lecture03Uploaded byToànNguyễnKhánh
- Presentation Lecture4Uploaded byToànNguyễnKhánh
- Presentation Lecture03 (cont)Uploaded byToànNguyễnKhánh
- Presentation Lecture2Uploaded byToànNguyễnKhánh

- anskeyUploaded byLuis Vigueros Cárdenas
- Numerical Methods in MatlabUploaded byPranav Barve
- AdeUploaded byAbiola T Obembe
- Exercises on Transportation ProblemUploaded byalish8
- Computational Fluid Dynamics l t p c3 0 0 3Uploaded byAnto Mustangs
- Level Set SlidesUploaded byLuke Parry
- Neural Network Radial Basis Function classifier for earthquake data using aFOA .Uploaded byIJAR Journal
- ch2.pdfUploaded byVienNgocQuang
- Survey of Metaheuristics Solution MethodUploaded byJuan Sebastián Poveda Gulfo
- Lagrange MultiplierUploaded bynishantrun2
- Numerical Mathematics With MATLABUploaded byReza Abazari
- Handout_1.3_FEA_BigIdeas_WithoutNotes.pdfUploaded byEdgar Borja
- Lecture 3 - Interior Point Methods and Meggido’s AlgorithmUploaded bygdenunzio
- chpter 6 1Uploaded byNorizzatul Akmal
- integerprogramming-1Uploaded byGraham Aker
- RemaniFinalUploaded byPramesh Kumar
- ITTC procedure for cfd applicationUploaded bykyaw
- Karmarkar’s AlgorithmUploaded bySajal Agarwal
- Brown Genetic and Evolutionary AlgorithmsUploaded byamiteetumtech2013
- Lesson 37Uploaded byVanu Sha
- Numerical methods for high school kids-Secant methodUploaded byDr Srinivasan Nenmeli -K
- BTCS SlidesUploaded bySayan Roy
- Implementasi Jaringan Saraf Tiruan Dengan MATLABUploaded byUsep Siregar
- Back PropagationUploaded byCarlos Shacal
- AI AssignmentUploaded byRajeev Sahani
- cseUploaded bydis_2005
- Methods of Finding Solution of a Linear SystemUploaded byrauf tabassum
- ACKNOWLEDGEMENT ANN.docxUploaded byXtremeInfosoftAlwar
- 7.Fuzzy Neurons and Fuzzy Neural NetworksUploaded byANAND GOYAL
- matlab differential eq( Euler Method)Uploaded byesteban