W
W
WhoAmI022020-10-01 20:38:25
Pascal
WhoAmI02, 2020-10-01 20:38:25

How to graph a function in PascalABC?

uses GraphABC;

begin
  
  SetWindowSize(500, 500);
  
   var x, y, dt, t, a,l: Real;
   write('a=');
   read(a);
   write('l=');
   read(l);
   
   dt := 0.001;
   t:= pi/2;
   
   while t < 3*pi/2 do
   begin
     x := a + l *cos(t);
     y := a * sin(t)/cos(t) + l * sin(t);
     SetPixel(250 + Round(x * 1200), 250 - Round(y * 1200), clBlack);
     t := t + dt;
   end;
  
end.


I'm trying to plot the Nicomedes conchoid using the equations x := a + l *cos(t);
y := a * sin(t)/cos(t) + l * sin(t);
Whatever values ​​are substituted, the error "Run-time error: Value was invalidally small or invalidly large for Int32" is thrown.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
HemulGM, 2020-10-01
@HemulGM

So debug
it See the value from your formula
5f761747aabfe717026605.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question