passing a math function as input of a program
-
Hi i'm trying to write a program that compute integrals of functions of single variable f(x), the program will ask the user to enter the function for which he needs te compute the integral. my question is : once the user enter the function formula (for exemple: f(x)=log(x)+cos(1/x)), how can pass this formula to the program. thanks
-
Hi i'm trying to write a program that compute integrals of functions of single variable f(x), the program will ask the user to enter the function for which he needs te compute the integral. my question is : once the user enter the function formula (for exemple: f(x)=log(x)+cos(1/x)), how can pass this formula to the program. thanks
You can only pass that as a string, you'll obviously need to parse it from there. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001 Picture the daffodil. And while you do that, I'll be over here going through your stuff.
-
You can only pass that as a string, you'll obviously need to parse it from there. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001 Picture the daffodil. And while you do that, I'll be over here going through your stuff.
do you have an idea on how to parse it from string to math function. thanks
-
do you have an idea on how to parse it from string to math function. thanks
You're going to have to search the string for brackets, work out the order of operations, and then check for maths functions, and call them. The problem is quite simply that you're going to have to write code for each math function you want to support. Basically, it's not a pretty job. You may be able to do it easier by writing a macro. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001 Picture the daffodil. And while you do that, I'll be over here going through your stuff.
-
Hi i'm trying to write a program that compute integrals of functions of single variable f(x), the program will ask the user to enter the function for which he needs te compute the integral. my question is : once the user enter the function formula (for exemple: f(x)=log(x)+cos(1/x)), how can pass this formula to the program. thanks