N
N
Nick Sl2022-04-11 23:08:52
Pascal
Nick Sl, 2022-04-11 23:08:52

I change the variable and an error occurs, how to fix it?

When replacing the variable grav. constant

Gmm:=6.672E-20
to the correct
6.67*exp(-11*ln(10))
, an error occurs. How to fix?

Program Gr01;

Uses GraphABC;

var x1, y1: Integer; key: boolean;
ax, ay, vx, vy, x, y, t, dt, pi, Gmm, M, r: real;
begin
  t:=0;   dt:=20;
  Gmm:=6.672E-20;   M:=5.97E24;
  x:=7000;  y:=0;   vx:=0;   vy:=10;
  Circle(320, 170, 32);
  x1:=Round(x/200); y1:=Round(y/200);
repeat 
 // setColor (0);
 Circle(320+x1, 170-y1, 2);
 r:=Sqrt(x*x+y*y);
 ax:=-Gmm*M*x/(r*r*r);
 ay:=-Gmm*M*y/(r*r*r);
 vx:=(vx+ax*dt);
 vy:=(vy+ay*dt);
 x:=x+vx*dt;
 y:=y+vy*dt;
 x1:=Round(x/200); y1:=Round(y/200);
 // setColor (2);
 Circle(320+x1,170-y1, 2);
 Sleep(5);t:=t+dt;
 until key;
 end.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kalapanga, 2022-04-12
@kalapanga

Why don't you write the "correct" constant in a readable form (6.67E-11)?
As for the error, most likely the dimensions of the quantities used did not lead to one system. If we take a constant in the SI system, then the masses should be in kilograms, distances in meters. First, check to see if you have it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question