solver | initial guess(es) | ea | number of iterations |
---|---|---|---|
falsepos | 0, 1.5 | 7.3639e-06 | 33 |
bisect | 0, 1.5 | 5.3981e-06 | 29 |
newtraph | 1 | 9.8618e-09 | 5 |
mod_secant | 1 | 7.9314e-06 | 10 |
Plot of convergence for four numerical solvers:
The files used to create the table above are looking for the roots or zeros of the function using the input arguments of an inital guess, the desired relative error, and the maximum number of iterations.
iteration | x_i | approx error |
---|---|---|
1 | 2 | 12.5 |
2 | 2 | 9.5703 |
3 | 2 | 7.8262 |
4 | 2 | 6.6491 |
5 | 2 | 5.7943 |
iteration | x_i | approx error |
---|---|---|
1 | 0.2 | 1.2e03 |
2 | 0.2 | 1.6531e05 |
3 | 0.2 | 4.5122e11 |
4 | 0.2 | 4.5122e11 |
5 | 0.2 | 4.5122e11 |
##Script that solves for xc:
for i= 0:90 theta= i*pi/180;
minimum_potential_energy= @(x_C) 0.5 * x_C*9.81*sin(theta) + 1/2*30 *(0.5 - sqrt(0.5^2+(0.5-x_C)^2))^2;
[C,fx,ea,iter]=goldmin(minimum_potential_energy,0,5,0.00001,50);
x_C(i+1)=C;
end