Figring out where missing parenthesis goes in Trigonometric functions formula

trinker

ggplot2orBust
I trying to figure out a bounding box (locations within a square mile of a center point) on a globe. This is more complicated than the traditional Cartesian 2-D system. I found a site that claims to have it figured out and they're smarter than me so we'll trust it (be test the solution when I finish). I'm trying to implement this solution using R.

In one of the formulas they seem to be missing a bracket but give an equivalent formula. I figure smart math back ground people will be able to:

1. Determine where the missing bracket goes based on the equivalent formula
2. Determine if the equivalent formula is indeed equivalent
3. Determine if the writer actually knows what they're talking about

The missing parenthesis appears be in equation (8):

Δlon = arccos( ( cos(r) - sin(latT) · sin(lat) ) / ( cos(latT) · cos(lat) )
= arcsin(sin(r)/cos(lat)) = 1.1202
I think they're saying these two are equivalent:

arccos( ( cos(r) - sin(latT) · sin(lat) ) / ( cos(latT) · cos(lat) )
and
arcsin(sin(r)/cos(lat))
Is that true?
==================

Is the following indeed missing a parenthesis? If so where does it go?
arccos( ( cos(r) - sin(latT) · sin(lat) ) / ( cos(latT) · cos(lat) )
I also emailed the author but thought I'd pose here too. I'll let you know if they provide any direction.

TR

Dason

Code:
r <- .1570
lat <- 1.3963
lon <- -.6981

latT <- asin(sin(lat)/cos(r))

# Add paren at the end
acos((cos(r) - sin(latT)*sin(lat))/(cos(latT)*cos(lat)))
acos((cos(r) - sin(latT)*sin(lat)))/(cos(latT)*cos(lat))

# One should equal
asin(sin(r)/cos(lat))
# which should give 1.1202

# So the correct version is
acos((cos(r) - sin(latT)*sin(lat))/(cos(latT)*cos(lat)))

trinker

ggplot2orBust
Duh moment, they give an example. I could have just tried it. Thanks Dason.

trinker

ggplot2orBust
For anyone who cares here this is as a function:

Code:
bounding_box <- function(lat, lon, dist) {

## Helper functions
%+/-% <- function(x, margin){x + c(-1, +1)*margin}
lat_range <- function(latr, r) rad2deg(latr %+/-% r)
lon_range <- function(lonr, dlon) rad2deg(lonr %+/-% dlon)

bounding_box(42.96318, -78.85885, 1)