Хелпикс

Главная

Контакты

Случайная статья





while(y>0) do. whiley>=0 do. whiley>=0 do. while(t < tk) do



while(y> 0) do

begin

   a: =-g-k2/m*v*abs(v); //ускорение при силе сопротивления

v: =v+a*dt;

y: =y+v*dt;

t: =t+dt;

outres(t, y, clgreen);

end;

  end;

 

begin

  Init;

 Euler;

end.

 

3)под углом

program Fall;

uses GraphABC;

const dt=0. 001; g=9. 81;

Hu=0;

tk=200;

var Sx, Sy, ax, ay, y, x, vx, vy, t, v, Hv, alpha: real;

 

procedure out ( var x, y: real;

c: system. drawing. color);

begin

var u, v: integer;

u: =round(Hu+Sx*x);

v: =round(Hv-Sy*y);

PutPixel(u, v, c);

end;

 

procedure Euler;

begin

whiley> =0 do

begin

ax: =0;

ay: =-g;

vx: =vx+ax*dt;

vy: =vy+ay*dt;

y: =y+vy*dt;

t: =t+dt;

x: =x+vx*dt;

out (x, y, clgreen);

end;

end;

 

begin

v: =10;

alpha: =pi*40/180; vx: =v*cos(alpha);

vy: =v*sin(alpha);

t: =0; Hv: =Window. Height;

Sx: =Window. Width/10;

Sy: =Window. Height/10;

Euler;

end.

 

program fall;

uses GraphAbc;

const dt=0. 001; g=9. 81;

Hu=10; tk=5;

var Sx, Sy, y, x, vx, vy, t, v, alpha, ax, ay, dx: real;

Hv: =window. Height;

procedure out ( var x, y: real; C: System. Drawing. Color);

begin

var u, v: integer;

u: =Round(Hu+Sx*x);

v: =Round(Hv-Sy*y);

PutPixel(u, v, c);

end;

procedure Euler;

begin

whiley> =0 do

begin

x: =x+vx*dt;

y: =y+vy*dt;

v: =sqrt(sqr(x)+sqr(y));

vx: =vx+ax*dt;

vy: =vy+ay*dt;

ax: =0;

ay: =-g;

t: =t+dt;

out (x, y, ClBrown);

end;

end;

Begin

v: =10;

alpha: =(pi*40)/180; vx: =v*cos(alpha);

vy: =v*sin(alpha);

t: =0; Hv: =Window. Height;

Sx: =Window. Width/tk;

Sy: =Window. Height/10;

Euler;

End.

 

4)кеплер

program kepler;

uses

  GraphABC;

const

  GM = 4 * sqr(pi);

var

  x, y, t, tk, k, dt, vx, vy, ax, ay, r, w, v, Hu, Hv, Sx, Sy: real;

procedure Init;

begin

  k: = sqrt(2);

w: = 0. 1;

x: = 1;

y: = 0;

v: = 0;

dt: = 0. 00001;

tk: = 2;

vx: = 0;

vy: = 2 * pi * 0. 9;

Sx: = Window. Width / 3;

Sy: = Sx;

Hu: = Window. Center. X;

Hv: = Window. Center. Y;

Line(0, round(Hv), Window. Width, round(Hv));

Line(round(Hu), Window. Height, round(Hu), 0);

Pen. Color: = clgreen;

end;

procedure OutRes(x, y: real; c: color);

var

  v, u: word;

begin

  u: = round(x * Sx + Hu);

v: = round(-y * Sy + Hv);

PutPixel(u, v, c);

end;

procedure Euler;

begin

while(t < tk) do

begin

    r: = sqrt(sqr(x) + sqr(y));

ax: = (-GM) / (sqr(r) * r) * x; // - k * vx * abs(v) + w;

ay: = (-GM) / (sqr(r) * r) * y; // - k * vy * abs(v);

vx: = vx + ax * dt;

vy: = vy + ay * dt;

x: = x + vx * dt;

y: = y + vy * dt;

t: = t + dt;

OutRes(x, y, clred);

end;

end;



  

© helpiks.su При использовании или копировании материалов прямая ссылка на сайт обязательна.