?

Average Error: 0.23% → 0.23%
Time: 31.0s
Precision: binary64
Cost: 84480

?

\[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
\[\lambda_1 + \tan^{-1}_* \frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)\right)\right)}{\cos delta - \sin \phi_1 \cdot \left(\cos delta \cdot \sin \phi_1 + \sin delta \cdot \left(\cos \phi_1 \cdot \cos theta\right)\right)} \]
(FPCore (lambda1 phi1 phi2 delta theta)
 :precision binary64
 (+
  lambda1
  (atan2
   (* (* (sin theta) (sin delta)) (cos phi1))
   (-
    (cos delta)
    (*
     (sin phi1)
     (sin
      (asin
       (+
        (* (sin phi1) (cos delta))
        (* (* (cos phi1) (sin delta)) (cos theta))))))))))
(FPCore (lambda1 phi1 phi2 delta theta)
 :precision binary64
 (+
  lambda1
  (atan2
   (log1p (expm1 (* (sin delta) (* (cos phi1) (sin theta)))))
   (-
    (cos delta)
    (*
     (sin phi1)
     (+
      (* (cos delta) (sin phi1))
      (* (sin delta) (* (cos phi1) (cos theta)))))))))
double code(double lambda1, double phi1, double phi2, double delta, double theta) {
	return lambda1 + atan2(((sin(theta) * sin(delta)) * cos(phi1)), (cos(delta) - (sin(phi1) * sin(asin(((sin(phi1) * cos(delta)) + ((cos(phi1) * sin(delta)) * cos(theta))))))));
}
double code(double lambda1, double phi1, double phi2, double delta, double theta) {
	return lambda1 + atan2(log1p(expm1((sin(delta) * (cos(phi1) * sin(theta))))), (cos(delta) - (sin(phi1) * ((cos(delta) * sin(phi1)) + (sin(delta) * (cos(phi1) * cos(theta)))))));
}
public static double code(double lambda1, double phi1, double phi2, double delta, double theta) {
	return lambda1 + Math.atan2(((Math.sin(theta) * Math.sin(delta)) * Math.cos(phi1)), (Math.cos(delta) - (Math.sin(phi1) * Math.sin(Math.asin(((Math.sin(phi1) * Math.cos(delta)) + ((Math.cos(phi1) * Math.sin(delta)) * Math.cos(theta))))))));
}
public static double code(double lambda1, double phi1, double phi2, double delta, double theta) {
	return lambda1 + Math.atan2(Math.log1p(Math.expm1((Math.sin(delta) * (Math.cos(phi1) * Math.sin(theta))))), (Math.cos(delta) - (Math.sin(phi1) * ((Math.cos(delta) * Math.sin(phi1)) + (Math.sin(delta) * (Math.cos(phi1) * Math.cos(theta)))))));
}
def code(lambda1, phi1, phi2, delta, theta):
	return lambda1 + math.atan2(((math.sin(theta) * math.sin(delta)) * math.cos(phi1)), (math.cos(delta) - (math.sin(phi1) * math.sin(math.asin(((math.sin(phi1) * math.cos(delta)) + ((math.cos(phi1) * math.sin(delta)) * math.cos(theta))))))))
def code(lambda1, phi1, phi2, delta, theta):
	return lambda1 + math.atan2(math.log1p(math.expm1((math.sin(delta) * (math.cos(phi1) * math.sin(theta))))), (math.cos(delta) - (math.sin(phi1) * ((math.cos(delta) * math.sin(phi1)) + (math.sin(delta) * (math.cos(phi1) * math.cos(theta)))))))
function code(lambda1, phi1, phi2, delta, theta)
	return Float64(lambda1 + atan(Float64(Float64(sin(theta) * sin(delta)) * cos(phi1)), Float64(cos(delta) - Float64(sin(phi1) * sin(asin(Float64(Float64(sin(phi1) * cos(delta)) + Float64(Float64(cos(phi1) * sin(delta)) * cos(theta)))))))))
end
function code(lambda1, phi1, phi2, delta, theta)
	return Float64(lambda1 + atan(log1p(expm1(Float64(sin(delta) * Float64(cos(phi1) * sin(theta))))), Float64(cos(delta) - Float64(sin(phi1) * Float64(Float64(cos(delta) * sin(phi1)) + Float64(sin(delta) * Float64(cos(phi1) * cos(theta))))))))
