Project DescriptionAlgebraic 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
http://maxima.sourceforge.net/ (many thanks for the people behind this project]
Silverlight
I am please to say that I've made a silverlight console
http://algebra.lostparticles.netso 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.
First Method:
Use Parse Method
var p = SymbolicVariable.Parse("x+x*y+(a-b)^3");
Console.WriteLine(p.ToString());
Second Method
- 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;
Console.WriteLine(ab.ToString());
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");
Assert.AreEqual("2*x", a.ToString());
var b = (x.Power(2) + x.Power(3) + x.Power(4)).Differentiate("x");
Assert.AreEqual("2*x+3*x^2+4*x^3", b.ToString());
var c = (x.Power(2) * y.Power(3) * z.Power(4));
var dc_z = c.Differentiate("z");
Assert.AreEqual("4*x^2*y^3*z^3", dc_z.ToString());
var d = (x.Power(3) * y.Power(-40))+(y.Power(3)*z.Power(-1));
var dd_y = d.Differentiate("y");
Assert.AreEqual("-40*x^3/y^41+3*y^2/z", dd_y.ToString());
var e = x.RaiseToSymbolicPower(2*y);
var de_x = e.Differentiate("x");
Assert.AreEqual("2*x^(2*y-1)*y", de_x.ToString());
Function derivation
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 :) )
Quantity System
If you liked this library, make sure you review its usage into Quantity System Calculator
http://QuantitySystem.Codeplex.com which implement symbolic and numerical calculations by blending them together with the aid of units.