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

In summary, there are many small C++ libraries that can be accessed from a program, but it may be a lot of work to try to use them to do something as powerful as what is available in Mathematica.
  • #1
Andrew732
9
0
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.
 
Technology news on Phys.org
  • #3
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:

www.sagemath.org/
 
  • #4
phyzguy said:
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:

www.sagemath.org/

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.
 
  • #5
You can try this.

https://code.google.com/p/remote-maxima/

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.
 

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

1. What is symbolic computation?

Symbolic computation is the process of manipulating mathematical expressions and equations in a computer program, rather than performing numerical calculations. It involves treating variables, functions, and mathematical operations as objects that can be manipulated symbolically.

2. Can I perform symbolic computation in a C++ program?

Yes, C++ has built-in capabilities for performing symbolic computation. However, it does not have a dedicated library or module for this purpose, so it may require some additional coding and understanding of mathematical concepts.

3. How do I represent mathematical expressions in a C++ program?

In C++, mathematical expressions can be represented using various data types such as integers, floating-point numbers, and characters. You can also use the built-in complex type for handling complex numbers. Additionally, you can create your own data types and operators to represent specific mathematical concepts.

4. Are there any libraries or tools available for performing symbolic computation in C++?

Yes, there are several libraries and tools available for symbolic computation in C++. Some popular options include the sympy library, the GiNaC library, and the symbolicc++ library. These libraries provide functions and algorithms for manipulating mathematical expressions and solving equations symbolically.

5. What are the benefits of using symbolic computation in a C++ program?

Symbolic computation allows for more flexible and accurate mathematical calculations, especially when dealing with complex equations and functions. It can also save time and effort by automating the process of simplifying and solving equations. Additionally, using symbolic computation in C++ can improve the readability and maintainability of your code.

Similar threads

  • Sticky
  • Programming and Computer Science
Replies
13
Views
5K
  • Programming and Computer Science
Replies
15
Views
2K
  • Programming and Computer Science
Replies
29
Views
3K
  • Programming and Computer Science
Replies
3
Views
3K
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
21
Views
12K
  • Programming and Computer Science
Replies
14
Views
4K
Replies
2
Views
143
Replies
16
Views
2K
Back
Top