Question on Converting a String into an Algorithm / Equation

I am considering writing a personal program that uses Newton's Method to compute the second and third approximations of a root.

The formula is x2=x1-(f(x))/(f'(x))

I would like the prompt to be "Enter the equation/expression: "

I know how to program everything, except for how to turn a string of numbers and letters (user-defined variables) into an equation the program understands, to replace f(x) in my pre-defined formula.

Any suggestions?