Package import"zappem.net/pub/math/algex"
Documentationhttps://pkg.go.dev/zappem.net/pub/math/algex
Sourceshttps://github.com/tinkerator/algex

Algex - a collection of Go packages for performing basic symbolic algebra

Overview

Algex is a collection of interdependent Go packages for performing basic algebra. The core functionality was developed to solve the inverse kinematics of a 6-axis robot. However, structuring it as a set of stand alone packages provided a motivation for expanding its capabilities.

How to use

The documentation for each of the packages can be found on go.dev via this top-level search: zappem.net/pub/math/algex.

The basic command line example is built as follows:

$ go build examples/algex.go
$ ./algex
> x:=a+b
> y:=a-b
> x*y
 a^2-b^2
> fn(x,y):=x-y
> list
 fn(x,y) := x-y
 x := a+b
 y := a-b
> fn(a,b)
 a-b
> fn(y,x)
 -2*b
> exit
exiting

Other included examples

The other included example is examples/ik.go which is the mentioned inverse kinematics algebra for the saxis robot:

$ go run examples/ik.go
... a lot of formulas (investigated and solved by hand) ...

Features planned

$ ./algex
> (x+y)*(x-y)/(x+y)
 x-y
> (x+y)/(x^2-y^2)
 1/(x-y)
> 2*(x+y)*(x-y)/(x^2-y^2)
 2
> (x+y)*(x-y)/(x+y)^2
 (x^2-y^2)/(2*x*y+x^2+y^2)
> exit
exiting

License info

The algex package is distributed with the same BSD 3-clause license as that used by golang itself.

Reporting bugs

Use the github algex bug tracker.


Markdown rendering courtesy of gomarkdown/markdown.