?

Average Error: 24.1 → 23.9
Time: 1.7min
Precision: binary64
Cost: 92488

?

\[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
\[\begin{array}{l} t_0 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_1 := \sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}\\ t_2 := \frac{\lambda_1 - \lambda_2}{2}\\ t_3 := \cos \left(2 \cdot t_2\right)\\ t_4 := \sin t_2\\ \mathbf{if}\;\phi_2 \leq -8.8 \cdot 10^{-5}:\\ \;\;\;\;\tan^{-1}_* \frac{t_1}{\sqrt{1 - \left(t_0 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - t_3}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{elif}\;\phi_2 \leq 13.2:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_4\right) \cdot t_4}}{\sqrt{1 - \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{t_1}{\sqrt{1 - \left(t_0 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \frac{1 + \cos \left(t_2 \cdot 4\right)}{2} \cdot \frac{1}{t_3}}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\ \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (*
  R
  (*
   2.0
   (atan2
    (sqrt
     (+
      (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)
      (*
       (* (* (cos phi1) (cos phi2)) (sin (/ (- lambda1 lambda2) 2.0)))
       (sin (/ (- lambda1 lambda2) 2.0)))))
    (sqrt
     (-
      1.0
      (+
       (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)
       (*
        (* (* (cos phi1) (cos phi2)) (sin (/ (- lambda1 lambda2) 2.0)))
        (sin (/ (- lambda1 lambda2) 2.0))))))))))
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0))
        (t_1
         (sqrt
          (+
           (pow (sin (* -0.5 phi2)) 2.0)
           (* (- 1.0 (cos (- lambda1 lambda2))) (* 0.5 (cos phi2))))))
        (t_2 (/ (- lambda1 lambda2) 2.0))
        (t_3 (cos (* 2.0 t_2)))
        (t_4 (sin t_2)))
   (if (<= phi2 -8.8e-5)
     (*
      (atan2
       t_1
       (sqrt
        (- 1.0 (+ t_0 (* (cos phi1) (* (cos phi2) (/ (- 1.0 t_3) 2.0)))))))
      (* R 2.0))
     (if (<= phi2 13.2)
       (*
        R
        (*
         2.0
         (atan2
          (sqrt (+ t_0 (* (* (* (cos phi1) (cos phi2)) t_4) t_4)))
          (sqrt
           (-
            1.0
            (+
             (pow (sin (* 0.5 phi1)) 2.0)
             (* (cos phi1) (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0))))))))
       (*
        (atan2
         t_1
         (sqrt
          (-
           1.0
           (+
            t_0
            (*
             (cos phi1)
             (*
              (cos phi2)
              (/
               (- 1.0 (* (/ (+ 1.0 (cos (* t_2 4.0))) 2.0) (/ 1.0 t_3)))
               2.0)))))))
        (* R 2.0))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	return R * (2.0 * atan2(sqrt((pow(sin(((phi1 - phi2) / 2.0)), 2.0) + (((cos(phi1) * cos(phi2)) * sin(((lambda1 - lambda2) / 2.0))) * sin(((lambda1 - lambda2) / 2.0))))), sqrt((1.0 - (pow(sin(((phi1 - phi2) / 2.0)), 2.0) + (((cos(phi1) * cos(phi2)) * sin(((lambda1 - lambda2) / 2.0))) * sin(((lambda1 - lambda2) / 2.0))))))));
}
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = pow(sin(((phi1 - phi2) / 2.0)), 2.0);
	double t_1 = sqrt((pow(sin((-0.5 * phi2)), 2.0) + ((1.0 - cos((lambda1 - lambda2))) * (0.5 * cos(phi2)))));
	double t_2 = (lambda1 - lambda2) / 2.0;
	double t_3 = cos((2.0 * t_2));
	double t_4 = sin(t_2);
	double tmp;
	if (phi2 <= -8.8e-5) {
		tmp = atan2(t_1, sqrt((1.0 - (t_0 + (cos(phi1) * (cos(phi2) * ((1.0 - t_3) / 2.0))))))) * (R * 2.0);
	} else if (phi2 <= 13.2) {
		tmp = R * (2.0 * atan2(sqrt((t_0 + (((cos(phi1) * cos(phi2)) * t_4) * t_4))), sqrt((1.0 - (pow(sin((0.5 * phi1)), 2.0) + (cos(phi1) * pow(sin((0.5 * (lambda1 - lambda2))), 2.0)))))));
	} else {
		tmp = atan2(t_1, sqrt((1.0 - (t_0 + (cos(phi1) * (cos(phi2) * ((1.0 - (((1.0 + cos((t_2 * 4.0))) / 2.0) * (1.0 / t_3))) / 2.0))))))) * (R * 2.0);
	}
	return tmp;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    code = r * (2.0d0 * atan2(sqrt(((sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0) + (((cos(phi1) * cos(phi2)) * sin(((lambda1 - lambda2) / 2.0d0))) * sin(((lambda1 - lambda2) / 2.0d0))))), sqrt((1.0d0 - ((sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0) + (((cos(phi1) * cos(phi2)) * sin(((lambda1 - lambda2) / 2.0d0))) * sin(((lambda1 - lambda2) / 2.0d0))))))))
end function
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_0 = sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0
    t_1 = sqrt(((sin(((-0.5d0) * phi2)) ** 2.0d0) + ((1.0d0 - cos((lambda1 - lambda2))) * (0.5d0 * cos(phi2)))))
    t_2 = (lambda1 - lambda2) / 2.0d0
    t_3 = cos((2.0d0 * t_2))
    t_4 = sin(t_2)
    if (phi2 <= (-8.8d-5)) then
        tmp = atan2(t_1, sqrt((1.0d0 - (t_0 + (cos(phi1) * (cos(phi2) * ((1.0d0 - t_3) / 2.0d0))))))) * (r * 2.0d0)
    else if (phi2 <= 13.2d0) then
        tmp = r * (2.0d0 * atan2(sqrt((t_0 + (((cos(phi1) * cos(phi2)) * t_4) * t_4))), sqrt((1.0d0 - ((sin((0.5d0 * phi1)) ** 2.0d0) + (cos(phi1) * (sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0)))))))
    else
        tmp = atan2(t_1, sqrt((1.0d0 - (t_0 + (cos(phi1) * (cos(phi2) * ((1.0d0 - (((1.0d0 + cos((t_2 * 4.0d0))) / 2.0d0) * (1.0d0 / t_3))) / 2.0d0))))))) * (r * 2.0d0)
    end if
    code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	return R * (2.0 * Math.atan2(Math.sqrt((Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0) + (((Math.cos(phi1) * Math.cos(phi2)) * Math.sin(((lambda1 - lambda2) / 2.0))) * Math.sin(((lambda1 - lambda2) / 2.0))))), Math.sqrt((1.0 - (Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0) + (((Math.cos(phi1) * Math.cos(phi2)) * Math.sin(((lambda1 - lambda2) / 2.0))) * Math.sin(((lambda1 - lambda2) / 2.0))))))));
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0);
	double t_1 = Math.sqrt((Math.pow(Math.sin((-0.5 * phi2)), 2.0) + ((1.0 - Math.cos((lambda1 - lambda2))) * (0.5 * Math.cos(phi2)))));
	double t_2 = (lambda1 - lambda2) / 2.0;
	double t_3 = Math.cos((2.0 * t_2));
	double t_4 = Math.sin(t_2);
	double tmp;
	if (phi2 <= -8.8e-5) {
		tmp = Math.atan2(t_1, Math.sqrt((1.0 - (t_0 + (Math.cos(phi1) * (Math.cos(phi2) * ((1.0 - t_3) / 2.0))))))) * (R * 2.0);
	} else if (phi2 <= 13.2) {
		tmp = R * (2.0 * Math.atan2(Math.sqrt((t_0 + (((Math.cos(phi1) * Math.cos(phi2)) * t_4) * t_4))), Math.sqrt((1.0 - (Math.pow(Math.sin((0.5 * phi1)), 2.0) + (Math.cos(phi1) * Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0)))))));
	} else {
		tmp = Math.atan2(t_1, Math.sqrt((1.0 - (t_0 + (Math.cos(phi1) * (Math.cos(phi2) * ((1.0 - (((1.0 + Math.cos((t_2 * 4.0))) / 2.0) * (1.0 / t_3))) / 2.0))))))) * (R * 2.0);
	}
	return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2):
	return R * (2.0 * math.atan2(math.sqrt((math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0) + (((math.cos(phi1) * math.cos(phi2)) * math.sin(((lambda1 - lambda2) / 2.0))) * math.sin(((lambda1 - lambda2) / 2.0))))), math.sqrt((1.0 - (math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0) + (((math.cos(phi1) * math.cos(phi2)) * math.sin(((lambda1 - lambda2) / 2.0))) * math.sin(((lambda1 - lambda2) / 2.0))))))))
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0)
	t_1 = math.sqrt((math.pow(math.sin((-0.5 * phi2)), 2.0) + ((1.0 - math.cos((lambda1 - lambda2))) * (0.5 * math.cos(phi2)))))
	t_2 = (lambda1 - lambda2) / 2.0
	t_3 = math.cos((2.0 * t_2))
	t_4 = math.sin(t_2)
	tmp = 0
	if phi2 <= -8.8e-5:
		tmp = math.atan2(t_1, math.sqrt((1.0 - (t_0 + (math.cos(phi1) * (math.cos(phi2) * ((1.0 - t_3) / 2.0))))))) * (R * 2.0)
	elif phi2 <= 13.2:
		tmp = R * (2.0 * math.atan2(math.sqrt((t_0 + (((math.cos(phi1) * math.cos(phi2)) * t_4) * t_4))), math.sqrt((1.0 - (math.pow(math.sin((0.5 * phi1)), 2.0) + (math.cos(phi1) * math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0)))))))
	else:
		tmp = math.atan2(t_1, math.sqrt((1.0 - (t_0 + (math.cos(phi1) * (math.cos(phi2) * ((1.0 - (((1.0 + math.cos((t_2 * 4.0))) / 2.0) * (1.0 / t_3))) / 2.0))))))) * (R * 2.0)
	return tmp
