?

Average Accuracy: 99.8% → 99.8%
Time: 21.0s
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{eh}{ew} \cdot \tan t\right)} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(eh \cdot \left(-\frac{\tan t}{ew}\right)\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 (* (/ eh ew) (tan t)))))
   (* eh (* (sin t) (sin (atan (* eh (- (/ (tan t) 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, ((eh / ew) * tan(t))))) - (eh * (sin(t) * sin(atan((eh * -(tan(t) / 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, ((eh / ew) * Math.tan(t))))) - (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)) * 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, ((eh / ew) * math.tan(t))))) - (eh * (math.sin(t) * math.sin(math.atan((eh * -(math.tan(t) / 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(Float64(eh / ew) * tan(t))))) - Float64(eh * Float64(sin(t) * sin(atan(Float64(eh * Float64(-Float64(tan(t) / 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, ((eh / ew) * tan(t))))) - (eh * (sin(t) * sin(atan((eh * -(tan(t) / 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[(eh / ew), $MachinePrecision] * N[Tan[t], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * (-N[(N[Tan[t], $MachinePrecision] / 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{eh}{ew} \cdot \tan t\right)} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(eh \cdot \left(-\frac{\tan t}{ew}\right)\right)\right)\right|

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 99.8%

    \[\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. Simplified99.8%

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

    [Start]99.8

    \[ \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| \]

    fabs-sub [=>]99.8

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

    fabs-neg [<=]99.8

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

    sub-neg [=>]99.8

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

    +-commutative [=>]99.8

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

    distribute-neg-in [=>]99.8

    \[ \left|\color{blue}{\left(-\left(-\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right) + \left(-\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)}\right| \]
  3. Applied egg-rr99.8%

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

    [Start]99.8

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

    cos-atan [=>]99.8

    \[ \left|\left(ew \cdot \cos t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right| \]

    hypot-1-def [=>]99.8

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

    add-sqr-sqrt [=>]50.1

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

    sqrt-unprod [=>]93.6

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

    sqr-neg [=>]93.6

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

    sqrt-unprod [<=]49.7

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

    add-sqr-sqrt [<=]99.8

    \[ \left|\left(ew \cdot \cos t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{eh} \cdot \frac{\tan t}{ew}\right)} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right| \]
  4. Simplified99.8%

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

    [Start]99.8

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

    associate-*r/ [=>]99.8

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

    associate-*l/ [<=]99.8

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

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

Alternatives

Alternative 1
Accuracy98.5%
Cost39296
\[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(eh \cdot \left(-\frac{\tan t}{ew}\right)\right) - eh \cdot \sin t\right| \]
Alternative 2
Accuracy90.9%
Cost33161
\[\begin{array}{l} t_1 := ew \cdot \cos t\\ \mathbf{if}\;eh \leq -2.4 \cdot 10^{-160} \lor \neg \left(eh \leq 9.6 \cdot 10^{-139}\right):\\ \;\;\;\;\left|t_1 \cdot \cos \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{ew}\right) - eh \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_1 \cdot \cos \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right|\\ \end{array} \]
Alternative 3
Accuracy87.4%
Cost33033
\[\begin{array}{l} \mathbf{if}\;eh \leq -1.25 \cdot 10^{-87} \lor \neg \left(eh \leq 3.1 \cdot 10^{-121}\right):\\ \;\;\;\;\left|eh \cdot \sin t - ew \cdot \cos \tan^{-1} \left(eh \cdot \left(-\frac{\tan t}{ew}\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right|\\ \end{array} \]
Alternative 4
Accuracy61.3%
Cost32576
\[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right| \]
Alternative 5
Accuracy60.9%
Cost26240
\[\left|\frac{\cos t}{\frac{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \tan t\right)}{ew}}\right| \]
Alternative 6
Accuracy61.0%
Cost26240
\[\left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \tan t\right)}\right| \]
Alternative 7
Accuracy42.0%
Cost26048
\[\left|ew \cdot \cos \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right| \]
Alternative 8
Accuracy40.8%
Cost19712
\[\left|ew \cdot \cos \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{ew}\right)\right| \]
Alternative 9
Accuracy41.7%
Cost19712
\[\left|\frac{ew}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \tan t\right)}\right| \]
Alternative 10
Accuracy40.8%
Cost19648
\[\left|ew \cdot \cos \tan^{-1} \left(eh \cdot \frac{t}{ew}\right)\right| \]
Alternative 11
Accuracy40.0%
Cost13312
\[\left|\frac{ew}{\mathsf{hypot}\left(1, eh \cdot \frac{t}{ew}\right)}\right| \]
Alternative 12
Accuracy40.0%
Cost13312
\[\left|\frac{ew}{\mathsf{hypot}\left(1, t \cdot \frac{eh}{ew}\right)}\right| \]

Error

Reproduce?

herbie shell --seed 2023137 
(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)))))))