So, I'm trying to make a program that works with Newton's method. I want the program to take in two formulas and a guess and then follow this pattern.
This is the pseudocode/python (I kinda did both):
[B]def[/B] newtonIterationFunction(x) [B]return[/B] x - (function1) / (function2) get function1 get function2 x = guess 99 times print "Iteration: " + i print "Guess: " + x xold = x x = newtonIterationFunction(x) [B]if[/B] x == xold print "Solution found!" [B]break out of loop[/B]
How could I parse the functions they enter? If they type in 3x^2 I need the function to be the actually multiplication of 3 times x squared.