Some algebra functions done in C#