Indefinite Integral in Programming

Click For Summary

Discussion Overview

The discussion revolves around methods for implementing indefinite integrals in programming, particularly within the context of an open source calculator project. Participants explore various approaches, including the use of existing libraries and algorithms, while expressing preferences for programming paradigms such as object-oriented programming (OOP) versus functional programming.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant suggests implementing definite integrals using Riemann Sums but struggles with indefinite integrals and derivatives.
  • Some participants mention the potential of functional programming languages like Haskell for abstract mathematical manipulation, while others prefer to remain within OOP.
  • References to a set of integration rules created by a specific individual are provided, which reportedly outperforms traditional computer algebra systems (CAS) like Maple and Mathematica.
  • Links to Maxima's source code are shared, with suggestions to investigate how symbolic integrations are performed, particularly looking for the "antideriv" function.
  • One participant warns about the limitations of Maxima in integration tasks and mentions a preference for Wolfram's integral calculator.
  • Another participant introduces the Risch algorithm as a potential method for implementing indefinite integrals, noting its complexity but suggesting it may be easier than Maxima's approach.
  • There are expressions of interest in developing a solution independently without dependencies, specifically in the Go programming language.
  • A later reply retracts a previous statement about the ease of implementing the Risch algorithm.

Areas of Agreement / Disagreement

Participants express a variety of approaches and preferences regarding the implementation of indefinite integrals, with no consensus reached on a single method or solution. Disagreements exist regarding the effectiveness of different tools and algorithms.

Contextual Notes

Some participants express uncertainty about the capabilities of Maxima and the Risch algorithm, indicating that further exploration and understanding of these methods are necessary. Limitations related to programming language preferences and integration capabilities are also noted.

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   Reactions: 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   Reactions: 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.
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
2K
Replies
65
Views
5K
  • · Replies 4 ·
Replies
4
Views
8K
Replies
38
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 22 ·
Replies
22
Views
2K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 15 ·
Replies
15
Views
3K