Function to compute constant small q which is the radius of a
parallel of latitude, phi, divided by the semimajor axis.

@param float $eccent
@param float $sinphi
@return float
515061
public static function qsfnz($eccent, $sinphi)
    {
        if ($eccent > 1.0e-7) {
            $con = $eccent * $sinphi;

            return (
                ( 1.0 - $eccent * $eccent)
                * ($sinphi / (1.0 - $con * $con) - (.5 / $eccent) * log( (1.0 - $con) / (1.0 + $con) ))
            );
        }

        return (2.0 * $sinphi);
    }
602936
public function arccot(int $scale = null): Decimal
    {
        $scale = ($scale === null) ? 32 : $scale;

        $piOverTwo = DecimalConstants::pi()->div(Decimal::fromInteger(2), $scale + 2);
        if ($this->round($scale)->isZero()) {
            return $piOverTwo->round($scale);
        }

        $piOverFour = DecimalConstants::pi()->div(Decimal::fromInteger(4), $scale + 2);
        if ($this->round($scale)->equals(DecimalConstants::one())) {
            return $piOverFour->round($scale);
        }
        if ($this->round($scale)->equals(DecimalConstants::negativeOne())) {
            return DecimalConstants::negativeOne()->mul($piOverFour, $scale + 2)->round($scale);
        }

        return $piOverTwo->sub(
            self::simplePowerSerie(
                $this,
                DecimalConstants::zero(),
                $scale + 2
            )
        )->round($scale);
    }
442663
def _g(self, h, xp, s):
        """"""

        nphi = sum(self.phi)

        return (nphi / 2.0) * log(2 * pi) + nphi * \
            log(s) + 0.5 * sum((h - xp) ** 2) / (s ** 2)
