Math help needed - Warning complex equation!!....read only if brain is in stable conditon

Mark Jackson mjackson at alumni.caltech.edu
Thu Feb 6 11:59:57 EST 2003


Michael Hudson <mwh at python.net> writes:
> mjackson at alumni.caltech.edu (Mark Jackson) writes:
> 
> > jranchordas at hotmail.com (Jay) writes:
> > > right, now that I got your attention, I need help on the following
> > > piece of python code:
> > > 
> > > distance = 1.15 * (180 * (acos((sin(pi * lat1 / 180) * sin(pi * lat2 /
> > > 180)) + (cos(pi * lat1 / 180) * cos(pi * lat2 / 180) * cos(pi * (lon2
> > > – lon1) / 180))) / pi) * 60)
> > 
> > --^^-- what's this weird character here where a "-" ought to be?
> 
> The character displays as \226 in Gnus.  Hmm...
> 
> >>> unicodedata.name("\226".decode('cp1252'))
> 'EN DASH'

Thanks!  Gosh, I wonder how *that* could have happened. . . .

> I was quite pleased with myself when I tried that :-)

And I suspect the OP will be quite pleased when he replaces it with
'-'; with that single change the code executed fine for me.

-- 
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
	A retired physicist reading the /Encyclopaedia Britannica/
	can do just so much toward securing world peace.
				- Brian Hayes






More information about the Python-list mailing list