使用delphi计算出数学公式

H20986 2018-03-06 11:23:45
如何用Delphi来实现这个公式计算
...全文
1817 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hongss 2018-03-12
  • 打赏
  • 举报
回复
就是把公式翻译成Delphi语句的过程
DelphixpeFan 2018-03-07
  • 打赏
  • 举报
回复

unit TestCalMathMain;

interface

uses
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_σ: TcxSpinEdit;
cxSpinEdit_T: TcxSpinEdit;
Button1: 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;
begin
d1 := (ln(cxSpinEdit_S.Value / cxSpinEdit_L.Value) + ((cxSpinEdit_r.Value + (0.5 * sqr(cxSpinEdit_σ.Value)))
* cxSpinEdit_T.Value)) / (cxSpinEdit_σ.Value * sqrt(cxSpinEdit_T.Value));
Label_d1.Caption := format('d1 = %.4f', [d1]);
d2 := (ln(cxSpinEdit_S.Value / cxSpinEdit_L.Value) + ((cxSpinEdit_r.Value - (0.5 * sqr(cxSpinEdit_σ.Value)))
* cxSpinEdit_T.Value)) / (cxSpinEdit_σ.Value * sqrt(cxSpinEdit_T.Value));
Label_d2.Caption := format('d2 = %.4f', [d2]);
end;
  • 打赏
  • 举报
回复
并不复杂,加减乘除乘方开方对数

16,749

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