I'm checking for zeros on all my divides, so hopefully that won't be a 
problem...

Thanks,
JS

Emily Berk wrote:

>One other thing which may be a problem once you've surmounted this one:
>
>For certain combinations of the distance, the latitude and longitude, the 
>product of those sin and cos functions that you are dividing by might equal 0.
>
>-- Emily
>
>At 01:26 PM 8/30/05 -0700, you wrote:
>  
>
>>>Jamey Saunders wrote:
>>>      
>>>
>>>>I have a bit of a problem with a pretty complicated mathematical
>>>>expression.  Basically, I'm trying to determine the initial heading
>>>>between two points on the globe using latitude and longitude of the
>>>>two points.  I already know the distance between the two ($miles).
>>>>
>>>>Here's the expression:
>>>>        
>>>>
>>$Hdg=2*M_PI-acos((sin($lat2)-sin($lat1)*cos($miles))/(sin($miles)*cos($lat1)));
>>    
>>
>>>>When I echo $Hdg, I see:
>>>>
>>>>-1.#IND
>>>>
>>>>If the expression was working, I should see something like 134.9 for
>>>>the following latitude/longitude combinations:
>>>>
>>>>$lat1 = 33.9780761
>>>>$lon1 = -83.9623772
>>>>$lat2 = 32.1950556
>>>>$lon2 = -81.8695556
>>>>$miles = 172.7381359
>>>>
>>>>I can't find any references to what #IND means, so if anyone out there
>>>>has any ideas, I'd be grateful.
>>>>
>>>>-JS
>>>>        
>>>>
>>--- Brian Cummiskey <[EMAIL PROTECTED]> wrote:
>>    
>>
>>>Only thing i can thinkg of off the top of my head is that you are trying 
>>>to plug in degrees and minuets, but the sin,cos, and other trig 
>>>functions in php take on a parameter in radians-- not degrees.
>>>      
>>>
>>Degrees vs. radians can certainly be a factor.  Make sure you are giving the
>>functions a value in radians.
>>
>>Also, you have this item:
>>
>> 2*M_PI
>>
>>Have you defined a constant called M_PI or do you expect it to be a variable?
>>
>>Here are some links which may be helpful for determing the bearing (or 
>>heading)
>>between two latitude and longitude points:
>>
>> http://www.movable-type.co.uk/scripts/LatLong.html
>>
>> http://mathforum.org/library/drmath/view/55417.html
>>
>>This sounds like a Google Map application :)
>>
>>James
>>_____
>>
>>
>>James D. Keeline
>>http://www.Keeline.com  http://www.Keeline.com/articles
>>http://Stratemeyer.org  http://www.Keeline.com/TSCollection
>>
>>http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc.
>>Fall Semester Begins Sep 7 -- New Classes Start Every Few Weeks.
>>
>>
>>
>>Community email addresses:
>> Post message: [email protected]
>> Subscribe:    [EMAIL PROTECTED]
>> Unsubscribe:  [EMAIL PROTECTED]
>> List owner:   [EMAIL PROTECTED]
>>
>>Shortcut URL to this page:
>> http://groups.yahoo.com/group/php-list 
>>Yahoo! Groups Links
>>
>>
>>
>>
>>    
>>
>
>
>
>
>
>Community email addresses:
>  Post message: [email protected]
>  Subscribe:    [EMAIL PROTECTED]
>  Unsubscribe:  [EMAIL PROTECTED]
>  List owner:   [EMAIL PROTECTED]
>
>Shortcut URL to this page:
>  http://groups.yahoo.com/group/php-list 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>  
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to