Dedicated to the memory of a Great Mathematician, a beautiful mind, John Forbes Nash.
Newton's Method
The newton method also known as the Newton-Raphson method is another important iterative method for solving equations , here is assumed to have a continuous derivative .
The derivation of this simple method (with great speed) can be looked up from textbooks as we are only concerned with the implementation of the method using the Wolfram Language.
Algorithm
- Inputs: .
- For , compute
- Stopping Criteria: If , stop computation and Print .
- Print .
Wolfram Language Implementation
Code 1 (newton)
This implementation defines a function "newton[fun, {var_Symbol, init_?NumericQ}, n_Integer]", where fun is the function we want to find its approximate solution, var is the variable in the function , init is the approximation and n the number of iterations we want, the program terminates after iteration(s), then outputs the approximate solution .
Code 2 (newton1)
This second implementation, slightly different, defines a function "newton1[fun, {var_Symbol, init_?NumericQ}, _0.0001]" with , the degree of accuracy with default value . The program terminates at any point where the absolute value of and returns .
If , we can find the approximate solution of using an initial approximation .
Using the first implementation, we have
And for the second implementation,
Having any difficulty understanding the implementations? You can definitely drop a comment at the comment section. I will be glad to be at your service.
Wolfram Cloud has won me over, i want everyone to have a feel of what these implementation does. Despite not having Mathematica installed on your PC, you can test the implementation. This time, I'm going to embed the cloud deployment here, you don't have to leave this place. Its very easy. Follow me.
Wolfram Cloud Depoyment
Below is the embedded cloud deployment, very easy to use. You only have to enter the appropriate values in the text boxes and click the Submit button, anything else is automatic.
Still need a link to the cloud deployment? See it here. Will be back with Secant. Drop a comment.
References
Jain, M., Iyengar, S., & Jain, R. (2010). Numerical Method for Scientific and Engineeing Computiation (5th ed.). New Delhi: New Age International.Kreyszig, E. (2010). Advanced Engineering Mathematics (9th ed.). USA: John Wiley and Sons Inc. Wellin, P. (2013). Programming with Mathematica (1st ed.). New York: Cambridge University Press.
Weisstein, Eric W. "Newton's Method." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/NewtonsMethod.html
No comments:
Post a Comment