Khaled Hello everyone i was wondering if it is possible to create a mathematical function in a C++ code. Basically what i am trying to do is a calculator, that would calculate the integral over a given interval for a certain function. Problem is, if i want to lets say create a cosine function, i couldn't find a way to define a whole function on an interval, instead of a specific cos(x) value on a specific x value. What i am basically asking is : Is there a way to actually create this ? or are there already built in function or the sort ? Thank you in advance for your help
geek see @artihma's small tutorial on function pointers. basically, you would use something like this: double integrate(double (*f)(double), double a, double b);
arithma Keep in mind geek's suggestion is a numerical solution, so there's no way around errors. You can of course try to interface with Maple or Mathematica for symbolic manipulation.
Khaled Thanks a lot for the reply guys and i am very sorry i took a lot of time to reply here, honestly speaking i stopped this for a while and will restart on this project in a week after my finals, then i may need your help again. Thank you a lot for your help