Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (anonymous):

I am trying to write some code using Newton's Method to find a root (accurate to ten decimal places) for f(x) = 48x(1+x)^60 - (1+x)^60 + 1. Anyone want to help (It's in python)? Comment and I'll post what I have so far.

OpenStudy (anonymous):

Meh... I'll post it. import math """ Use Newton's Method in order to find the most accurate root to 10 decimal places of f(x). Given: f(x) = 48x(1+x)^60 - (1+x)^60 + 1 f'(x) = 12(1+x)^59(244x-1) x1 = 0.0076 x2 = x1 - (f(x1)/f'(x1)) """ x1 = 0.0076 f = 48*x1*(1+x1)**60 - (1+x1)**60 + 1 df = 12*(1+x1)**59*(244*x1-1) x2 = x1 - (f/df) dec_place = 10 while (math.floor(x1*10**10) != math.floor(x2*10**10)): x1 = x2 print x1 x2 = x1 - (f/df) print x2

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!