Introduction
The article presents a library used for non linear system of algebraic equations. Such a library is of immense use for process and civil and computational engineers, for example, in problems related to fluid system simulation. This library uses Newton Raphson and Quasi Newton methods to solve non linear system of equations. It uses an equation parser class and linear algebra class which are presented before. Both the Newton Raphson and Quasi Newton methods are quite stable and can be applied to large systems.
Background
This library is developed while developing an application for a pipe network simulation program, but it finds use in many fields. The trial values for the variables are set randomly, which is not a good idea, but these trail values can be updated when needed. The following figure shows the convergence of a variable in Quasi Newton scheme.

Using the code
Consider a system of non linear equations as mentioned below:
A^2+B^3+logC-445 = 0
A^3+B^2+C-1149 = 0
A+2B^2+3C = 408
The following snippet of code obtains the value of variables as A=10, B=7 and C=100.
using System;
using VIJAY.MATH;
namespace Solver
{
class solver
{
[STAThread]
static void Main(string[] args)
{
string s1= "x0^2+x1^3+log(x2)-445";
string s2= "x0^3+x1^2+x2-1149";
string s3= "x0+(2*x1^2)+(3*x2)-408";
string[] S = {s1,s2,s3};
NonLinear.SetSystem (S);
double[] results=NonLinear.NewtonRapson();
}
}
}
Note that, the variables are identified as x0,x1,x2…etc by the system. The trail values for these variables are generated randomly. The number of iterations, accuracy required, and editing the trail values can be done as shown below:
Data.iterations=30;
Data.accuracy =0.001;
NonLinear.EditVariable ("x2",70);
Points of Interest
Both Quasi Newton and Newton Raphson schemes are stable. However, Quasi Newton Scheme is recommended when logarithmic functions are present in the system. The current library supports functions such as sin(), cos(), tan(), log(), ln(), exp() and the operators such as ^ (power). The function list can be further expanded. For some systems, the number of iterations and convergence criteria must be explicitly specified.
To Do
An exception handling mechanism must be included in order to deal with inconsistent systems.