Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. uses GraphABC;
  2.  
  3. type realFun= real -> real;
  4.  
  5. procedure DrawGraph(f:realFun; a, b, d:real);
  6. begin
  7. var k:= (window.Width div 2) / (b - a);
  8. coordinate.SetOrigin(round(window.Width div 2 - (b + a)*k), window.Height div 2);
  9. Line(0, -300, 0, 300);
  10. Line(-600, 0, 600, 0);
  11. var x:= a;
  12. var y:= f(x);
  13. pen.color:= Color.Red;
  14. while x < b do
  15. begin
  16. Line(round(x*k), round(y*k),
  17. round((x + d)*k), round((f(x + d))*k));
  18. x+=d;
  19. y:= f(x);
  20. end;
  21. end;
  22.  
  23. begin
  24. DrawGraph(x -> x*x*x, -10, 10, 0.1);
  25. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement