Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daninet/ginac-wasm
WebAssembly bindings for the GiNaC computer algebra system
https://github.com/daninet/ginac-wasm
algebra calculator cas ginac math mathematics symbolic system wasm webassembly
Last synced: 10 days ago
JSON representation
WebAssembly bindings for the GiNaC computer algebra system
- Host: GitHub
- URL: https://github.com/daninet/ginac-wasm
- Owner: Daninet
- License: gpl-2.0
- Created: 2021-10-25T16:14:36.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-11-05T18:01:55.000Z (about 3 years ago)
- Last Synced: 2024-04-23T02:28:00.706Z (8 months ago)
- Topics: algebra, calculator, cas, ginac, math, mathematics, symbolic, system, wasm, webassembly
- Language: C++
- Homepage: https://daninet.github.io/ginac-wasm
- Size: 2.15 MB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
README
# GiNaC-WASM
WebAssembly bindings for the [GiNaC computer algebra system](https://www.ginac.de/)Demo frontend: https://daninet.github.io/ginac-wasm
## Usage
```js
const { initGiNaC, getFactory } = require('ginac-wasm');(async () => {
const GiNaC = await initGiNaC(require.resolve('ginac-wasm/dist/ginac.wasm'));
const g = getFactory();console.log(
GiNaC([
// 2 * 3 = 6
g.mul(g.numeric('2'), g.numeric('3')),
// x + 2x = 3x
g.add(g.symbol('x'), g.mul(g.numeric('2'), g.symbol('x'))),
// (2*sin(x))' = 2*cos(x)
g.diff(g.mul(g.numeric('2'), g.sin(g.symbol('x'))), g.symbol('x')),
// internal parser of GiNaC
g.parse('x^3 + 3*x + 1')
]),
);console.log(
GiNaC([
g.numeric('2'),
g.numeric('3'),
// reference first and second items from the array => 2*3 = 6
g.mul(g.ref(0), g.ref(1))
]),
);// besides the string output format,
// it can also generate traversable json structures
console.dir(
GiNaC([
// 2*sin(x)
g.mul(g.numeric('2'), g.sin(g.symbol('x'))),
], { json: true }),
{ depth: null }
);
})();```
For more details, see the [source code](https://github.com/Daninet/ginac-wasm/tree/master/demo) of the demo frontend app.