Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses GraphABC;
- type realFun= real -> real;
- procedure DrawGraph(f:realFun; a, b, d:real);
- begin
- var k:= (window.Width div 2) / (b - a);
- coordinate.SetOrigin(round(window.Width div 2 - (b + a)*k), window.Height div 2);
- Line(0, -300, 0, 300);
- Line(-600, 0, 600, 0);
- for var i:= floor(a) to ceil(b) do
- Line(round(i*k), -3, round(i*k), 3);
- var x:= a;
- var y:= f(x);
- pen.color:= Color.Red;
- while x < b do
- begin
- Line(round(x*k), round(y*k),
- round((x + d)*k), round((f(x + d))*k));
- x+=d;
- y:= f(x);
- end;
- end;
- begin
- DrawGraph(x -> x, -10, 5, 0.1);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement