From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,c212e60d58417232 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-12 06:29:25 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.moat.net!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 12 Mar 2004 08:29:24 -0600 Date: Fri, 12 Mar 2004 09:29:23 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: [OT] Hints for an algorithm - avoiding O(n^2) References: <5d6fdb61.0403120115.7c102e3c@posting.google.com> <7j5s2c.32r.ln@skymaster> <1Yi4c.85891$dP1.243229@newsc.telia.net> In-Reply-To: <1Yi4c.85891$dP1.243229@newsc.telia.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: NNTP-Posting-Host: 24.147.77.160 X-Trace: sv3-ZS41X5sZmDglnBM7hHBWd7C3BZG7rytuu14c3LiVPIdMME3fjA/2QLg/ibHvvGOPdXfoj0sIjuvyP+M!E1qGBHxeTw2zfOnPWEQhxK5DmE5X4wGd6f2po2jkV+6CWI9eD//0ADZYYoK3KA== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:6273 Date: 2004-03-12T09:29:23-05:00 List-Id: Bj�rn Persson wrote: > If that were true, the moon would orbit the sun and not the Earth (if we > ignore the rest of the universe). Actually it does. If you compute the gravitational force of the Earth on the Moon, and compare it to the gravitational force of the Sun, the Sun has a much greater effect. In fact, the orbit of the Moon around the Sun is everywhere convex. However, back to the OP's question. The first thing you want to do is not use brute force, but use Runga-Kutta for each pair of objects. This makes the calculation about ten times as complex, but gives a much better fit. Second when two objects are "close" you should do the Runga-Kutta interpolation much more often. This usually means calculating the effects of all gravitational attractions on the objects that are in close proximity more often as well. (You don't have to do the reverse, because the effect of the two nearby objects on remote objects will be that of their center of mass.) Of course you also have to allow for the possibility that there are several objects that are gravitationally close. The normal way to do this is to, at the end of every major cycle look at the positions of all the objects, and decide which ones get the intermediate steps. It is not worth the effort to work with two pairs instead of four 'close' objects. -- Robert I. Eachus "The only thing necessary for the triumph of evil is for good men to do nothing." --Edmund Burke