dimanche 25 septembre 2016

Python - how do I use while statement and if,else statement to solve this?

This was a problem that I was given

I'm just starting Python and cant really figure out How I can use while loop and if/else loop to solve the question

Approximate solutions of the equation f(x) = 0. One begins with a guess x0 for a solution to the equation. Given the approximation xn, one obtains the next approximation using the formula formula Where f’ is the derivative of f. What a program that uses this method to approximate a solution of the equation x3 – 3 = 0. Notice that the solution is the cube root of 3. The program should - prompt the user for values of x0. - calculates the solution until x3 – 3 < 0.00001 . - output the solution of the equation and the value of n for each loop.

I would really need some help here thank you! Explanations are welcome!

Aucun commentaire:

Enregistrer un commentaire