R/SurfaceAreaSGE.R

Defines functions SurfaceAreaSGE

Documented in SurfaceAreaSGE

SurfaceAreaSGE <- function(P, subdivisions = 100L,
          rel.tol = .Machine$double.eps^0.25, abs.tol = rel.tol,
          stop.on.error = TRUE, keep.xy = FALSE, aux = NULL){
 
  p <- length(P)
  if(p != 3) 
    stop("The number of parameters should equal 3!")
 
  inner.fun <- function(phi){    
    SGE <- GE(P=P, phi=phi, simpver=1, m=1)
    2*pi*sin(phi)*SGE*sqrt(SGE^2+(DSGE(P=P, phi))^2)
  }

  temp <- integrate( inner.fun, 0, pi, subdivisions = subdivisions,
             rel.tol = rel.tol, abs.tol = abs.tol,
             stop.on.error = stop.on.error, keep.xy = keep.xy, aux = aux )$value
  as.numeric( temp )

}

Try the biogeom package in your browser

Any scripts or data that you put into this service are public.

biogeom documentation built on May 29, 2024, 8:52 a.m.