Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Indefinite Integral in Programming

Tags:
  1. Apr 6, 2015 #1

    TheDemx27

    User Avatar
    Gold Member

    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. jcsd
  3. Apr 7, 2015 #2

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

  4. Apr 7, 2015 #3

    fluidistic

    User Avatar
    Gold Member

    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
  5. Apr 7, 2015 #4
    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.
     
  6. Apr 7, 2015 #5

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    You could study the Risch algorithm:

    http://en.wikipedia.org/wiki/Risch_algorithm
     
  7. Apr 7, 2015 #6

    TheDemx27

    User Avatar
    Gold Member

    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.
     
  8. Apr 9, 2015 #7

    TheDemx27

    User Avatar
    Gold Member

    I take that back.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Indefinite Integral in Programming
  1. Root programming (Replies: 3)

  2. Explain this program. (Replies: 3)

  3. Programming languages (Replies: 16)

  4. HMI programming (Replies: 1)

  5. C++ program (Replies: 2)

Loading...