Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- f(x)=x^4-20
- x0=2
- Ans:
- 2.125
- 2.1148166
- 2.1147425
- 2.1147425
- */
- function[] = newton_raphsons(f)
- x0=input('Value of x0: ')
- for i=1:4
- x=x0-(f(x0)/numderivative(f,x0))
- x0=x
- disp(x)
- end
- endfunction
- deff('y=f(x)','y=x^4-20')
- newton_raphsons(f)
Add Comment
Please, Sign In to add comment