[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Classic game LUNAR and G=1E-03



In article <X8GdnaWU6dQsfn3WnZ2dnUVZ_rYAAAAA@giganews.com>,
 "Michael J. Mahon" <mjmahon@aol.com> wrote:

> John B. Matthews wrote:
> > In article <H7mdnd0vhda2wn3WnZ2dnUVZ_qmdnZ2d@giganews.com>,
> >  "Michael J. Mahon" <mjmahon@aol.com> wrote:
> > 
> >> BTW, does anyone recognize these power series?  The first is:
> >>
> >>      Sum (n=1 to 5) (x^n/n)
> > 
> > This looks like the Maclaurin series for -ln(1 - x):
> 
> Excellent!
> 
> So line 420 could be more efficiently (and more accurately)
> written as:
> 
> 420 Q=S*K/M: J=V+G*S+Z*log(1-Q)

That looks right.

> > and the second is:
> > 
> >      Sum (n=1 to 5) (x^n/(n*(n+1)))

This might be -ln(1 - x/2), so perhaps

430 I=A-G*S*S/2-V*S+Z*S*(log(1-Q/2)):RETURN

Here's the graphs, first pair in red:

<http://i43.tinypic.com/2eltdsi.png>

Original code:

<http://www.moorecad.com/classicbasic/basic/creative/lunar.bas>

Does anybody see a better candidate function?

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>