ISmNonLinearEquations.UseDerivatives

Fore Syntax

UseDerivatives: Boolean;

Fore.NET Syntax

UseDerivatives: boolean;

Description

The UseDerivatives property determines whether analytical derivatives are used in solution search.

Comments

Available values:

Fore 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;
    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;
    Eqs.CoefficientsOrder := 
"X1;X2;X3";
    inits[
0] := 10//x1
    inits[1] := 0//x2
    inits[2] := -1//x3
    Eqs.InitApproximation := inits;
    Eqs.MethodType := NonLinearEquationsType.HMethod;
    Eqs.UseDerivatives := 
True;
    Eqs.Tolerance := 
0.0001;
    res := Eqs.Execute;
    
If res <> 0 Then
        Debug.WriteLine(Eqs.Errors);
        
Else
            
For i := 0 To Eqs.Functions.Length-1 Do
                Debug.WriteLine((i+
1).ToString + ". " + Eqs.Solution[i].ToString);
            
End For;
    
End If;
End Sub UserProc;

After executing the example the console window displays a solution for a system of non-linear equations:

1. 14

2. 2

3. -7

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Stat;

Public Shared Sub Main(Params: StartParams);
Var
    Eqs: ISmNonLinearEquations;
    Funcs: Array [0..2Of String;
    inits: Array[0..2Of Double;
    res, i: Integer;
    Solution: System.Array;
Begin
    Eqs := New SmNonLinearEquations.Create();
    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;
    Eqs.CoefficientsOrder := "X1;X2;X3";
    inits[0] := 10//x1
    inits[1] := 0//x2
    inits[2] := -1//x3
    Eqs.InitApproximation := inits;
    Eqs.MethodType := NonLinearEquationsType.nletHMethod;
    Eqs.UseDerivatives := True;
    Eqs.Tolerance := 0.0001;
    res := Eqs.Execute();
    If res <> 0 Then
        System.Diagnostics.Debug.WriteLine(Eqs.Errors);
        Else
            Solution := Eqs.Solution;
            For i := 0 To Eqs.Functions.Length-1 Do
                System.Diagnostics.Debug.WriteLine((i+1).ToString() + ". " + Solution[i].ToString());
            End For;
    End If;
End Sub;

See also:

ISmNonLinearEquations