525306
def cis(x: float) -> complex:
    
    """
    return np.cos(x) + 1.0j * np.sin(x)
700356
function spherical2Cartesian(phi, theta) {
  const nPhi = parseFloat(phi);
  const nTheta = parseFloat(theta);
  const phiRad = (180.0 - nPhi) * (Math.PI / 180.0);
  const thetaRad = (180.0 - nTheta) * (Math.PI / 180.0);
  return [
    Math.sin(thetaRad) * Math.cos(phiRad),
    Math.sin(thetaRad) * Math.sin(phiRad),
    Math.cos(thetaRad),
  ];
}
846380
@Override
    public double magnitudeSqr( Object pt ) {
        double sum = 0.0;
        double[] coords = coords(pt);
        for( int i = 0; i < dimensions; i++ ) {
            double c = coords[i];
            sum += c * c;
        }
        return sum;
    }
122386
public function cosec(int $scale = null): Decimal
    {
        $sin = $this->sin($scale + 2);
        if ($sin->isZero()) {
            throw new \DomainException(
                "The cosecant of this 'angle' is undefined."
            );
        }

        return DecimalConstants::one()->div($sin)->round($scale);
    }
700366
public function tan(int $scale = null): Decimal
    {
	    $cos = $this->cos($scale + 2);
	    if ($cos->isZero()) {
	        throw new \DomainException(
	            "The tangent of this 'angle' is undefined."
	        );
	    }

	    return $this->sin($scale + 2)->div($cos)->round($scale);
    }
209033
public Vector getCentralPoint() {
		Vector arc = new Vector();
		if (empieza <= acaba) {
			addNode(arc, (empieza+acaba)/2.0);
		} else {
			addNode(arc, empieza);
			double alfa = 360-empieza;
			double beta = acaba;
			double an = alfa + beta;
			double mid = an/2.0;
			if (mid<=alfa) {
				addNode(arc, empieza+mid);
			} else {
				addNode(arc, mid-alfa);
			}
		}
		return arc;
	}
1021287
def ec2eq(self):
        """"""

        import math
        #from numpy.matlib import sin, cos, arcsin, arctan2
        from math import sin, cos
        from math import asin as arcsin
        from math import atan2 as arctan2
        from math import acos as arccos
        
        eb=self.eb
        el=self.el
        ob=math.radians(23.439281)
        
        dec = arcsin(sin(eb)*cos(ob)+cos(eb)*sin(ob)*sin(el))
        sra = (sin(dec)*cos(ob)-sin(eb))/(cos(dec)*sin(ob))

        cra = cos(el)*cos(eb)/cos(dec)
        if sra < 1 and sra > -1 :
            sa= arcsin(sra)
        else:
            sa = 0
        ca= arccos(cra)
        tsa=sa
        tca=ca
        if tsa<0 :
            ca=2.0*math.pi-ca
        if tca>=math.pi/2.0:
            sa=math.pi-sa
        if ca >= math.pi*2.0:
            ca=ca-math.pi*2.0
        self.tsa=sra
        self.tca=cra
        self.ra=ca
        self.dec=dec
1344565
private function _theta(PointInterface $a, PointInterface $b)
    {
        list($x1, $y1) = $a->getCoordinates();
        list($x2, $y2) = $b->getCoordinates();
        return atan2($y2-$y1, $x2 - $x1) + 2 * M_PI;
    }
877819
def CalcRad(lat):
    ""
    a = 6378.137
    e2 = 0.081082 * 0.081082
    # the radius of curvature of an ellipsoidal Earth in the plane of a
    # meridian of latitude is given by
    #
    # R' = a * (1 - e^2) / (1 - e^2 * (sin(lat))^2)^(3/2)
    #
    # where a is the equatorial radius,
    # b is the polar radius, and
    # e is the eccentricity of the ellipsoid = sqrt(1 - b^2/a^2)
    #
    # a = 6378 km (3963 mi) Equatorial radius (surface to center distance)
    # b = 6356.752 km (3950 mi) Polar radius (surface to center distance)
    # e = 0.081082 Eccentricity
    sc = math.sin(Deg2Rad(lat))
    x = a * (1.0 - e2)
    z = 1.0 - e2 * sc * sc
    y = pow(z, 1.5)
    r = x / y

    r = r * 1000.0      # Convert to meters
    return r
1166992
function kepler (m, ecc) {
  const epsilon = 1e-6

  m = torad(m)
  let e = m
  while (1) {
    const delta = e - ecc * Math.sin(e) - m
    e -= delta / (1.0 - ecc * Math.cos(e))

    if (Math.abs(delta) <= epsilon) {
      break
    }
  }

  return e
}
1278501
def sin(x, context=None):
    
    return _apply_function_in_current_context(
        BigFloat,
        mpfr.mpfr_sin,
        (BigFloat._implicit_convert(x),),
        context,
    )
1023954
private static function computeSignedAreaP($path,  $radius) {
        $size = count($path);
        if ($size < 3) { return 0; }
        $total = 0;
        $prev = $path[$size - 1];
        $prevTanLat = tan((M_PI / 2 - deg2rad($prev['lat'])) / 2);
        $prevLng = deg2rad($prev['lng']);
        // For each edge, accumulate the signed area of the triangle formed by the North Pole
        // and that edge ("polar triangle").
        foreach($path as $point) {
            $tanLat = tan((M_PI / 2 - deg2rad($point['lat'])) / 2);
            $lng = deg2rad($point['lng']);
            $total += self::polarTriangleArea($tanLat, $lng, $prevTanLat, $prevLng);
            $prevTanLat = $tanLat;
            $prevLng = $lng;
        }
        return $total * ($radius * $radius);
    }
466403
void sin(ECoordinate angle) {
		double sinv = Math.sin(angle.m_value);
		double cosv = Math.cos(angle.m_value);
		m_value = sinv;
		double absv = Math.abs(sinv);
		m_eps = (Math.abs(cosv) + absv * 0.5 * angle.m_eps) * angle.m_eps
				+ epsCoordinate() * absv;
	}
1365410
public function forward($p)
    {
        /*
        $sinphi;
        $cosphi; // sin and cos value
        $al;    // temporary values
        $c;    // temporary values
        $con;
        $ml;  // cone constant, small m	
        $ms;    // small m
        $x;
        $y;
        */
        
        $lon = $p->x;
        $lat = $p->y;

        $con = Common::adjust_lon( $lon - $this->long0 );

        if ( abs( $lat ) <= .0000001 ) {
            $x = $this->x0 + $this->a * $con;
            $y = $this->y0 - $this->a * $this->ml0;
        } else {
            $sinphi = sin( $lat );
            $cosphi = cos( $lat );

            $ml = Common::mlfn( $this->e0, $this->e1, $this->e2, $this->e3, $lat );
            $ms = Common::msfnz( $this->e, $sinphi, $cosphi );

            $x = $this->x0 + $this->a * $ms * sin( $sinphi ) / $sinphi;
            $y = $this->y0 + $this->a * ($ml - $this->ml0 + $ms * (1.0 - cos( $sinphi )) / $sinphi);
        }

        $p->x = $x;
        $p->y = $y;

        return $p;
    }