function code(R, lambda1, lambda2, phi1, phi2)
	return Float64(R * Float64(2.0 * atan(sqrt(Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * sin(Float64(Float64(lambda1 - lambda2) / 2.0))) * sin(Float64(Float64(lambda1 - lambda2) / 2.0))))), sqrt(Float64(1.0 - Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * sin(Float64(Float64(lambda1 - lambda2) / 2.0))) * sin(Float64(Float64(lambda1 - lambda2) / 2.0)))))))))
end
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0
	t_1 = sqrt(Float64((sin(Float64(-0.5 * phi2)) ^ 2.0) + Float64(Float64(1.0 - cos(Float64(lambda1 - lambda2))) * Float64(0.5 * cos(phi2)))))
	t_2 = Float64(Float64(lambda1 - lambda2) / 2.0)
	t_3 = cos(Float64(2.0 * t_2))
	t_4 = sin(t_2)
	tmp = 0.0
	if (phi2 <= -8.8e-5)
		tmp = Float64(atan(t_1, sqrt(Float64(1.0 - Float64(t_0 + Float64(cos(phi1) * Float64(cos(phi2) * Float64(Float64(1.0 - t_3) / 2.0))))))) * Float64(R * 2.0));
	elseif (phi2 <= 13.2)
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_0 + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_4) * t_4))), sqrt(Float64(1.0 - Float64((sin(Float64(0.5 * phi1)) ^ 2.0) + Float64(cos(phi1) * (sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0))))))));
	else
		tmp = Float64(atan(t_1, sqrt(Float64(1.0 - Float64(t_0 + Float64(cos(phi1) * Float64(cos(phi2) * Float64(Float64(1.0 - Float64(Float64(Float64(1.0 + cos(Float64(t_2 * 4.0))) / 2.0) * Float64(1.0 / t_3))) / 2.0))))))) * Float64(R * 2.0));
	end
	return tmp
