Root finding program Newton's Method?

I need help writing a root finding problem using Newton's Method for the following equation:
y = sin(x) − 0.15x + 1.5
I want to use a tolerance of 1.0e-4 and double precision to find all roots (5 total) of the equation.

I would like some assistance on how to go about writing the derivative function to better understand the main program too. Any help is appreciated.

Thanks!
Cynthia JoubiAsked:
Who is Participating?
 
BigRatCommented:
I presume that you mean sin(x) - 0.15x + 1.5 = 0?

But oh my! How Fortran has changed since my day :

https://users.soe.ucsc.edu/~dongwook/wp-content/uploads/2015/ams209/lectureNote/_build/html/chapters/chapt02/ch02_fortran_example.html

http://faculty.washington.edu/rjl/classes/am583s2013/notes/fortran_newton.html

This is a bit more old fashioned (you'll need to change the real*8)

http://jean-pierre.moreau.pagesperso-orange.fr/Fortran/newton1_f90.txt

Incidentally the derivative is cos(x) -0.15.
0
 
Cynthia JoubiAuthor Commented:
Thank you BigRat for the information! It really helped me and I think I got a working code.
Much appreciated.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.