ENA, Section 1.4, Exercise 1

Percentage Accurate: 94.5% → 99.3%
Time: 11.0s
Alternatives: 20
Speedup: 1.0×

Specification

?
\[1.99 \leq x \land x \leq 2.01\]
\[\begin{array}{l} \\ \cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \end{array} \]
(FPCore (x) :precision binary64 (* (cos x) (exp (* 10.0 (* x x)))))
double code(double x) {
	return cos(x) * exp((10.0 * (x * x)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = cos(x) * exp((10.0d0 * (x * x)))
end function
public static double code(double x) {
	return Math.cos(x) * Math.exp((10.0 * (x * x)));
}
def code(x):
	return math.cos(x) * math.exp((10.0 * (x * x)))
function code(x)
	return Float64(cos(x) * exp(Float64(10.0 * Float64(x * x))))
end
function tmp = code(x)
	tmp = cos(x) * exp((10.0 * (x * x)));
end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\cos x \cdot e^{10 \cdot \left(x \cdot x\right)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 20 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 94.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \end{array} \]
(FPCore (x) :precision binary64 (* (cos x) (exp (* 10.0 (* x x)))))
double code(double x) {
	return cos(x) * exp((10.0 * (x * x)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = cos(x) * exp((10.0d0 * (x * x)))
end function
public static double code(double x) {
	return Math.cos(x) * Math.exp((10.0 * (x * x)));
}
def code(x):
	return math.cos(x) * math.exp((10.0 * (x * x)))
function code(x)
	return Float64(cos(x) * exp(Float64(10.0 * Float64(x * x))))
end
function tmp = code(x)
	tmp = cos(x) * exp((10.0 * (x * x)));
end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\cos x \cdot e^{10 \cdot \left(x \cdot x\right)}
\end{array}

Alternative 1: 99.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \frac{1}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(-0.5 \cdot x\right)}} \cdot \cos x \end{array} \]
(FPCore (x)
 :precision binary64
 (* (/ 1.0 (pow (pow (exp 20.0) x) (* -0.5 x))) (cos x)))
double code(double x) {
	return (1.0 / pow(pow(exp(20.0), x), (-0.5 * x))) * cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (1.0d0 / ((exp(20.0d0) ** x) ** ((-0.5d0) * x))) * cos(x)
end function
public static double code(double x) {
	return (1.0 / Math.pow(Math.pow(Math.exp(20.0), x), (-0.5 * x))) * Math.cos(x);
}
def code(x):
	return (1.0 / math.pow(math.pow(math.exp(20.0), x), (-0.5 * x))) * math.cos(x)
function code(x)
	return Float64(Float64(1.0 / ((exp(20.0) ^ x) ^ Float64(-0.5 * x))) * cos(x))
end
function tmp = code(x)
	tmp = (1.0 / ((exp(20.0) ^ x) ^ (-0.5 * x))) * cos(x);
end
code[x_] := N[(N[(1.0 / N[Power[N[Power[N[Exp[20.0], $MachinePrecision], x], $MachinePrecision], N[(-0.5 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(-0.5 \cdot x\right)}} \cdot \cos x
\end{array}
Derivation
  1. Initial program 94.6%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    4. sqr-powN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left(e^{10}\right)}^{\left(\frac{x \cdot x}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{x \cdot x}{2}\right)}\right)} \]
    5. pow-prod-upN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(\frac{x \cdot x}{2} + \frac{x \cdot x}{2}\right)}} \]
    6. flip-+N/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\frac{x \cdot x}{2} \cdot \frac{x \cdot x}{2} - \frac{x \cdot x}{2} \cdot \frac{x \cdot x}{2}}{\frac{x \cdot x}{2} - \frac{x \cdot x}{2}}\right)}} \]
    7. +-inversesN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{0}}{\frac{x \cdot x}{2} - \frac{x \cdot x}{2}}\right)} \]
    8. +-inversesN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{0}{\color{blue}{0}}\right)} \]
    9. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{0}{\color{blue}{2 \cdot 0}}\right)} \]
    10. associate-/l/N/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\frac{0}{0}}{2}\right)}} \]
    11. +-inversesN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\frac{\color{blue}{\frac{x \cdot x}{2} \cdot \frac{x \cdot x}{2} - \frac{x \cdot x}{2} \cdot \frac{x \cdot x}{2}}}{0}}{2}\right)} \]
    12. +-inversesN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\frac{\frac{x \cdot x}{2} \cdot \frac{x \cdot x}{2} - \frac{x \cdot x}{2} \cdot \frac{x \cdot x}{2}}{\color{blue}{\frac{x \cdot x}{2} - \frac{x \cdot x}{2}}}}{2}\right)} \]
    13. flip-+N/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{\frac{x \cdot x}{2} + \frac{x \cdot x}{2}}}{2}\right)} \]
    14. count-2N/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{2 \cdot \frac{x \cdot x}{2}}}{2}\right)} \]
    15. *-commutativeN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{\frac{x \cdot x}{2} \cdot 2}}{2}\right)} \]
    16. associate-*l/N/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{\frac{\left(x \cdot x\right) \cdot 2}{2}}}{2}\right)} \]
    17. associate-/l*N/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{\left(x \cdot x\right) \cdot \frac{2}{2}}}{2}\right)} \]
    18. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\left(x \cdot x\right) \cdot \color{blue}{1}}{2}\right)} \]
    19. *-rgt-identityN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{x \cdot x}}{2}\right)} \]
    20. frac-2negN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{\mathsf{neg}\left(2\right)}\right)}} \]
    21. distribute-frac-negN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)\right)}} \]
  4. Applied rewrites95.2%

    \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}}} \]
  5. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left(e^{10}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot x\right)}}} \]
    2. sqr-powN/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left(e^{10}\right)}^{\left(\frac{\left(\mathsf{neg}\left(x\right)\right) \cdot x}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{\left(\mathsf{neg}\left(x\right)\right) \cdot x}{2}\right)}}} \]
    3. pow-prod-downN/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left(e^{10} \cdot e^{10}\right)}^{\left(\frac{\left(\mathsf{neg}\left(x\right)\right) \cdot x}{2}\right)}}} \]
    4. lift-*.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{10} \cdot e^{10}\right)}^{\left(\frac{\color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot x}}{2}\right)}} \]
    5. *-commutativeN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{10} \cdot e^{10}\right)}^{\left(\frac{\color{blue}{x \cdot \left(\mathsf{neg}\left(x\right)\right)}}{2}\right)}} \]
    6. associate-/l*N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{10} \cdot e^{10}\right)}^{\color{blue}{\left(x \cdot \frac{\mathsf{neg}\left(x\right)}{2}\right)}}} \]
    7. pow-unpowN/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left({\left(e^{10} \cdot e^{10}\right)}^{x}\right)}^{\left(\frac{\mathsf{neg}\left(x\right)}{2}\right)}}} \]
    8. lift-neg.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{10} \cdot e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{\mathsf{neg}\left(x\right)}}{2}\right)}} \]
    9. neg-mul-1N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{10} \cdot e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{-1 \cdot x}}{2}\right)}} \]
    10. *-commutativeN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{10} \cdot e^{10}\right)}^{x}\right)}^{\left(\frac{\color{blue}{x \cdot -1}}{2}\right)}} \]
    11. associate-/l*N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{10} \cdot e^{10}\right)}^{x}\right)}^{\color{blue}{\left(x \cdot \frac{-1}{2}\right)}}} \]
    12. metadata-evalN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{10} \cdot e^{10}\right)}^{x}\right)}^{\left(x \cdot \color{blue}{\frac{-1}{2}}\right)}} \]
    13. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left({\left(e^{10} \cdot e^{10}\right)}^{x}\right)}^{\left(x \cdot \frac{-1}{2}\right)}}} \]
    14. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left({\left(e^{10} \cdot e^{10}\right)}^{x}\right)}}^{\left(x \cdot \frac{-1}{2}\right)}} \]
    15. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(\color{blue}{e^{10}} \cdot e^{10}\right)}^{x}\right)}^{\left(x \cdot \frac{-1}{2}\right)}} \]
    16. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{10} \cdot \color{blue}{e^{10}}\right)}^{x}\right)}^{\left(x \cdot \frac{-1}{2}\right)}} \]
    17. prod-expN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\color{blue}{\left(e^{10 + 10}\right)}}^{x}\right)}^{\left(x \cdot \frac{-1}{2}\right)}} \]
    18. lower-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\color{blue}{\left(e^{10 + 10}\right)}}^{x}\right)}^{\left(x \cdot \frac{-1}{2}\right)}} \]
    19. metadata-evalN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{\color{blue}{20}}\right)}^{x}\right)}^{\left(x \cdot \frac{-1}{2}\right)}} \]
    20. *-commutativeN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{20}\right)}^{x}\right)}^{\color{blue}{\left(\frac{-1}{2} \cdot x\right)}}} \]
    21. lower-*.f6499.3

      \[\leadsto \cos x \cdot \frac{1}{{\left({\left(e^{20}\right)}^{x}\right)}^{\color{blue}{\left(-0.5 \cdot x\right)}}} \]
  6. Applied rewrites99.3%

    \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(-0.5 \cdot x\right)}}} \]
  7. Final simplification99.3%

    \[\leadsto \frac{1}{{\left({\left(e^{20}\right)}^{x}\right)}^{\left(-0.5 \cdot x\right)}} \cdot \cos x \]
  8. Add Preprocessing