end
code[lambda1_, phi1_, phi2_, delta_, theta_] := N[(lambda1 + N[ArcTan[N[(N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[delta], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Sin[N[ArcSin[N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[delta], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision] * N[Cos[theta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[lambda1_, phi1_, phi2_, delta_, theta_] := N[(lambda1 + N[ArcTan[N[Log[1 + N[(Exp[N[(N[Sin[delta], $MachinePrecision] * N[(N[Cos[phi1], $MachinePrecision] * N[Sin[theta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] / N[(N[Cos[delta], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[(N[(N[Cos[delta], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[delta], $MachinePrecision] * N[(N[Cos[phi1], $MachinePrecision] * N[Cos[theta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)}
\lambda_1 + \tan^{-1}_* \frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)\right)\right)}{\cos delta - \sin \phi_1 \cdot \left(\cos delta \cdot \sin \phi_1 + \sin delta \cdot \left(\cos \phi_1 \cdot \cos theta\right)\right)}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.23

    \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
  2. Simplified0.23

    \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\mathsf{fma}\left(\sin delta, \cos \phi_1 \cdot \cos theta, \cos delta \cdot \sin \phi_1\right)\right)}} \]
    Proof

    [Start]0.23

    \[ \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]

    *-commutative [=>]0.23

    \[ \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]

    associate-*r* [=>]0.23

    \[ \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\left(\cos \phi_1 \cdot \sin theta\right) \cdot \sin delta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]

    *-commutative [=>]0.23

    \[ \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]

    *-commutative [=>]0.23

    \[ \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\cos delta - \color{blue}{\sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right) \cdot \sin \phi_1}} \]

    cancel-sign-sub-inv [=>]0.23

    \[ \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\color{blue}{\cos delta + \left(-\sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)\right) \cdot \sin \phi_1}} \]

    cancel-sign-sub [<=]0.23

    \[ \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\color{blue}{\cos delta - \left(-\left(-\sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)\right)\right) \cdot \sin \phi_1}} \]

    *-commutative [=>]0.23

    \[ \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\cos delta - \color{blue}{\sin \phi_1 \cdot \left(-\left(-\sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)\right)\right)}} \]
  3. Taylor expanded in delta around inf 0.23

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\color{blue}{\cos delta - \left(\cos delta \cdot \sin \phi_1 + \sin delta \cdot \left(\cos \phi_1 \cdot \cos theta\right)\right) \cdot \sin \phi_1}} \]
  4. Applied egg-rr0.23

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)\right)\right)}}{\cos delta - \left(\cos delta \cdot \sin \phi_1 + \sin delta \cdot \left(\cos \phi_1 \cdot \cos theta\right)\right) \cdot \sin \phi_1} \]
  5. Final simplification0.23

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)\right)\right)}{\cos delta - \sin \phi_1 \cdot \left(\cos delta \cdot \sin \phi_1 + \sin delta \cdot \left(\cos \phi_1 \cdot \cos theta\right)\right)} \]

Alternatives

Alternative 1
Error0.23%
Cost71680
\[\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\cos delta - \sin \phi_1 \cdot \left(\cos delta \cdot \sin \phi_1 + \sin delta \cdot \left(\cos \phi_1 \cdot \cos theta\right)\right)} \]
Alternative 2
Error5.36%
Cost71616
\[\begin{array}{l} t_1 := \sin delta \cdot \cos \phi_1\\ \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot t_1}{\cos delta - \left(\sin \phi_1 \cdot t_1 + \cos delta \cdot {\sin \phi_1}^{2}\right)} \end{array} \]
Alternative 3
Error6.4%
Cost65284
\[\begin{array}{l} t_1 := \cos delta \cdot \sin \phi_1\\ \mathbf{if}\;theta \leq -7.4 \cdot 10^{+37}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\cos delta - \sin \phi_1 \cdot \left(t_1 + \sin delta \cdot \cos theta\right)}\\ \mathbf{elif}\;theta \leq 2 \cdot 10^{-17}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot theta\right)}{\cos delta - \sin \phi_1 \cdot \left(t_1 + \sin delta \cdot \cos \phi_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin delta \cdot \sin theta\right)}{\left(\cos delta + -0.5\right) + 0.5 \cdot \cos \left(\phi_1 + \phi_1\right)}\\ \end{array} \]
Alternative 4
Error5.36%
Cost65152
\[\begin{array}{l} t_1 := \sin delta \cdot \cos \phi_1\\ \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot t_1}{\cos delta - \sin \phi_1 \cdot \left(\cos delta \cdot \sin \phi_1 + t_1\right)} \end{array} \]
Alternative 5
Error6.48%
Cost59017
\[\begin{array}{l} \mathbf{if}\;theta \leq -7.4 \cdot 10^{+37} \lor \neg \left(theta \leq 10^{-19}\right):\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin delta \cdot \sin theta\right)}{\left(\cos delta + -0.5\right) + 0.5 \cdot \cos \left(\phi_1 + \phi_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot theta\right)}{\cos delta - \sin \phi_1 \cdot \left(\cos delta \cdot \sin \phi_1 + \sin delta \cdot \cos \phi_1\right)}\\ \end{array} \]
Alternative 6
Error7.8%
Cost39424
\[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin delta \cdot \sin theta\right)}{\left(\cos delta + -0.5\right) + 0.5 \cdot \cos \left(\phi_1 + \phi_1\right)} \]
Alternative 7
Error8.89%
Cost33160
\[\begin{array}{l} \mathbf{if}\;delta \leq -0.00025:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin delta \cdot \sin theta\right)}{\cos delta - \phi_1 \cdot \phi_1}\\ \mathbf{elif}\;delta \leq 8 \cdot 10^{-28}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{0.5 + 0.5 \cdot \cos \left(\phi_1 + \phi_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\cos delta}\\ \end{array} \]
Alternative 8
Error8.44%
Cost32969
\[\begin{array}{l} \mathbf{if}\;delta \leq -7.4 \cdot 10^{-6} \lor \neg \left(delta \leq 8 \cdot 10^{-28}\right):\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(delta \cdot \sin theta\right)}{1 - {\sin \phi_1}^{2}}\\ \end{array} \]
Alternative 9
Error8.45%
Cost32969
\[\begin{array}{l} \mathbf{if}\;delta \leq -2.6 \cdot 10^{-5} \lor \neg \left(delta \leq 8 \cdot 10^{-28}\right):\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(delta \cdot \cos \phi_1\right)}{1 - {\sin \phi_1}^{2}}\\ \end{array} \]
Alternative 10
Error8.9%
Cost32968
\[\begin{array}{l} \mathbf{if}\;delta \leq -0.018:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin delta \cdot \sin theta\right)}{\cos delta - \phi_1 \cdot \phi_1}\\ \mathbf{elif}\;delta \leq 8 \cdot 10^{-28}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(delta \cdot \cos \phi_1\right)}{1 - {\sin \phi_1}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\cos delta}\\ \end{array} \]
Alternative 11
Error11.3%
Cost32512
\[\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\cos delta} \]
Alternative 12
Error12.34%
Cost26377
\[\begin{array}{l} \mathbf{if}\;theta \leq -5 \cdot 10^{-47} \lor \neg \left(theta \leq 2 \cdot 10^{-27}\right):\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin delta \cdot theta\right)}{\cos delta}\\ \end{array} \]
Alternative 13
Error13.46%
Cost25984
\[\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\cos delta} \]
Alternative 14
Error23.78%
Cost19849
\[\begin{array}{l} \mathbf{if}\;delta \leq -1.8 \cdot 10^{-126} \lor \neg \left(delta \leq 5 \cdot 10^{-193}\right):\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot theta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1\\ \end{array} \]
Alternative 15
Error19.75%
Cost19849
\[\begin{array}{l} \mathbf{if}\;delta \leq -1.4 \cdot 10^{+31} \lor \neg \left(delta \leq 1.66 \cdot 10^{-43}\right):\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot theta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{delta \cdot \sin theta}{\cos delta}\\ \end{array} \]
Alternative 16
Error29.44%
Cost13448
\[\begin{array}{l} \mathbf{if}\;theta \leq -1 \cdot 10^{-152}:\\ \;\;\;\;\lambda_1\\ \mathbf{elif}\;theta \leq 270000000:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{delta \cdot theta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1\\ \end{array} \]
Alternative 17
Error29.7%
Cost64
\[\lambda_1 \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (lambda1 phi1 phi2 delta theta)
  :name "Destination given bearing on a great circle"
  :precision binary64
  (+ lambda1 (atan2 (* (* (sin theta) (sin delta)) (cos phi1)) (- (cos delta) (* (sin phi1) (sin (asin (+ (* (sin phi1) (cos delta)) (* (* (cos phi1) (sin delta)) (cos theta))))))))))