# Calculus on C?

• 04-27-2002
Lynux-Penguin
Calculus on C?
Is it possible to write Calculus functions for C. IT would be very usefull, I am sure it is possible because there are math programs out there today.

like
int integrate(statement, int variable, int limit1, int limit2)
something like that
and have the power rule of integration apply
ux^n = [u(x)^(n-1)]/(n-1)

my question is, do you think it is possible for the console programming?
I know how to do the integrate function on ASM because of the functions of memory but on C, do you think it is possible (using the standard libraries of course)
• 04-27-2002
Sebastiani
Don't be ridiculous! Of course you could. Simply a matter of design...
• 04-27-2002
fyodor
originally posted by Lynux-Penguin
Quote:

ux^n = [u(x)^(n-1)]/(n-1)
Actually, that is differentiation, not integration (assuming you are attempting to integrate the left side and the result is the right side)

Anyways, it is incredibly hard (or it would be for me) to write a program that would symbolically integrate a function so that it is able to utilize substitution, integration by parts, and numerous other techniques. You would have to use some pretty damn complex pattern matching function, and a lot of other advanced goodies. A really weak analogy: integration is differentiation as factoring is to multiplication. All functions, no matter how complex, can be differentiated fairly easily using a simple set of rules, so one does not really have to make "decisions." Integration is far harder: Should I substitute u(x) for x^2+3? Maybe I need to call that u and sin x dv, so that int(udv)=uv-int(vdu)? Can i change this around so that it will fit the 1/(x^2+1), the derivative of inverse tangent? You see the point...

However, it is really pretty easy to numerically integrate a function, there exist many algorithms for doing this-they are all pretty much the same thing. I would suggest this as a way to "build up" to symbolic integration.