end
function tmp = code(R, lambda1, lambda2, phi1, phi2)
	tmp = R * (2.0 * atan2(sqrt(((sin(((phi1 - phi2) / 2.0)) ^ 2.0) + (((cos(phi1) * cos(phi2)) * sin(((lambda1 - lambda2) / 2.0))) * sin(((lambda1 - lambda2) / 2.0))))), sqrt((1.0 - ((sin(((phi1 - phi2) / 2.0)) ^ 2.0) + (((cos(phi1) * cos(phi2)) * sin(((lambda1 - lambda2) / 2.0))) * sin(((lambda1 - lambda2) / 2.0))))))));
end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(((phi1 - phi2) / 2.0)) ^ 2.0;
	t_1 = sqrt(((sin((-0.5 * phi2)) ^ 2.0) + ((1.0 - cos((lambda1 - lambda2))) * (0.5 * cos(phi2)))));
	t_2 = (lambda1 - lambda2) / 2.0;
	t_3 = cos((2.0 * t_2));
	t_4 = sin(t_2);
	tmp = 0.0;
	if (phi2 <= -8.8e-5)
		tmp = atan2(t_1, sqrt((1.0 - (t_0 + (cos(phi1) * (cos(phi2) * ((1.0 - t_3) / 2.0))))))) * (R * 2.0);
	elseif (phi2 <= 13.2)
		tmp = R * (2.0 * atan2(sqrt((t_0 + (((cos(phi1) * cos(phi2)) * t_4) * t_4))), sqrt((1.0 - ((sin((0.5 * phi1)) ^ 2.0) + (cos(phi1) * (sin((0.5 * (lambda1 - lambda2))) ^ 2.0)))))));
	else
		tmp = atan2(t_1, sqrt((1.0 - (t_0 + (cos(phi1) * (cos(phi2) * ((1.0 - (((1.0 + cos((t_2 * 4.0))) / 2.0) * (1.0 / t_3))) / 2.0))))))) * (R * 2.0);
	end
	tmp_2 = tmp;
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[Power[N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(1.0 - N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(2.0 * t$95$2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sin[t$95$2], $MachinePrecision]}, If[LessEqual[phi2, -8.8e-5], N[(N[ArcTan[t$95$1 / N[Sqrt[N[(1.0 - N[(t$95$0 + N[(N[Cos[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[(N[(1.0 - t$95$3), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(R * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[phi2, 13.2], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$0 + N[(N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Cos[phi1], $MachinePrecision] * N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[ArcTan[t$95$1 / N[Sqrt[N[(1.0 - N[(t$95$0 + N[(N[Cos[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[(N[(1.0 - N[(N[(N[(1.0 + N[Cos[N[(t$95$2 * 4.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] * N[(1.0 / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(R * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]]
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right)
\begin{array}{l}
t_0 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\
t_1 := \sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}\\
t_2 := \frac{\lambda_1 - \lambda_2}{2}\\
t_3 := \cos \left(2 \cdot t_2\right)\\
t_4 := \sin t_2\\
\mathbf{if}\;\phi_2 \leq -8.8 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{t_1}{\sqrt{1 - \left(t_0 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - t_3}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\

\mathbf{elif}\;\phi_2 \leq 13.2:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_4\right) \cdot t_4}}{\sqrt{1 - \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t_1}{\sqrt{1 - \left(t_0 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \frac{1 + \cos \left(t_2 \cdot 4\right)}{2} \cdot \frac{1}{t_3}}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 3 regimes
  2. if phi2 < -8.7999999999999998e-5

    1. Initial program 34.1

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Simplified34.1

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right)} \]
      Proof

      [Start]34.1

      \[ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]

      rational_best-simplify-2 [=>]34.1

      \[ R \cdot \color{blue}{\left(\tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}} \cdot 2\right)} \]

      rational_best-simplify-44 [=>]34.1

      \[ \color{blue}{\tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}} \cdot \left(R \cdot 2\right)} \]
    3. Taylor expanded in phi1 around 0 33.7

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + 0.5 \cdot \left(\left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \cos \phi_2\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]
    4. Simplified33.7

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]
      Proof

      [Start]33.7

      \[ \tan^{-1}_* \frac{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + 0.5 \cdot \left(\left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \cos \phi_2\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]

      rational_best-simplify-44 [=>]33.7

      \[ \tan^{-1}_* \frac{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \color{blue}{\left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]

    if -8.7999999999999998e-5 < phi2 < 13.199999999999999

    1. Initial program 14.6

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Taylor expanded in phi2 around 0 14.9

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{1 - \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]

    if 13.199999999999999 < phi2

    1. Initial program 32.9

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Simplified32.9

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right)} \]
      Proof

      [Start]32.9

      \[ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]

      rational_best-simplify-2 [=>]32.9

      \[ R \cdot \color{blue}{\left(\tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}} \cdot 2\right)} \]

      rational_best-simplify-44 [=>]32.9

      \[ \color{blue}{\tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}} \cdot \left(R \cdot 2\right)} \]
    3. Taylor expanded in phi1 around 0 32.3

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + 0.5 \cdot \left(\left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \cos \phi_2\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]
    4. Simplified32.3

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]
      Proof

      [Start]32.3

      \[ \tan^{-1}_* \frac{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + 0.5 \cdot \left(\left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \cos \phi_2\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]

      rational_best-simplify-44 [=>]32.3

      \[ \tan^{-1}_* \frac{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \color{blue}{\left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]
    5. Applied egg-rr32.4

      \[\leadsto \tan^{-1}_* \frac{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \color{blue}{\frac{1 + \cos \left(\frac{\lambda_1 - \lambda_2}{2} \cdot 4\right)}{2} \cdot \frac{1}{\cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}}}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification23.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -8.8 \cdot 10^{-5}:\\ \;\;\;\;\tan^{-1}_* \frac{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{elif}\;\phi_2 \leq 13.2:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \frac{1 + \cos \left(\frac{\lambda_1 - \lambda_2}{2} \cdot 4\right)}{2} \cdot \frac{1}{\cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\ \end{array} \]

Alternatives

Alternative 1
Error24.1
Cost167552
\[\begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_2 := \frac{\lambda_1 - \lambda_2}{2}\\ t_3 := \sin t_2\\ t_4 := \cos \left(2 \cdot t_2\right)\\ t_5 := \frac{1 - t_4}{2}\\ t_6 := 1 - \left(t_1 + t_0 \cdot t_5\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + \left(t_0 \cdot t_3\right) \cdot t_3}}{\sqrt{\frac{1}{1 - \left(t_1 + t_0 \cdot \frac{1 - \left(\frac{1 + t_4}{2} - t_5\right)}{2}\right)} \cdot \left(t_6 \cdot t_6\right)}}\right) \end{array} \]
Alternative 2
Error24.1
Cost160128
\[\begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := \frac{\lambda_1 - \lambda_2}{2}\\ t_2 := \sin t_1\\ t_3 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_4 := 1 - \left(t_3 + t_0 \cdot \frac{1 - \cos \left(2 \cdot t_1\right)}{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_3 + \left(t_0 \cdot t_2\right) \cdot t_2}}{\sqrt{t_4 \cdot \left(t_4 \cdot \frac{1}{t_4}\right)}}\right) \end{array} \]
Alternative 3
Error24.1
Cost160128
\[\begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := \frac{\lambda_1 - \lambda_2}{2}\\ t_2 := \sin t_1\\ t_3 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_4 := 1 - \left(t_3 + t_0 \cdot \frac{1 - \cos \left(2 \cdot t_1\right)}{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_3 + \left(t_0 \cdot t_2\right) \cdot t_2}}{\sqrt{\frac{1}{t_4} \cdot \left(t_4 \cdot t_4\right)}}\right) \end{array} \]
Alternative 4
Error24.1
Cost106496
\[\begin{array}{l} t_0 := \frac{\lambda_1 - \lambda_2}{2}\\ t_1 := \sin t_0\\ t_2 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_2 + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t_1 \cdot \left(\frac{1}{t_1} \cdot t_1\right)\right)\right) \cdot t_1}}{\sqrt{1 - \left(t_2 + \left(\cos \phi_2 \cdot \cos \phi_1\right) \cdot \frac{1 - \cos \left(2 \cdot t_0\right)}{2}\right)}}\right) \end{array} \]
Alternative 5
Error24.1
Cost92864
\[\begin{array}{l} t_0 := \frac{\lambda_1 - \lambda_2}{2}\\ t_1 := \sin t_0\\ t_2 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_2 + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t_1 \cdot t_1\right)}}{\sqrt{-\left(\cos \phi_2 \cdot \left(\cos \phi_1 \cdot \frac{1 - \cos \left(2 \cdot t_0\right)}{2}\right) + \left(t_2 + -1\right)\right)}}\right) \end{array} \]
Alternative 6
Error24.1
Cost92800
\[\begin{array}{l} t_0 := \frac{\lambda_1 - \lambda_2}{2}\\ t_1 := \sin t_0\\ t_2 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_2 + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_1\right) \cdot t_1}}{\sqrt{1 - \left(t_2 + \left(\cos \phi_2 \cdot \cos \phi_1\right) \cdot \frac{1 - \cos \left(2 \cdot t_0\right)}{2}\right)}}\right) \end{array} \]
Alternative 7
Error23.8
Cost92488
\[\begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := \frac{\lambda_1 - \lambda_2}{2}\\ t_2 := \sin t_1\\ t_3 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_4 := \tan^{-1}_* \frac{\sqrt{{\sin \left(0.5 \cdot \phi_1\right)}^{2} + 0.5 \cdot \left(\left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \cos \phi_1\right)}}{\sqrt{1 - \left(t_3 + t_0 \cdot \frac{1 - \cos \left(2 \cdot t_1\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{if}\;\phi_1 \leq -4 \cdot 10^{-5}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;\phi_1 \leq 6 \cdot 10^{-6}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_3 + \left(t_0 \cdot t_2\right) \cdot t_2}}{\sqrt{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;t_4\\ \end{array} \]
Alternative 8
Error25.4
Cost86536
\[\begin{array}{l} t_0 := \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\\ t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t_0\\ t_2 := \tan^{-1}_* \frac{\sqrt{{\sin \left(0.5 \cdot \phi_1\right)}^{2} + 0.5 \cdot \left(\left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \cos \phi_1\right)}}{\sqrt{1 - t_1}} \cdot \left(R \cdot 2\right)\\ \mathbf{if}\;\phi_1 \leq -1.8 \cdot 10^{-5}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\phi_1 \leq 0.023:\\ \;\;\;\;\tan^{-1}_* \frac{\sqrt{t_1}}{\sqrt{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + t_0\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Error25.5
Cost86536
\[\begin{array}{l} t_0 := \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\\ t_1 := \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\\ t_2 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_3 := \tan^{-1}_* \frac{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}}{\sqrt{1 - \left(t_2 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot t_0\right)\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{if}\;\phi_2 \leq -2.5 \cdot 10^{-5}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;\phi_2 \leq 13.2:\\ \;\;\;\;\tan^{-1}_* \frac{\sqrt{t_2 + t_1}}{\sqrt{1 - \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + t_1\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 10
Error25.6
Cost86400
\[\begin{array}{l} t_0 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\\ \tan^{-1}_* \frac{\sqrt{t_0}}{\sqrt{1 - t_0}} \cdot \left(R \cdot 2\right) \end{array} \]
Alternative 11
Error25.8
Cost86344
\[\begin{array}{l} t_0 := \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\\ t_1 := \cos \phi_1 \cdot \cos \phi_2\\ t_2 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_3 := \tan^{-1}_* \frac{\sqrt{t_2 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(-\lambda_2\right)}{2}\right)}}{\sqrt{1 - \left(t_2 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot t_0\right)\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{if}\;\lambda_2 \leq -0.0006:\\ \;\;\;\;t_3\\ \mathbf{elif}\;\lambda_2 \leq 7 \cdot 10^{-20}:\\ \;\;\;\;\tan^{-1}_* \frac{\sqrt{t_2 + t_1 \cdot t_0}}{\sqrt{1 - \left(t_2 + t_1 \cdot \frac{1 - \cos \lambda_1}{2}\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 12
Error25.8
Cost86344
\[\begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_2 := \sqrt{t_1 + t_0 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}}\\ t_3 := \tan^{-1}_* \frac{t_2}{\sqrt{1 - \left(t_1 + t_0 \cdot \frac{1 - \cos \left(-\lambda_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{if}\;\lambda_2 \leq -7.5 \cdot 10^{-5}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;\lambda_2 \leq 7 \cdot 10^{-20}:\\ \;\;\;\;\tan^{-1}_* \frac{t_2}{\sqrt{1 - \left(t_1 + t_0 \cdot \frac{1 - \cos \lambda_1}{2}\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 13
Error26.0
Cost79752
\[\begin{array}{l} t_0 := 1 - \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\\ t_2 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_3 := \tan^{-1}_* \frac{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + t_0 \cdot \left(0.5 \cdot \cos \phi_2\right)}}{\sqrt{1 - \left(t_2 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot t_1\right)\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{if}\;\phi_2 \leq -2.55 \cdot 10^{-8}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;\phi_2 \leq 3.1 \cdot 10^{-12}:\\ \;\;\;\;\tan^{-1}_* \frac{\sqrt{{\sin \left(0.5 \cdot \phi_1\right)}^{2} + 0.5 \cdot \left(t_0 \cdot \cos \phi_1\right)}}{\sqrt{1 - \left(t_2 + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_1\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 14
Error36.0
Cost79488
\[\tan^{-1}_* \frac{\sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]
Alternative 15
Error36.0
Cost79432
\[\begin{array}{l} t_0 := \sqrt{{\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}\\ t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_2 := \tan^{-1}_* \frac{t_0}{\sqrt{1 - \left(t_1 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(-\lambda_2\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{if}\;\lambda_2 \leq -0.00012:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\lambda_2 \leq 2.7 \cdot 10^{-5}:\\ \;\;\;\;\tan^{-1}_* \frac{t_0}{\sqrt{1 - \left(t_1 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \lambda_1}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 16
Error40.2
Cost79368
\[\begin{array}{l} t_0 := 1 - \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\\ t_2 := \tan^{-1}_* \frac{\sqrt{t_1 + t_0 \cdot \left(0.5 \cdot \cos \phi_2\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \lambda_1}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{if}\;\phi_2 \leq -0.00016:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\phi_2 \leq 8.6 \cdot 10^{-189}:\\ \;\;\;\;\tan^{-1}_* \frac{\sqrt{t_0 \cdot 0.5}}{\sqrt{1 - \left(t_1 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 17
Error36.1
Cost79360
\[\begin{array}{l} t_0 := {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\\ \tan^{-1}_* \frac{\sqrt{t_0 + \left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \left(0.5 \cdot \cos \phi_2\right)}}{\sqrt{1 - \left(t_0 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \end{array} \]
Alternative 18
Error42.8
Cost66760
\[\begin{array}{l} t_0 := 1 - \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)\\ t_2 := \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - t_1}{2}\right)\\ t_3 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ \mathbf{if}\;\lambda_1 - \lambda_2 \leq -5 \cdot 10^{-6}:\\ \;\;\;\;\tan^{-1}_* \frac{\sqrt{t_0 \cdot 0.5}}{\sqrt{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + t_2\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{elif}\;\lambda_1 - \lambda_2 \leq 10000:\\ \;\;\;\;\tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 - \left(t_3 + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{1 - \left(\frac{1 + t_1}{2} - \frac{1 - \cos \lambda_1}{2}\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\sqrt{t_0} \cdot \sqrt{0.5}}{\sqrt{1 - \left(t_3 + t_2\right)}} \cdot \left(R \cdot 2\right)\\ \end{array} \]
Alternative 19
Error42.8
Cost60872
\[\begin{array}{l} t_0 := 1 - \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := \sqrt{t_0 \cdot 0.5}\\ t_2 := \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)\\ t_3 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ \mathbf{if}\;\lambda_1 - \lambda_2 \leq -5 \cdot 10^{-6}:\\ \;\;\;\;\tan^{-1}_* \frac{t_1}{\sqrt{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - t_2}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{elif}\;\lambda_1 - \lambda_2 \leq 10000:\\ \;\;\;\;\tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 - \left(t_3 + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{1 - \left(\frac{1 + t_2}{2} - \frac{1 - \cos \lambda_1}{2}\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{t_1}{\sqrt{1 - \left(t_3 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{t_0}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\ \end{array} \]
Alternative 20
Error47.3
Cost59784
\[\begin{array}{l} t_0 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_1 := \sqrt{\left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot 0.5}\\ t_2 := 1 - \cos \lambda_1\\ t_3 := \sqrt{1 - \left(t_0 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{t_2}{2}\right)\right)}\\ \mathbf{if}\;\lambda_1 \leq -270:\\ \;\;\;\;\tan^{-1}_* \frac{\sqrt{t_2 \cdot 0.5}}{t_3} \cdot \left(R \cdot 2\right)\\ \mathbf{elif}\;\lambda_1 \leq 2.5 \cdot 10^{+28}:\\ \;\;\;\;\tan^{-1}_* \frac{t_1}{\sqrt{1 - \left(t_0 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \left(-\lambda_2\right)}{2}\right)\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{t_1}{t_3} \cdot \left(R \cdot 2\right)\\ \end{array} \]
Alternative 21
Error47.2
Cost59584
\[\begin{array}{l} t_0 := 1 - \cos \left(\lambda_1 - \lambda_2\right)\\ \tan^{-1}_* \frac{\sqrt{t_0 \cdot 0.5}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{t_0}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \end{array} \]
Alternative 22
Error50.2
Cost59456
\[\tan^{-1}_* \frac{\sqrt{\left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot 0.5}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \lambda_1}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]
Alternative 23
Error52.8
Cost59328
\[\begin{array}{l} t_0 := 1 - \cos \lambda_1\\ \tan^{-1}_* \frac{\sqrt{t_0 \cdot 0.5}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{t_0}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \end{array} \]
Alternative 24
Error50.3
Cost59328
\[\tan^{-1}_* \frac{\sqrt{\left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot 0.5}}{\sqrt{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \lambda_1}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]
Alternative 25
Error50.3
Cost59328
\[\tan^{-1}_* \frac{\sqrt{\left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot 0.5}}{\sqrt{1 - \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \frac{1 - \cos \lambda_1}{2}\right)\right)}} \cdot \left(R \cdot 2\right) \]

Error

Reproduce?

herbie shell --seed 2023092 
(FPCore (R lambda1 lambda2 phi1 phi2)
  :name "Distance on a great circle"
  :precision binary64
  (* R (* 2.0 (atan2 (sqrt (+ (pow (sin (/ (- phi1 phi2) 2.0)) 2.0) (* (* (* (cos phi1) (cos phi2)) (sin (/ (- lambda1 lambda2) 2.0))) (sin (/ (- lambda1 lambda2) 2.0))))) (sqrt (- 1.0 (+ (pow (sin (/ (- phi1 phi2) 2.0)) 2.0) (* (* (* (cos phi1) (cos phi2)) (sin (/ (- lambda1 lambda2) 2.0))) (sin (/ (- lambda1 lambda2) 2.0))))))))))