Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
roots_and_optimization/#homework3#.md
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
51 lines (36 sloc)
3.18 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# roots_and_optimization | |
Repository dedicated to roots and optimization resources, mainly homework. | |
Combining all of the root solvers, it was found that the universal root, representing theta, was 2.9655 degrees. | |
i. Compare the number of iterations that each function needed to reach an | |
accuracy of 0.00001%. | |
| solver | initial guess(es) | ea | number of iterations| | |
| --- | --- | --- | --- | | |
|falsepos | [1,20] | 1.2293e-06 | 6 | | |
|bisect | [1,20] | 9.5471e-06 | 26 | | |
|newtraph | 1 | 9.9567e-06 | 2055 | | |
|mod_secant | 1 | 2.3516e-07 | 5 | | |
##Plot of convergence for four numberical solvers | |
![Plot of convergence for four numerical solvers.](solvers.png) | |
In order to generate the plot above there were four root solver functions that isolated the root of the projectileV2 function from HW2. Each line represents each solver's number of iterations on the x-axis and the error estimation on the y-axis. The odd behaviour of the gold line is representative of the Newton-Raphson function. It is hypothesized that the behaviour is attributed to the new variable of d(height)/d(theta). | |
ii. Compare the convergence of the 4 methods. Plot the approximate error vs the | |
number of iterations that the solver has calculated. Save the plot as | |
`convergence.png` and display the plot in your `README.md` with: | |
### divergence of Newton-Raphson method | |
| iteration | x_i | approx error | | |
| --- | --- | --- | | |
| 0 | 2 | n/a | | |
| 1 | 2 | 12.5 | | |
| 2 | 2.5276 | 9.5703 | | |
| 3 | 2.7422 | 7.8262 | | |
| 4 | 2.9375 | 6.6491 | | |
| 5 | 3.1182 | 5.7943 | | |
iii. In the `README.md` provide a description of the files used to create the | |
table and the convergence plot. | |
###### Newton-Raphson Method | |
Iterative method to find the root of a polynomial equation. The method and its Matlab program is an approximation of the given function by tangent line with the help of a derivatvie, after choosing a guess value of the root which is relatively close to the real root. The x-intercept of the tangent is calculated by using algebra and this x-intercept is a better approximation of the root of the function. This is repeated until the root of the desired accuracy is found. | |
###### Modified Secant Method | |
The secant method estimates the point of intersection of the curve and the x-axis as accurately as possible. In order to do that it uses succession of roots of the secant line of the curve. This root finding method is faster than bisection method and does not require a derivative like Newton-raphson. | |
###### Bisection Method | |
This method is a closed bracket type that requires two initial guesses. It is based of the intermediate value theorem that states for a continuous function f(x), there exists a value c in the interval [a b] that is between the number f(a) and f(b). The convergence is linear and has good accuracy. However, it is considered to have a slow rate of convergence. | |
###### False Position Method | |
Similar to the other procedures, falsepos attempts to isolate roots of a continuous function. In doing so it attempts to isolate a zero by shrinking an interval around a given value. This method is effective as long as the intial guesses. If the root lies outside the interval, the result will be a local root and not a global root. | |