Math help needed - Warning complex equation!!....read only if brain is in stable conditon
Scherer, Bill
Bill.Scherer at verizonwireless.com
Thu Feb 6 09:22:42 EST 2003
More information about the Python-list mailing list
Thu Feb 6 09:22:42 EST 2003
- Previous message (by thread): Math help needed - Warning complex equation!!....read only if brain is in stable conditon
- Next message (by thread): Math help needed - Warning complex equation!!....read only if brain is in stable conditon
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 came up with this: Python 2.2.2 (#1, Oct 15 2002, 13:18:41) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-110)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from math import * >>> lat1, lat2, lon1, lon2 = 40, 50, 60, 70 >>> a = pi * lat1 / 180 >>> b = pi * lat2 / 180 >>> dist = 1.15 * (180 * (acos((sin(a) * sin(b)) + (cos(a) * \ ... cos(b) * cos(pi * (lon2 ^ lon1) / 180))) / pi) * 60) >>> >>> print dist 5286.53109574 >>> > > Uses Math libray, pi is a defined constant (lat1, lat2, lon1, lon2 are > variables - two sets of latitude and longitude values) > > Using Linux Red Hat 8.0, Python 2.2.2 > > I've counted the number of brackets (11 in total both sides) there and > they do match, so I can't really see anything obviously wrong with > this. > > there is a handsome reward available for the solution > provided....(hehehhe) > -- Bill.Scherer at Verizon Wireless RHCE 807101044903581
- Previous message (by thread): Math help needed - Warning complex equation!!....read only if brain is in stable conditon
- Next message (by thread): Math help needed - Warning complex equation!!....read only if brain is in stable conditon
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list