# Indefinite Integral in Programming

Tags:
1. Apr 6, 2015

### TheDemx27

I've been contributing to an open source calculator, and I wanted a way to take integrals of functions. I suppose you could implement a definite integral function by using Riemann Sums, but I can't find any way to implement indefinite integrals (or derivatives for that matter).

I've heard that functional programming is more adapt to abstract manipulation of mathematical models, for instance haskell, but I'm really not all too familiar with functionally programming at all. I'd like to stay within OOP.

Does anyone know of any methods one could use to take indefinite integrals?

2. Apr 7, 2015

sage

3. Apr 7, 2015

### fluidistic

See http://www.apmaths.uwo.ca/~arich/, especially http://www.apmaths.uwo.ca/~arich/IntegrationRules/PortableDocumentFiles/PortableDocumentFiles.html.
The guy created a set of rules for integration for many integrands (which apparently outperforms both Maple and Mathematica CAS's by far). So in a way the program doesn't compute the primitive of 1/x, it is just instructed to return "Log(x)" for that particular integral.

Edit: Here's Maxima's source code: https://sourceforge.net/p/maxima/code/ci/master/tree/src/. I am not familiar with it, but try to check out how the symbolic integrations are performed. Maybe search for "antideriv" in this file: https://sourceforge.net/p/maxima/code/ci/master/tree/src/defint.lisp. Also check this file: https://sourceforge.net/p/maxima/code/ci/master/tree/src/expintegral.lisp.
In addition Maxima has a mailing list where the programmers would likely be happy to guide you in your quest.

Last edited: Apr 7, 2015
4. Apr 7, 2015

### Fooality

Just to add on a warning, Maxima is pretty limited at integration, time and time again I end up using Wolfram's integral calculator.

Also, there's some existing GPL projects that work as a client to sage, like this:
I remember not being too impressed... If something like that could be merged with a straight up (not cloud based) scientific calculator and GPU based 2D and 3D grapher, I think you could get an incredible product for not too much work.

5. Apr 7, 2015

### SteamKing

Staff Emeritus
You could study the Risch algorithm:

http://en.wikipedia.org/wiki/Risch_algorithm

6. Apr 7, 2015

### TheDemx27

I kinda wanted to this on my own without dependencies, all in golang. This still looks pretty useful and I may some other time...

Despite being summarized in "more than 100 pages" this seems easier to implement than the approach Maxima has, which is pretty much the same approach I thought of. Also Maxima is written in some sort of lisp, which isn't very attractive imo.

7. Apr 9, 2015

### TheDemx27

I take that back.