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

How can I perform symbolic computation in a C++ program?

  1. Sep 10, 2014 #1
    Don't know where else in Phyiscs Forums or on the internet in general to ask this, and if it's inappropriate here, I apologize. My question is: is there an open source library or resource that I can access from a C++ program to perform symbolic computation on the level of something like Maple or Mathematica? Accessing the Maple or Mathematica engines from my program is unfortunately out of the question. There are numerous small C++ libraries (SymbolicC++, Mathomatic, Ginac, etc.) but they are almost trivial compared to Maple, for example. Thanks for any advice or ideas.
  2. jcsd
  3. Sep 10, 2014 #2


    Staff: Mentor

  4. Sep 11, 2014 #3


    User Avatar
    Science Advisor

    There is an open-source Python code called Sage that does symbolic computation. You could download this and study the code. It will be a major undertaking. The code is at:

  5. Sep 11, 2014 #4


    Staff: Mentor

    Alternatively, you might be able to invoke the SAGE python codefrom your program via a system() call (ie you construct a command to run) with your equation to parse, have it save its output to a file and then read it back in. Still it could be a lot of work but I guess it depends on what you're trying to do.
  6. Sep 11, 2014 #5
    You can try this.


    Mathematica has a built in C/C++ library function. Unfortunately, it is going to be hard to find something as powerful as that for open source CAS.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook