Is it possible to enter equations in to python program. As an example if I have set equations as below. Is it possible to enter those equations as a user input using input command.
ex: 1/x - 5/a + 2x^2 (a is a constant value)
1/x + 10x/a^2 - x^2/a^3 + 3x^2
(all equations have one variable 'x')
I now how to define equation using following command. But I want to input that equation as user input.
def my_function(x):
return(1/x + r^2/a -5x^2)
my_function(value for x)
Because I want to solve each equation for longer range of x value. I can write separate program for each equation. But I prefer to give the equation as user input.
Can any one give me a direction to go?