Average Error: 0.1 → 0.1
Time: 16.6s
Precision: binary64
Cost: 52672
\[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
\[\left|\left(ew \cdot \cos t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\tan t}{\frac{ew}{eh}}\right)} - \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right)\right)\right| \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (-
   (* (* ew (cos t)) (cos (atan (/ (* (- eh) (tan t)) ew))))
   (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (-
   (* (* ew (cos t)) (/ 1.0 (hypot 1.0 (/ (tan t) (/ ew eh)))))
   (* (sin t) (* eh (sin (atan (* (tan t) (/ (- eh) ew)))))))))
double code(double eh, double ew, double t) {
	return fabs((((ew * cos(t)) * cos(atan(((-eh * tan(t)) / ew)))) - ((eh * sin(t)) * sin(atan(((-eh * tan(t)) / ew))))));
}
double code(double eh, double ew, double t) {
	return fabs((((ew * cos(t)) * (1.0 / hypot(1.0, (tan(t) / (ew / eh))))) - (sin(t) * (eh * sin(atan((tan(t) * (-eh / ew))))))));
}
public static double code(double eh, double ew, double t) {
	return Math.abs((((ew * Math.cos(t)) * Math.cos(Math.atan(((-eh * Math.tan(t)) / ew)))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((-eh * Math.tan(t)) / ew))))));
}
public static double code(double eh, double ew, double t) {
	return Math.abs((((ew * Math.cos(t)) * (1.0 / Math.hypot(1.0, (Math.tan(t) / (ew / eh))))) - (Math.sin(t) * (eh * Math.sin(Math.atan((Math.tan(t) * (-eh / ew))))))));
}
def code(eh, ew, t):
	return math.fabs((((ew * math.cos(t)) * math.cos(math.atan(((-eh * math.tan(t)) / ew)))) - ((eh * math.sin(t)) * math.sin(math.atan(((-eh * math.tan(t)) / ew))))))
def code(eh, ew, t):
	return math.fabs((((ew * math.cos(t)) * (1.0 / math.hypot(1.0, (math.tan(t) / (ew / eh))))) - (math.sin(t) * (eh * math.sin(math.atan((math.tan(t) * (-eh / ew))))))))
function code(eh, ew, t)
	return abs(Float64(Float64(Float64(ew * cos(t)) * cos(atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(Float64(-eh) * tan(t)) / ew))))))
end
function code(eh, ew, t)
	return abs(Float64(Float64(Float64(ew * cos(t)) * Float64(1.0 / hypot(1.0, Float64(tan(t) / Float64(ew / eh))))) - Float64(sin(t) * Float64(eh * sin(atan(Float64(tan(t) * Float64(Float64(-eh) / ew))))))))
end
function tmp = code(eh, ew, t)
	tmp = abs((((ew * cos(t)) * cos(atan(((-eh * tan(t)) / ew)))) - ((eh * sin(t)) * sin(atan(((-eh * tan(t)) / ew))))));
end
function tmp = code(eh, ew, t)
	tmp = abs((((ew * cos(t)) * (1.0 / hypot(1.0, (tan(t) / (ew / eh))))) - (sin(t) * (eh * sin(atan((tan(t) * (-eh / ew))))))));
end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] / N[(ew / eh), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[((-eh) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\left|\left(ew \cdot \cos t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\tan t}{\frac{ew}{eh}}\right)} - \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right)\right)\right|

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Taylor expanded in eh around 0 0.1

    \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \color{blue}{\sin t \cdot \left(\sin \tan^{-1} \left(-1 \cdot \frac{\tan t \cdot eh}{ew}\right) \cdot eh\right)}\right| \]
  3. Simplified0.1

    \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \color{blue}{\sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(-\tan t \cdot \frac{eh}{ew}\right)\right)}\right| \]
    Proof
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (neg.f64 (*.f64 (tan.f64 t) (/.f64 eh ew))))))))): 0 points increase in error, 0 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 eh ew) (tan.f64 t)))))))))): 0 points increase in error, 8 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (neg.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 eh (tan.f64 t)) ew))))))))): 0 points increase in error, 0 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (neg.f64 (Rewrite<= associate-*r/_binary64 (*.f64 eh (/.f64 (tan.f64 t) ew)))))))))): 0 points increase in error, 0 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (*.f64 eh (/.f64 (tan.f64 t) ew)))))))))): 0 points increase in error, 0 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (*.f64 -1 (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 (tan.f64 t) ew) eh))))))))): 0 points increase in error, 0 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (*.f64 -1 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 (tan.f64 t) eh) ew))))))))): 0 points increase in error, 0 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (Rewrite<= *-commutative_binary64 (*.f64 (sin.f64 (atan.f64 (*.f64 -1 (/.f64 (*.f64 (tan.f64 t) eh) ew)))) eh))))): 0 points increase in error, 0 points decrease in error
  4. Applied egg-rr0.1

    \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \color{blue}{\frac{1}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}} - \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(-\tan t \cdot \frac{eh}{ew}\right)\right)\right| \]
  5. Simplified0.1

    \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \color{blue}{\frac{1}{\mathsf{hypot}\left(1, \frac{\tan t}{\frac{ew}{eh}}\right)}} - \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(-\tan t \cdot \frac{eh}{ew}\right)\right)\right| \]
    Proof
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (neg.f64 (*.f64 (tan.f64 t) (/.f64 eh ew))))))))): 0 points increase in error, 0 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 eh ew) (tan.f64 t)))))))))): 0 points increase in error, 8 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (neg.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 eh (tan.f64 t)) ew))))))))): 0 points increase in error, 0 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (neg.f64 (Rewrite<= associate-*r/_binary64 (*.f64 eh (/.f64 (tan.f64 t) ew)))))))))): 0 points increase in error, 0 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (*.f64 eh (/.f64 (tan.f64 t) ew)))))))))): 0 points increase in error, 0 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (*.f64 -1 (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 (tan.f64 t) ew) eh))))))))): 0 points increase in error, 0 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (*.f64 eh (sin.f64 (atan.f64 (*.f64 -1 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 (tan.f64 t) eh) ew))))))))): 0 points increase in error, 0 points decrease in error
    (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (sin.f64 t) (Rewrite<= *-commutative_binary64 (*.f64 (sin.f64 (atan.f64 (*.f64 -1 (/.f64 (*.f64 (tan.f64 t) eh) ew)))) eh))))): 0 points increase in error, 0 points decrease in error
  6. Final simplification0.1

    \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\tan t}{\frac{ew}{eh}}\right)} - \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right)\right)\right| \]

Alternatives

Alternative 1
Error0.6
Cost52544
\[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{-\tan t \cdot eh}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right| \]
Alternative 2
Error1.1
Cost33024
\[\left|eh \cdot \sin t + \left(ew \cdot \cos t\right) \cdot \frac{-1}{\mathsf{hypot}\left(1, \frac{\tan t}{\frac{ew}{eh}}\right)}\right| \]
Alternative 3
Error1.1
Cost33024
\[\left|eh \cdot \sin t + \left(ew \cdot \cos t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\tan t}{\frac{ew}{eh}}\right)}\right| \]
Alternative 4
Error1.3
Cost19648
\[\left|ew \cdot \cos t + eh \cdot \sin t\right| \]

Error

Reproduce

herbie shell --seed 2022343 
(FPCore (eh ew t)
  :name "Example 2 from Robby"
  :precision binary64
  (fabs (- (* (* ew (cos t)) (cos (atan (/ (* (- eh) (tan t)) ew)))) (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))