I am going to implement four iteration methods for finding the approximate solutions of equations of the form using the Wolfram Language, and also deploy these implementations to the cloud for the sake of those who do not have Wolfram Mathematica locally installed in their computers. The cloud deployment allows the user to test these implementations with just their web browsers.
This is the first series of this root finding article, it is based on the bisection method, while the other series will be based on the Newton method, Secant method, and the method of false position (Regula – Falsi)
Bisection Method
The bisection method is based on the repeated application of the intermediate value theoremIf the zero of a function lies in an interval , we bisect at the point . If replace the interval with ,that is else , then .Thus, the new interval also contains the zero of . Continuing this bisection process until , where is the degree of accuracy, we take the last midpoint as the desired zero (approximate solution) of the function.
Algorithm
- Inputs: Initial interval , .
- If , "Print Approximate solution may not exist in that interval". Goto 7. Else.
- Compute and
- While , If , , i.e , else , i.e .
- Goto 3. (* The loop continues until *).
- Stop
Wolfram Language Implementation
The code above is a procedural implementation of our bisection algorithm. In the code, we defined a function "bisect[fun,{var_Symbol,a_?NumericQ,b_?NumericQ},_]", where fun is the equation we want to find its approximate root, var is the variable in the function , and are the initial values of the interval where the zero of lies and is the degree of accuracy that we want, with default value .
Given that , we can say that the zero of lies the interval since .
Thus, we proceed to finding the approximate solution to using our implementation.
Wolfram Cloud Deployment
Clicking this link, you will be presented with a web form as pictured
For , enter the function you want to find its approximate root, is the variable in the function , and where the initial values of the interval where the zero of lies and is the degree of accuracy that you want, with default value . Then Submit.
After the form submission, comes the result
I really hope you find this interesting and important. Up next is the famous Newton method.
References
Jain, M., Iyengar, S., & Jain, R. (2010). Numerical Method for Scientific and Engineering Computation (5th ed.). New Delhi: New Age International.
Kreyszig, E. (2010). Advanced Engineering Mathematics (9th ed.). USA: John Wiley and Sons Inc.
Welin, P. (2013). Programming with Mathematica (1st ed.). New York: Cambridge University Press.
No comments:
Post a Comment