ISmNonLinearEquations.CoefficientsOrder

Syntax

CoefficientsOrder: String;

Description

The CoefficientsOrder property determines the coefficients order.

Comments

If there are several coefficients, they are separated with semicolon.

Example

To execute the example, add a link to the Stat system assembly.

Sub UserProc;
Var
    Eqs: ISmNonLinearEquations;
    Funcs: Array[0..2Of String;
    inits: Array[0..2Of Double;
    res, i: Integer;
Begin
    Eqs := New SmNonLinearEquations.Create;
    // Set non-linear equations
    funcs[0] := "X1-22+0.5*X2-X3";
    funcs[1] := "X2-26.5+2*X1+0.5*X3";
    funcs[2] := "X3+9-X1+6*X2";
    Eqs.Functions := Funcs;
    // Set coefficient order
    Eqs.CoefficientsOrder := "X1;X2;X3";
    // Set initial approximations
    inits[0] := 10//x1
    inits[1] := 0//x2
    inits[2] := -1//x3
    Eqs.InitApproximation := inits;
    // Set system solving method
    Eqs.MethodType := NonLinearEquationsType.HMethod;
    // Execute calculation
    res := Eqs.Execute;
    If res <> 0 Then
        Debug.WriteLine(Eqs.Errors);
    // Display calculation results   
    Else
        Debug.WriteLine("Solution: ");
        Debug.Indent;
        For i := 0 To Eqs.Functions.Length - 1 Do
            Debug.WriteLine(i.ToString + ". " + Eqs.Solution[i].ToString);
        End For;
        Debug.Unindent;
        Debug.WriteLine("Actually used initial approximations:");
        Debug.Indent;
        For i := 0 To Eqs.InitApproximationActual.Length - 1 Do
            Debug.WriteLine(i.ToString + ". " + Eqs.InitApproximationActual[i].ToString);
        End For;
        Debug.Unindent;
    End If;
End Sub UserProc;

After executing the example the console window displays a solution for a system of non-linear equations and actually used initial approximations:

See also:

ISmNonLinearEquations