I am having saving dynamic mathematical formula as string. I have two predefined functions like avg(A,B)
and best_of(1,A,B)
.The formula can consist of any mathematical operator, with nested parenthesis.
How do I execute the formula in ruby. The following are few formula formats,
avg(A,B,C)+D
best_of(1,A,B,C)+avg(D,E)
avg(best_of(1,A,B)+C+D)+E