Loading [MathJax]/jax/output/HTML-CSS/jax.js

Monday, January 28, 2013

Secant Method Exercise

This exercise is also on numericalmethods.xlsx

Given:  f(x)=x210x+9, find the roots using the secant method.

Computation:

1. We choose two points for x1 and x0.
2. Solve for the next points using the formula: xn=xn1f(xn1)xn1xn2f(xn1)f(xn1)

This formula is derived from getting the slope of the secant lines through the points (xn,f(xn)), (xn1,f(xn1)) and  (xn2,f(xn2)).

f(xn)f(xn1)xnxn1=f(xn1)f(xn2)xn1xn2

Since f(xn)=0, then
0f(xn1)xnxn1=f(xn1)f(xn2)xn1xn2

Solve for xn.

f(xn1)(xn1xn2)=(xnxn1)(f(xn1)f(xn2))f(xn1)(xn1xn2)f(xn1)f(xn2)=xnxn1xn1f(xn1)(xn1xn2)f(xn1)f(xn2)=xnxn=xn1f(xn1)(xn1xn2)f(xn1)f(xn2)

3. Continue to iterate until f(x)=0 or we've applied the stopping rules.

This is my answer.





I also applied secant method on f(x)=cos(x)x and arrived at this result.



So far in excel it works. How about applying these methods in Visual Basic? Will it work? What can be my possible problems?

No comments:

Post a Comment