Algebraic calculation system implemented purely in C#.
I was inspired by the Ginac project http://www.ginac.de
to make this library
I've tested the library based on Maxima project
(many thanks for the people behind this project]
I am please to say that I've made a silverlight console
so beside using the console in the download, you can test quickly using the silverlight version.
enjoy this fine release :)
How to do calculation in your .net application
- Reference the dll into your project.
Use Parse Method
var p = SymbolicVariable.Parse("x+x*y+(a-b)^3");
- Instantiate a symbolic variable object with the symbol name.
- do calculations like the normal variables.
- result is obtained textual when you call ToString()
SymbolicVariable x = new SymbolicVariable("x");
SymbolicVariable y = new SymbolicVariable("y");
SymbolicVariable z = new SymbolicVariable("z");
SymbolicVariable t = new SymbolicVariable("t");
SymbolicVariable Zero = new SymbolicVariable("0");
SymbolicVariable One = new SymbolicVariable("1");
SymbolicVariable Two = new SymbolicVariable("2");
SymbolicVariable Three = new SymbolicVariable("3");
SymbolicVariable Four = new SymbolicVariable("4");
var a = x+y;
var b = x-y;
var ab = a*b;
What about derivatives?
Derivation has been implemented into the library.
Below is a code borrowed from the unit test project.
var a = x.Power(2).Differentiate("x");
var b = (x.Power(2) + x.Power(3) + x.Power(4)).Differentiate("x");
var c = (x.Power(2) * y.Power(3) * z.Power(4));
var dc_z = c.Differentiate("z");
var d = (x.Power(3) * y.Power(-40))+(y.Power(3)*z.Power(-1));
var dd_y = d.Differentiate("y");
var e = x.RaiseToSymbolicPower(2*y);
var de_x = e.Differentiate("x");
I've added function derivation in this release in the known functions
which means you can now derive sin and cos functions
but I think I missed other functions (please test and tell me :) )
If you liked this library, make sure you review its usage into Quantity System Calculator
which implement symbolic and numerical calculations by blending them together with the aid of units.