Indefinite Integral in Programming

AI Thread Summary
The discussion centers around the challenge of implementing indefinite integrals and derivatives in an open-source calculator project. The contributor expresses a preference for object-oriented programming (OOP) over functional programming, despite recognizing that functional languages like Haskell may be better suited for mathematical abstractions. Suggestions include using Riemann Sums for definite integrals and exploring existing resources like Maxima, which has a set of integration rules that outperform traditional computer algebra systems like Maple and Mathematica. The Maxima source code is recommended for studying symbolic integration methods. However, there are warnings about Maxima's limitations in integration capabilities, with some users preferring Wolfram's integral calculator. The Risch algorithm is also mentioned as a potentially easier method for implementing indefinite integrals, despite its complexity. The discussion highlights a desire for a standalone solution without dependencies, specifically in Go programming language.
TheDemx27
Gold Member
Messages
169
Reaction score
13
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?
 
Technology news on Phys.org
sage
 
TheDemx27 said:
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?
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:
  • Like
Likes TheDemx27 and Fooality
fluidistic said:
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.

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:
https://play.google.com/store/apps/details?id=org.sagemath.droid&hl=en
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.
 
TheDemx27 said:
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?

You could study the Risch algorithm:

http://en.wikipedia.org/wiki/Risch_algorithm
 
  • Like
Likes TheDemx27
Simon Bridge said:
sage
Fooality said:
Also, there's some existing GPL projects that work as a client to sage
I kinda wanted to this on my own without dependencies, all in golang. This still looks pretty useful and I may some other time...

SteamKing said:
You could study the Risch algorithm:

http://en.wikipedia.org/wiki/Risch_algorithm
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.
 
TheDemx27 said:
this [Risch algorithm] seems easier to implement
I take that back.
 
Back
Top