Skip to content

tinkerator/algex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • Rational polynomial factorization isn't yet implemented. Currently, we only cancel common simple numerical factors of the denominator and the numerator, and whole copies the numerator and denominator. Example:
$ ./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
  • A LaTeX mode for rendering an expression.

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.

About

Symbolic algebra manipulation packages with examples

Resources

License

Stars

Watchers

Forks

Packages

No packages published