Alternative 2: 98.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \frac{1}{{\left({\left(e^{10}\right)}^{x}\right)}^{\left(-x\right)}} \cdot \cos x \end{array} \]
(FPCore (x)
 :precision binary64
 (* (/ 1.0 (pow (pow (exp 10.0) x) (- x))) (cos x)))
double code(double x) {
	return (1.0 / pow(pow(exp(10.0), x), -x)) * cos(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (1.0d0 / ((exp(10.0d0) ** x) ** -x)) * cos(x)
end function
public static double code(double x) {
	return (1.0 / Math.pow(Math.pow(Math.exp(10.0), x), -x)) * Math.cos(x);
}
def code(x):
	return (1.0 / math.pow(math.pow(math.exp(10.0), x), -x)) * math.cos(x)
function code(x)
	return Float64(Float64(1.0 / ((exp(10.0) ^ x) ^ Float64(-x))) * cos(x))
end
function tmp = code(x)
	tmp = (1.0 / ((exp(10.0) ^ x) ^ -x)) * cos(x);
end
code[x_] := N[(N[(1.0 / N[Power[N[Power[N[Exp[10.0], $MachinePrecision], x], $MachinePrecision], (-x)], $MachinePrecision]), $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{{\left({\left(e^{10}\right)}^{x}\right)}^{\left(-x\right)}} \cdot \cos x
\end{array}
Derivation
  1. Initial program 94.5%

    \[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \color{blue}{e^{10 \cdot \left(x \cdot x\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot e^{\color{blue}{10 \cdot \left(x \cdot x\right)}} \]
    3. exp-prodN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}} \]
    4. sqr-powN/A

      \[\leadsto \cos x \cdot \color{blue}{\left({\left(e^{10}\right)}^{\left(\frac{x \cdot x}{2}\right)} \cdot {\left(e^{10}\right)}^{\left(\frac{x \cdot x}{2}\right)}\right)} \]
    5. pow-prod-upN/A

      \[\leadsto \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(\frac{x \cdot x}{2} + \frac{x \cdot x}{2}\right)}} \]
    6. flip-+N/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\frac{x \cdot x}{2} \cdot \frac{x \cdot x}{2} - \frac{x \cdot x}{2} \cdot \frac{x \cdot x}{2}}{\frac{x \cdot x}{2} - \frac{x \cdot x}{2}}\right)}} \]
    7. +-inversesN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{0}}{\frac{x \cdot x}{2} - \frac{x \cdot x}{2}}\right)} \]
    8. +-inversesN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{0}{\color{blue}{0}}\right)} \]
    9. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{0}{\color{blue}{2 \cdot 0}}\right)} \]
    10. associate-/l/N/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\frac{0}{0}}{2}\right)}} \]
    11. +-inversesN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\frac{\color{blue}{\frac{x \cdot x}{2} \cdot \frac{x \cdot x}{2} - \frac{x \cdot x}{2} \cdot \frac{x \cdot x}{2}}}{0}}{2}\right)} \]
    12. +-inversesN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\frac{\frac{x \cdot x}{2} \cdot \frac{x \cdot x}{2} - \frac{x \cdot x}{2} \cdot \frac{x \cdot x}{2}}{\color{blue}{\frac{x \cdot x}{2} - \frac{x \cdot x}{2}}}}{2}\right)} \]
    13. flip-+N/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{\frac{x \cdot x}{2} + \frac{x \cdot x}{2}}}{2}\right)} \]
    14. count-2N/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{2 \cdot \frac{x \cdot x}{2}}}{2}\right)} \]
    15. *-commutativeN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{\frac{x \cdot x}{2} \cdot 2}}{2}\right)} \]
    16. associate-*l/N/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{\frac{\left(x \cdot x\right) \cdot 2}{2}}}{2}\right)} \]
    17. associate-/l*N/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{\left(x \cdot x\right) \cdot \frac{2}{2}}}{2}\right)} \]
    18. metadata-evalN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\left(x \cdot x\right) \cdot \color{blue}{1}}{2}\right)} \]
    19. *-rgt-identityN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\left(\frac{\color{blue}{x \cdot x}}{2}\right)} \]
    20. frac-2negN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\frac{\mathsf{neg}\left(x \cdot x\right)}{\mathsf{neg}\left(2\right)}\right)}} \]
    21. distribute-frac-negN/A

      \[\leadsto \cos x \cdot {\left(e^{10}\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{x \cdot x}{\mathsf{neg}\left(2\right)}\right)\right)}} \]
  4. Applied rewrites95.2%

    \[\leadsto \cos x \cdot \color{blue}{\frac{1}{{\left(e^{10}\right)}^{\left(\left(-x\right) \cdot x\right)}}} \]
  5. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left(e^{10}\right)}^{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot x\right)}}} \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{10}\right)}^{\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot x\right)}}} \]
    3. *-commutativeN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{10}\right)}^{\color{blue}{\left(x \cdot \left(\mathsf{neg}\left(x\right)\right)\right)}}} \]
    4. pow-unpowN/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left({\left(e^{10}\right)}^{x}\right)}^{\left(\mathsf{neg}\left(x\right)\right)}}} \]
    5. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\color{blue}{\left(e^{10}\right)}}^{x}\right)}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    6. exp-prodN/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left(e^{10 \cdot x}\right)}}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    7. *-commutativeN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{\color{blue}{x \cdot 10}}\right)}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    8. pow-expN/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left({\left(e^{x}\right)}^{10}\right)}}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    9. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\color{blue}{\left(e^{x}\right)}}^{10}\right)}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    10. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left({\left(e^{x}\right)}^{10}\right)}^{\left(\mathsf{neg}\left(x\right)\right)}}} \]
    11. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left({\color{blue}{\left(e^{x}\right)}}^{10}\right)}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    12. pow-expN/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left(e^{x \cdot 10}\right)}}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    13. *-commutativeN/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{\color{blue}{10 \cdot x}}\right)}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    14. lift-*.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{\color{blue}{10 \cdot x}}\right)}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    15. lower-exp.f6495.0

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left(e^{10 \cdot x}\right)}}^{\left(-x\right)}} \]
  6. Applied rewrites95.0%

    \[\leadsto \cos x \cdot \frac{1}{\color{blue}{{\left(e^{10 \cdot x}\right)}^{\left(-x\right)}}} \]
  7. Step-by-step derivation
    1. lift-exp.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left(e^{10 \cdot x}\right)}}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\left(e^{\color{blue}{10 \cdot x}}\right)}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    3. exp-prodN/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    4. lower-pow.f64N/A

      \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{\left(\mathsf{neg}\left(x\right)\right)}} \]
    5. lower-exp.f6498.0

      \[\leadsto \cos x \cdot \frac{1}{{\left({\color{blue}{\left(e^{10}\right)}}^{x}\right)}^{\left(-x\right)}} \]
  8. Applied rewrites98.0%

    \[\leadsto \cos x \cdot \frac{1}{{\color{blue}{\left({\left(e^{10}\right)}^{x}\right)}}^{\left(-x\right)}} \]
  9. Final simplification98.0%

    \[\leadsto \frac{1}{{\left({\left(e^{10}\right)}^{x}\right)}^{\left(-x\right)}} \cdot \cos x \]
  10. Add Preprocessing

Reproduce

?
herbie shell --seed 2024230 
(FPCore (x)
  :name "ENA, Section 1.4, Exercise 1"
  :precision binary64
  :pre (and (<= 1.99 x) (<= x 2.01))
  (* (cos x) (exp (* 10.0 (* x x)))))