The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Abacus Formula Compiler 1.0.1 (Default branch) iBot Software Releases - RSS News 0 03-09-2008 06:20 AM
formula to get the swap space on a machine melanie_pfefer SUN Solaris 1 03-03-2008 03:15 PM
Help with formula in a script scottzx7rr Shell Programming and Scripting 3 08-15-2007 04:19 AM
Quadratic Formula Program zeek UNIX for Advanced & Expert Users 2 02-22-2002 11:32 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-27-2008
bobo bobo is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 148
Unhappy Formula help

The formula below will calculate a distance in miles between 2 points in excel. Can some put it to work in unix?

Lat = 43.335
Lon1 = -70.9884

Lat2 = 43.4829
Lon2 = -71.246

distance =3444*ACOS(COS(RADIANS(90-(Lat)))*COS(RADIANS(90-(Lat2)))+SIN(RADIANS(90-(Lat1)))*SIN(RADIANS(90-(Lat2)))*COS(RADIANS((Lon1-Lon2))))

distance = 14.3376283 miles
  #2 (permalink)  
Old 03-27-2008
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,932
Quote:
distance = 14.3376283 miles
I don't quite understand.

2 points in excel and the distance is in miles ... surprising
  #3 (permalink)  
Old 03-27-2008
bobo bobo is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 148
not 2 points in excel. It's 2 points at different locations in a city. The result was done in excel spreadsheet.
  #4 (permalink)  
Old 03-27-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Cool Not sure of anything built-in to use

Take a look at >bc -l
Quote:
s() c() a()
They should all be defined as sine, cosine, arctan respectively

I will have to think more about radians.

And to the other question... latitude and longitude on a map. Math can determine the miles between points; complicated by the earth's curvature.

Last edited by joeyg; 03-27-2008 at 04:18 PM..
  #5 (permalink)  
Old 03-27-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
HOME has a utility called gcb which you can download and install. It's probably more exact than your Excel formula, although the web page design (or lack of same) hints that usability might be nearly as bad as Excel.

If you're on Debian or Ubuntu, aptitude install gcb
  #6 (permalink)  
Old 03-27-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
A quick detour via Google seems to suggest that the constant in the Excel formula is wrong, or at least debatable, it should be something like 3963 for miles, or 6378.8 for kilometers. Another source has 3959.98 for miles or 6372.797 for kilometers. Apparently, it (also) depends on how far from the equator you are.

See also Unit 014 - Latitude and Longitude
  #7 (permalink)  
Old 03-28-2008
bobo bobo is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 148
Question

This formula will yield the distance between 2 coordinates.
Can this be done in UNIX?? Anyone knows how???

Lat1 = 43.335
Lon1 = -70.9884

Lat2 = 43.4829
Lon2 = -71.246

distance =3444*ACOS(COS(RADIANS(90-(Lat1)))*COS(RADIANS(90-(Lat2)))+SIN(RADIANS(90-(Lat1)))*SIN(RADIANS(90-(Lat2)))*COS(RADIANS((Lon1-Lon2))))

distance = 14.3376283 miles
Sponsored Links
Closed Thread

Bookmarks

Tags
linux, ubuntu, unix download

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 04:01 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0