A user is allowed to enter any mathematical equation they like (with one variable):
x + 5
1 - x/2
(x/3) * (56/13)
Using eval function is very dangerous when you can't control the string argument.
Try Matex for safe mathematical formulas calculation. It supports also variables and custom functions.