Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

gsl-delphi

GSL For Delphi

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

gsl-delphi

GSL For Delphi is a delphi header translation of GNU Scientific Library at https://www.gnu.org/software/gsl/ , lastest support version is 2.5+. Prebuilt 32bit windows dll also included in the bin folder.

To use gsl to do linear regression

pascal
procedure TFormMain.btnStatClick(Sender: TObject);
var
  I: Integer;
  X,Y:array [0..3] of Double;
  c0,c1, cov00, cov01, cov11, sumsq:double;
  std:Double;
  mean:double;  
begin
  for I := 0 to 3 do
  begin
    X[I]:=I;
    Y[I]:=I*1.23+3.64;
  end;

  gsl_fit_linear(@X[0], 1, @Y[0], 1, 4, @c0,@c1,@cov00, @cov01, @cov11, @sumsq );
  mean:=gsl_stats_mean(@Y[0], 1,4);
  std:=gsl_stats_sd(@Y[0], 1, 4);

end;