// Walter Orlov, April 2004 import java.applet.*; import java.awt.*; public class appl3 extends java.applet.Applet { public void init() { setLayout(new BorderLayout()); setBackground(Color.white); } public void paint(Graphics g) { double R; double GM=100., m=1., dt=0.01, d=10., s=.02; double x0=120.,y0=0.,x,y,vx=0.,vy=0.67; int k, center = 150; g.setColor(Color.red); g.fillArc(center-10, center-10, 20, 20, 0, 360); // Aktion!!! g.setColor(Color.blue); for(k=0;k<440000;k++){ R = (x0*x0 + y0*y0 - d*d/4.)/(Math.sqrt(x0*x0 + y0*y0 + d*d/4.)); vx = vx - dt*GM*m*x0/(R*R*R); vy = vy - dt*GM*m*y0/(R*R*R); x = x0 + vx*dt; y = y0 + vy*dt; g.fillArc(center+(int)x,center-(int)y, 2, 2, 0, 360); x0 = x; y0 = y; // Hier Ausdehnung berücksichtigen d = d+s*GM*m*(1./(x*x+y*y-d*d)-1./(x*x+y*y)); } } }