You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alg.math does concise formulas for custom types. Similar to operator overloading in other languages.
I'm making this for a private project which needs to do various types of algebraic math. Unless Alg takes on a life of its own, things will mostly be implemented whent I need them. Also I'm new to Zig and things are likely to not be idiomatic. Issues, comments, and requests are welcome, but will only be acted upon as I see fit.
Only a limited number of operations implemented so far.
There is no order of operations. All chained operations must be the same. Use parethesis to determine order. Eg, "(a * b) + c".
Chained operations are always carried out left to right. This may be inefficient for some equations, and not standard for others (eg, raising to a power).
All more complex types have a single underlying type, and all operations require the same underlying type between operands. Eg you can't add a matrix backed by floats with one backed by integers.
Implemented:
Matrices:
Define matrix in terms of rows, and columns.
Addition between matrices of the same size.
Multiplication with compatible shaped matricies resulting in a third, possibly differently shapped, matrix.
Multiplication with scaler values, which multiplies each value in the matrix by the scaler.
Imaginary Numbers:
Define in terms of real and imaginary parts.
Addition and Multiplication with other imaginary numbers.