Home > Back-end >  Using Delphi compute mathematical formula
Using Delphi compute mathematical formula

Time:09-17

How to use Delphi to implement this formula

CodePudding user response:

Power is not complicated, addition, subtraction, multiplication, and division prescribing logarithm

CodePudding user response:


 unit TestCalMathMain; 

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxGraphics cxControls, cxLookAndFeels cxLookAndFeelPainters,
CxContainer cxEdit, StdCtrls cxTextEdit, cxMaskEdit, cxSpinEdit, acPNG,
ExtCtrls;

Type
TForm1=class (TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
CxSpinEdit_S: TcxSpinEdit;
CxSpinEdit_L: TcxSpinEdit;
CxSpinEdit_r: TcxSpinEdit;
CxSpinEdit_ sigma: TcxSpinEdit;
CxSpinEdit_T: TcxSpinEdit;
For: TButton;
Label_d1: TLabel;
Label_d2: TLabel;
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;

Var
Form1: TForm1;

Implementation

{$R *. DFM}

Procedure TForm1. Button1Click (Sender: TObject);
Var
D1, d2: Double;
The begin
D1:=(ln (Value) cxSpinEdit_S. Value/cxSpinEdit_L. + ((cxSpinEdit_r. Value + (0.5 * SQR (cxSpinEdit_ sigma. Value)))
* cxSpinEdit_T. Value))/(cxSpinEdit_ sigma. Value * SQRT (cxSpinEdit_T. Value));
Label_d1. Caption:=format (' d1=%. 4 f '(d1));
D2:=(ln (cxSpinEdit_S. Value/cxSpinEdit_L. Value) + ((cxSpinEdit_r. Value - (0.5 * SQR (cxSpinEdit_ sigma. Value)))
* cxSpinEdit_T. Value))/(cxSpinEdit_ sigma. Value * SQRT (cxSpinEdit_T. Value));
Label_d2. Caption:=format (' d2=%. 4 f '/d2);
end;

CodePudding user response:

Is the process of translate formula into the Delphi statements
  • Related