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

John Machin sjmachin at lexicon.net
Fri Feb 7 00:04:08 EST 2003


"Scherer, Bill" <Bill.Scherer at verizonwireless.com> wrote in message news:<mailman.1044543855.4699.python-list at python.org>...
> On 6 Feb 2003, Jay wrote:
> 
> > 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)
> > 
> > when trying to compile I get the error "SyntaxError: invalid syntax".
> 
> 
> [posted and mailed]
> 
> I'm thinking that what appears between lon2 and lon1 is a typo or 
> a character encodeing issue; I interpreted it as just "^", and 

Hooooeeee this "new math" is really something else. When I went to
school, we weren't taught anything like applying an exclusive-or
operator to a pair of angles. Looks like I got a whole heap of
catching up to do.

>>> 60 ^ 70
122 # now what in tarnation does that mean? 122 degrees?

Seems I won't be alone in the little rad schoolhouse; Guido ain't
heard o' this new-fangled notion, either:

>>> 60.0 ^ 70.0
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: unsupported operand type(s) for ^: 'float' and 'float'

... or is the operation defined only for integral values of longitude?




More information about the Python-list mailing list