⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wnform.~pas

📁 随着我国经济的快速发展
💻 ~PAS
字号:
unit wnform;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Buttons;

type
  Twndata = class(TForm)
    input: TButton;
    x1: TEdit;
    x2: TEdit;
    x3: TEdit;
    x4: TEdit;
    x5: TEdit;
    x6: TEdit;
    x7: TEdit;
    x8: TEdit;
    x9: TEdit;
    x10: TEdit;
    y1: TEdit;
    y2: TEdit;
    y3: TEdit;
    y6: TEdit;
    y5: TEdit;
    y4: TEdit;
    y7: TEdit;
    y8: TEdit;
    y9: TEdit;
    y10: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    nhcs: TEdit;
    nihe: TButton;
    huatu: TButton;
    Label4: TLabel;
    scqx: TEdit;
    ndqx: TEdit;
    label5: TLabel;
    scwd: TEdit;
    scnd: TEdit;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    w: TEdit;
    l: TEdit;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    ml: TEdit;
    mg: TEdit;
    cl: TEdit;
    cg: TEdit;
    Edit1: TEdit;
    procedure niheClick(Sender: TObject);
    procedure inputClick(Sender: TObject);
  private

    { Private declarations }
  public
     edit:tedit;
    { Public declarations }
  end;

const
  N=10; Q=3;
type
   arr1=array[1..N]of single;
   arr2=array[1..Q,1..Q+1]of single;
   arr3=array[1..Q]of single;
var
  wndata: Twndata;
  x,y:arr1;
  m:integer; //ni he ci shu
  result:arr3;  //
  a:arr2;
  tempreture:real;
  i:integer;

procedure nihe(m:integer;  var result:arr3);
function outputresult(m:integer; result1:arr3;x:real):real;
function wendu(l:real):real;
function qiumi(mi:integer;x:real):real;
implementation
uses majform,cybform;

{$R *.dfm}

procedure nihe(m:integer;  var result:arr3);
var
 i,j,k,r:integer;
 t,l:real;
begin
 wnform.result[3]:=3;

  for i:=1 to m+1 do
      for j:=1 to m+2 do
         a[i,j]:=0;

  for i:=1 to m+1 do
    begin
      for k:=1 to N do
        a[i,m+2]:= a[i,m+2]+ y[k]*exp((i-1)*ln(x[k]));
      for j:=1 to m+1 do
        for k:=1 to N do
          a[i,j]:= a[i,j]+exp((i+j-2)*ln(x[k]));
    end;{得到a[]}

  for k:=1 to m do
     begin
       t:=0;  r:=0;
       for i:=k to m+1 do
         if abs(a[i,k])>t then
           begin
             t:=abs(a[i,k]);
             r:=i;
           end;
       if r<>k then
         for j:=k to m+2 do
             begin
              t:=a[k,j]; a[k,j]:=a[r,j]; a[r,j]:=t;
             end;

       for i:=k+1 to m+1 do
           begin
             l:=a[i,k]/a[k,k];
             for j:=k+1 to m+2 do
                a[i,j]:= a[i,j]-l*a[k,j];
           end;
     end;
    {hui dai guo cheng }
  for k:=m+1 downto 1 do
    begin
     if k>m then
       result[k]:= a[k,m+2]/a[k,k]
     else
       begin
        t:=0;
        for j:=k+1 to m+1 do
          begin
           t:=t+a[k,j]*result[j];
           t:=a[k,m+2]-t;
          end;
          result[k]:= t/a[k,k];
        end
    end;
end;

function qiumi(mi:integer;x:real):real;
var
  i:integer;
  t:real;
begin
  t:=1;
  for i:=1 to mi do
     t:=t*x;
  qiumi:=t;
end;

function outputresult(m:integer; result1:arr3; x:real):real;
var
  i,j:integer;
  t,s,m1:real;
begin
  m1:=ln(x);
  s:=0;
  for i:=1 to m+1 do
    begin
      t:=qiumi(i-1,m1);
      s:=s+result1[i]*t;
    end;
    if m=1 then
      outputresult:=exp(s)
    else
      outputresult:=s ;
end;

function wendu(l:real):real;
var
  t1,t2,t3,t:real;
begin
   t:=strtofloat( major.dwtd.Text)/100;
   wndata.w.Text:= floattostr(strtofloat(wndata.ml.Text)*strtofloat(wndata.cl.Text)+
                   strtofloat(wndata.mg.Text)*strtofloat(wndata.cg.Text));
  t1:=strtofloat(wndata.w.Text)*t/(strtofloat(major.crxs.Text));
  t2:=1-exp(-strtofloat(major.crxs.Text)*l/strtofloat(wndata.w.Text));
  t3:=strtofloat(major.jdwd.Text)-t*l;
  wendu:=t1*t2+t3;
end;
procedure Twndata.niheClick(Sender: TObject);
begin
  x[1]:=ln(strtofloat(x1.Text ));
  x[2]:=ln(strtofloat(x2.Text ));
  x[3]:=ln(strtofloat(x3.Text ));
  x[4]:=ln(strtofloat(x4.Text ));
  x[5]:=ln(strtofloat(x5.Text ));
  x[6]:=ln(strtofloat(x6.Text ));
  x[7]:=ln(strtofloat(x7.Text ));
  x[8]:=ln(strtofloat(x8.Text ));
  x[9]:=ln(strtofloat(x9.Text ));
  x[10]:=ln(strtofloat(x10.Text ));
  y[1]:=ln(strtofloat(y1.Text));
  y[2]:=ln(strtofloat(y2.Text));
  y[3]:=ln(strtofloat(y3.Text));
  y[4]:=ln(strtofloat(y4.Text));
  y[5]:=ln(strtofloat(y5.Text));
  y[6]:=ln(strtofloat(y6.Text));
  y[7]:=ln(strtofloat(y7.Text));
  y[8]:=ln(strtofloat(y8.Text));
  y[9]:=ln(strtofloat(y9.Text));
  y[10]:=ln(strtofloat(y10.Text));

  m:=strtoint(nhcs.Text);
  wnform.nihe(wnform.m,wnform.result );


{shu chu jing yan gong shi}
   for i:=1 to m+1 do
    begin
       if i=1 then
          scqx.Text:='y='+floattostr(wnform.result[i])
       else
          scqx.Text:= scqx.Text+'+('+floattostr(wnform.result[i])+'x^'+inttostr(i-1)+')';
    end;
{mi,zhi shu xing jing yan gong shi }
  if  m=1 then
    ndqx.Text:='y='+floattostr(exp(result[1]))
               +'x^'+floattostr(result[2])
  else  ndqx.Text:=''
end;

procedure Twndata.inputClick(Sender: TObject);
var
  canshu:real;
begin
  canshu:=strtofloat(l.Text);
  scwd.Text:=floattostr(wendu(canshu));
  m:=strtoint(nhcs.Text);
  scnd.Text:=floattostr(wnform.outputresult(m,result,strtofloat(scwd.Text)) );
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -