Symbolic Computation Library in pure C

2020-02-25 11:02发布

问题:

Does there exist a symbolic computation library written pure C? Symbolic computation as in manipulating mathematical equations in symbolic form.

I know there is Mathematica, and Sympy. But, I am interested in creating in a high performance pure C implementation of a symbolic computation library to bind to a scripting language, specifically Ruby to start.

It would seem that their is a need for a symbolic mathematics library such this. Over time, ideally the library could be built out in a similar manor to libgit2 where there is a central C implementation of the project and various implementations branched off for the purpose of creating bindings to other languages?

回答1:

Have you taken a look at GAP? From its website:

GAP is a system for computational discrete algebra, with particular emphasis on Computational Group Theory. GAP provides a programming language, a library of thousands of functions implementing algebraic algorithms written in the GAP language as well as large data libraries of algebraic objects. See also the overview and the description of the mathematical capabilities. GAP is used in research and teaching for studying groups and their representations, rings, vector spaces, algebras, combinatorial structures, and more. The system, including source, is distributed freely. You can study and easily modify or extend it for your special use.

According to its Wikipedia page, GAP is implemented in C, and the source code is freely available.



回答2:

Mathomatic is implemented in C, and may suit your purposes.

Mathomatic™ is a portable, command-line, educational CAS and calculator software, written entirely in the C programming language. It is free and open source software (FOSS), published under the GNU Lesser General Public License (LGPL version 2.1), and has been under continual development since 1986. The software can symbolically solve, simplify, combine, and compare algebraic equations, simultaneously performing generalized standard, complex number, modular, and polynomial arithmetic, as needed. It does some calculus and is very easy to compile/install, learn, and use.

From the developer's manual:

The Mathomatic source code can also be compiled as a symbolic math library that is callable from any C compatible program and is mostly operating system independent.



回答3:

Please look at Axiom -- a general purpose Computer Algebra system. Also you can use Giac -- Giac is a free (GPL) C++ library, it is the computation kernel, it may be used inside other C++ programs.

http://www.axiom-developer.org/

http://www-fourier.ujf-grenoble.fr/~parisse/giac.html



回答4:

You can start with Maxima and use GCL to translate it from Common Lisp to C.

GCL is the official Common Lisp for the GNU project. Its design makes use of the system's C compiler to compile to native object code

There is surely an option to preserve the intermediate C source files.

GCL currently compiles itself and the primary free software Lisp applications, Maxima , ACL2 and Axiom, on eleven GNU/Linux architectures (x86 powerpc s390 sparc arm alpha ia64 hppa m68k mips mipsel), Windows, Sparc Solaris, and FreeBSD.