2014 dxdy logo

Научный форум dxdy

Математика, Физика, Computer Science, Machine Learning, LaTeX, Механика и Техника, Химия,
Биология и Медицина, Экономика и Финансовая Математика, Гуманитарные науки




 
 Метод Лобачевского для корней полиномов
Сообщение15.03.2012, 04:00 
Помогите, пожалуйста, найти ошибки, считает вообще не правильно(((((
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids,Math;

type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Button2: TButton;
StringGrid1: TStringGrid;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}
{Function St(Value,Degree:Real):Real;
Begin
If Degree > 0 Then
St:=Exp(Degree*Ln(Value))
Else
St:=1/(Exp(Degree*Ln(Value)));
End; }

procedure TForm1.Button1Click(Sender: TObject);
Var
j,s,k,i,n,step,izo:Integer;
summ,akms,akps,b,hui:Real;
Aa,A,x:Array[0..1000] Of Real;
Begin
Step:=StrtoInt(Edit1.Text);
n:=step + 1;
For i:=0 To Step Do
Aa[i]:=StrtoFloat(StringGrid1.Cells[i,0]);
j:=2;
While j <= 128 Do
Begin
For k:=0 To Step Do begin
Summ:=0;
For s:=1 To k Do
Begin
If ((k-s)<0) Or ((k-s)>step) Then
akms:=0
Else
akms:=Aa[k-s];
If((k+s)<0) Or ((k+s)>step) Then
akps:=0
Else
akps:=Aa[k+s];
summ:=summ+power(-1,s)*akms*akps;
End;
j:=j*2;

A[k]:=Aa[k]*Aa[k]+2*summ;
end;
For i:=0 To Step Do
Aa[i]:=A[i];
end;



b:=1/128;

for i:=0 To step Do begin
hui:= Aa[i+1]/Aa[i];
x[i]:=power(hui,b);
end;

for i:=0 To step Do
Begin
izo:=i+1;
Label3.Caption:=Label3.Caption+'X'+inttoStr(izo)+'='+FloattoStr(x[i])+#13;
End;
Label3.CAption:=Label3.Caption+'Ïîäñòàâüòå êîðíè â èñõîäíîå óðàâíåíèå, ìåíÿÿ çíàêè êîðíåé íà ïðîòèâîïîëîæíûå, åñëè îíè íå îáðàùàþò åãî â òîæäåñòâî';
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
StringGrid1.Cells[0,0]:='1'; StringGrid1.Cells[1,0]:='1'; StringGrid1.Cells[2,0]:='1'; StringGrid1.Cells[3,0]:='1'; StringGrid1.Cells[4,0]:='-4';
end;

end.

 
 
 [ 1 сообщение ] 


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group