unit Unit6; { This software has been designed and it is CopyLefted by Han de Bruijn: (===) @-O^O-@ #/_\# ### } INTERFACE uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, Grafisch; type TForm1 = class(TForm) Image1: TImage; procedure Toetsdruk(Sender: TObject; var Key: Char); procedure Scheppen(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; IMPLEMENTATION {$R *.dfm} procedure test(n : integer); { Test with known functions } var x,y,v : double; i,k : integer; begin with Form1.Image1.Canvas do begin { Orthogonal Hyperbola } Pen.Width := 2; Pen.Color := clBlack; x := 1/ymax; y := ymax; MoveTo(x2i(x),y2j(y)); i := x2i(x); for k := i to Wijd-1 do LineTo(k,y2j(1/i2x(k))); { Coordinate system, y=x } Pen.Color := clYellow; MoveTo(x2i(xmin),y2j(0)); LineTo(x2i(xmax),y2j(0)); MoveTo(x2i(0),y2j(ymin)); LineTo(x2i(0),y2j(ymax)); MoveTo(x2i(xmin),y2j(ymin)); LineTo(x2i(xmax),y2j(ymax)); { Numerical integration } Pen.Color := clRed; x := 1; MoveTo(x2i(x),y2j(0)); LineTo(x2i(x),y2j(1/x)); i := Round((xmax-1)*n); for k := 1 to i do begin MoveTo(x2i(x),y2j(0)); LineTo(x2i(x),y2j(1/x)); v := x; x := x + x/n; LineTo(x2i(x),y2j(1/v)); LineTo(x2i(x),y2j(0)); end; { Logarithm numerically } x := 1; y := 0; MoveTo(x2i(x),y2j(y)); for k := 1 to i do begin x := x + x/n; y := y + 1/n; LineTo(x2i(x),y2j(y)); end; { Logarithm analytically } x := 1; y := 0; MoveTo(x2i(x),y2j(y)); Pen.Width := 1; for k := x2i(1) to Wijd-1 do begin x := i2x(k); y := ln(x); LineTo(x2i(x),y2j(y)); end; { Its inverse numerically } Pen.Color := clGreen; Pen.Width := 2; y := 1; for k := 1 to i do begin y := y + y/n; MoveTo(x2i(-0.1),y2j(y)); LineTo(x2i(0.1),y2j(y)); end; x := 0; for k := 1 to 25 do begin x := x + 1/n; MoveTo(x2i(x),y2j(0)); LineTo(x2i(x),y2j(-0.1)); end; y := 1; x := 0; MoveTo(x2i(x),y2j(y)); for k := 1 to i do begin y := y + y/n; x := x + 1/n; LineTo(x2i(x),y2j(y)); end; { Its inverse analytically } Pen.Width := 1; MoveTo(x2i(0),y2j(1)); for k := x2i(0) to Wijd-1 do begin x := i2x(k); y := exp(x); LineTo(x2i(x),y2j(y)); end; { Refinement trapezium rule Pen.Width := 1; Pen.Color := clBlack; y := 1; x := 0; MoveTo(x2i(x),y2j(y)); for k := 1 to i do begin y := y*(1/n+sqrt(1+sqr(1/n))); x := x + 1/n; LineTo(x2i(x),y2j(y)); end; } end; end; procedure TForm1.Toetsdruk(Sender: TObject; var Key: Char); { On KeyPress } begin Exit; end; procedure TForm1.Scheppen(Sender: TObject); { At moment of creation } begin xmin := -0.1; xmax := 9; ymin := -0.1; ymax := 9; TV(Form1.Image1); ClearDevice; test(10); Form1.Image1.Picture.SaveToFile('prijs.bmp'); end; END.