mixedcos

Percentage Accurate: 65.4% → 99.1%
Time: 12.0s
Alternatives: 7
Speedup: 24.1×

Specification

?
\[\begin{array}{l} \\ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
double code(double x, double c, double s) {
	return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
public static double code(double x, double c, double s) {
	return Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * ((x * Math.pow(s, 2.0)) * x));
}
def code(x, c, s):
	return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
function code(x, c, s)
	return Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(Float64(x * (s ^ 2.0)) * x)))
end
function tmp = code(x, c, s)
	tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x));
end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \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 7 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: 65.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
double code(double x, double c, double s) {
	return cos((2.0 * x)) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    code = cos((2.0d0 * x)) / ((c ** 2.0d0) * ((x * (s ** 2.0d0)) * x))
end function
public static double code(double x, double c, double s) {
	return Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * ((x * Math.pow(s, 2.0)) * x));
}
def code(x, c, s):
	return math.cos((2.0 * x)) / (math.pow(c, 2.0) * ((x * math.pow(s, 2.0)) * x))
function code(x, c, s)
	return Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(Float64(x * (s ^ 2.0)) * x)))
end
function tmp = code(x, c, s)
	tmp = cos((2.0 * x)) / ((c ^ 2.0) * ((x * (s ^ 2.0)) * x));
end
code[x_, c_, s_] := N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\end{array}

Alternative 1: 99.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(x \cdot -2\right)\\ \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\ \;\;\;\;\frac{\frac{1}{x} \cdot \frac{t\_0}{s}}{c} \cdot \frac{\frac{1}{x \cdot s}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t\_0}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s}\\ \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (cos (* x -2.0))))
   (if (<=
        (/ (cos (* 2.0 x)) (* (pow c 2.0) (* x (* x (pow s 2.0)))))
        INFINITY)
     (* (/ (* (/ 1.0 x) (/ t_0 s)) c) (/ (/ 1.0 (* x s)) c))
     (* (/ (/ t_0 x) (* c s)) (/ (/ 1.0 x) (* c s))))))
double code(double x, double c, double s) {
	double t_0 = cos((x * -2.0));
	double tmp;
	if ((cos((2.0 * x)) / (pow(c, 2.0) * (x * (x * pow(s, 2.0))))) <= ((double) INFINITY)) {
		tmp = (((1.0 / x) * (t_0 / s)) / c) * ((1.0 / (x * s)) / c);
	} else {
		tmp = ((t_0 / x) / (c * s)) * ((1.0 / x) / (c * s));
	}
	return tmp;
}
public static double code(double x, double c, double s) {
	double t_0 = Math.cos((x * -2.0));
	double tmp;
	if ((Math.cos((2.0 * x)) / (Math.pow(c, 2.0) * (x * (x * Math.pow(s, 2.0))))) <= Double.POSITIVE_INFINITY) {
		tmp = (((1.0 / x) * (t_0 / s)) / c) * ((1.0 / (x * s)) / c);
	} else {
		tmp = ((t_0 / x) / (c * s)) * ((1.0 / x) / (c * s));
	}
	return tmp;
}
def code(x, c, s):
	t_0 = math.cos((x * -2.0))
	tmp = 0
	if (math.cos((2.0 * x)) / (math.pow(c, 2.0) * (x * (x * math.pow(s, 2.0))))) <= math.inf:
		tmp = (((1.0 / x) * (t_0 / s)) / c) * ((1.0 / (x * s)) / c)
	else:
		tmp = ((t_0 / x) / (c * s)) * ((1.0 / x) / (c * s))
	return tmp
function code(x, c, s)
	t_0 = cos(Float64(x * -2.0))
	tmp = 0.0
	if (Float64(cos(Float64(2.0 * x)) / Float64((c ^ 2.0) * Float64(x * Float64(x * (s ^ 2.0))))) <= Inf)
		tmp = Float64(Float64(Float64(Float64(1.0 / x) * Float64(t_0 / s)) / c) * Float64(Float64(1.0 / Float64(x * s)) / c));
	else
		tmp = Float64(Float64(Float64(t_0 / x) / Float64(c * s)) * Float64(Float64(1.0 / x) / Float64(c * s)));
	end
	return tmp
end
function tmp_2 = code(x, c, s)
	t_0 = cos((x * -2.0));
	tmp = 0.0;
	if ((cos((2.0 * x)) / ((c ^ 2.0) * (x * (x * (s ^ 2.0))))) <= Inf)
		tmp = (((1.0 / x) * (t_0 / s)) / c) * ((1.0 / (x * s)) / c);
	else
		tmp = ((t_0 / x) / (c * s)) * ((1.0 / x) / (c * s));
	end
	tmp_2 = tmp;
end
code[x_, c_, s_] := Block[{t$95$0 = N[Cos[N[(x * -2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(N[Power[c, 2.0], $MachinePrecision] * N[(x * N[(x * N[Power[s, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(N[(1.0 / x), $MachinePrecision] * N[(t$95$0 / s), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision] * N[(N[(1.0 / N[(x * s), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 / x), $MachinePrecision] / N[(c * s), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(x \cdot -2\right)\\
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\
\;\;\;\;\frac{\frac{1}{x} \cdot \frac{t\_0}{s}}{c} \cdot \frac{\frac{1}{x \cdot s}}{c}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x))) < +inf.0

    1. Initial program 78.3%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Step-by-step derivation
      1. associate-/l/78.3%

        \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}{{c}^{2}}} \]
      2. remove-double-neg78.3%

        \[\leadsto \frac{\color{blue}{-\left(-\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}\right)}}{{c}^{2}} \]
      3. distribute-frac-neg78.3%

        \[\leadsto \frac{-\color{blue}{\frac{-\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}}{{c}^{2}} \]
      4. distribute-neg-frac78.3%

        \[\leadsto \frac{\color{blue}{\frac{-\left(-\cos \left(2 \cdot x\right)\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}}{{c}^{2}} \]
      5. remove-double-neg78.3%

        \[\leadsto \frac{\frac{\color{blue}{\cos \left(2 \cdot x\right)}}{\left(x \cdot {s}^{2}\right) \cdot x}}{{c}^{2}} \]
      6. *-commutative78.3%

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{x \cdot \left(x \cdot {s}^{2}\right)}}}{{c}^{2}} \]
      7. associate-*r*72.4%

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(x \cdot x\right) \cdot {s}^{2}}}}{{c}^{2}} \]
      8. unpow272.4%

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{{x}^{2}} \cdot {s}^{2}}}{{c}^{2}} \]
      9. associate-/r*72.5%

        \[\leadsto \frac{\color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{{x}^{2}}}{{s}^{2}}}}{{c}^{2}} \]
      10. cos-neg72.5%

        \[\leadsto \frac{\frac{\frac{\color{blue}{\cos \left(-2 \cdot x\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
      11. *-commutative72.5%

        \[\leadsto \frac{\frac{\frac{\cos \left(-\color{blue}{x \cdot 2}\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
      12. distribute-rgt-neg-in72.5%

        \[\leadsto \frac{\frac{\frac{\cos \color{blue}{\left(x \cdot \left(-2\right)\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
      13. metadata-eval72.5%

        \[\leadsto \frac{\frac{\frac{\cos \left(x \cdot \color{blue}{-2}\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    3. Simplified72.5%

      \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(x \cdot -2\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity72.5%

        \[\leadsto \frac{\frac{\frac{\color{blue}{1 \cdot \cos \left(x \cdot -2\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
      2. unpow272.5%

        \[\leadsto \frac{\frac{\frac{1 \cdot \cos \left(x \cdot -2\right)}{\color{blue}{x \cdot x}}}{{s}^{2}}}{{c}^{2}} \]
      3. times-frac72.5%

        \[\leadsto \frac{\frac{\color{blue}{\frac{1}{x} \cdot \frac{\cos \left(x \cdot -2\right)}{x}}}{{s}^{2}}}{{c}^{2}} \]
      4. add-sqr-sqrt38.7%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \color{blue}{\left(\sqrt{x \cdot -2} \cdot \sqrt{x \cdot -2}\right)}}{x}}{{s}^{2}}}{{c}^{2}} \]
      5. sqrt-unprod57.1%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \color{blue}{\left(\sqrt{\left(x \cdot -2\right) \cdot \left(x \cdot -2\right)}\right)}}{x}}{{s}^{2}}}{{c}^{2}} \]
      6. *-commutative57.1%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{\left(-2 \cdot x\right)} \cdot \left(x \cdot -2\right)}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
      7. *-commutative57.1%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\left(-2 \cdot x\right) \cdot \color{blue}{\left(-2 \cdot x\right)}}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
      8. swap-sqr57.1%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{\left(-2 \cdot -2\right) \cdot \left(x \cdot x\right)}}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
      9. metadata-eval57.1%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{4} \cdot \left(x \cdot x\right)}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
      10. metadata-eval57.1%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{\left(2 \cdot 2\right)} \cdot \left(x \cdot x\right)}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
      11. swap-sqr57.1%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{\left(2 \cdot x\right) \cdot \left(2 \cdot x\right)}}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
      12. sqrt-unprod30.9%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \color{blue}{\left(\sqrt{2 \cdot x} \cdot \sqrt{2 \cdot x}\right)}}{x}}{{s}^{2}}}{{c}^{2}} \]
      13. add-sqr-sqrt72.5%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{x}}{{s}^{2}}}{{c}^{2}} \]
    6. Applied egg-rr72.5%

      \[\leadsto \frac{\frac{\color{blue}{\frac{1}{x} \cdot \frac{\cos \left(2 \cdot x\right)}{x}}}{{s}^{2}}}{{c}^{2}} \]
    7. Step-by-step derivation
      1. *-commutative72.5%

        \[\leadsto \frac{\frac{\color{blue}{\frac{\cos \left(2 \cdot x\right)}{x} \cdot \frac{1}{x}}}{{s}^{2}}}{{c}^{2}} \]
      2. unpow272.5%

        \[\leadsto \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{x} \cdot \frac{1}{x}}{\color{blue}{s \cdot s}}}{{c}^{2}} \]
      3. times-frac89.7%

        \[\leadsto \frac{\color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}}{{c}^{2}} \]
      4. add-sqr-sqrt37.4%

        \[\leadsto \frac{\frac{\frac{\cos \color{blue}{\left(\sqrt{2 \cdot x} \cdot \sqrt{2 \cdot x}\right)}}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}{{c}^{2}} \]
      5. sqrt-unprod67.0%

        \[\leadsto \frac{\frac{\frac{\cos \color{blue}{\left(\sqrt{\left(2 \cdot x\right) \cdot \left(2 \cdot x\right)}\right)}}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}{{c}^{2}} \]
      6. *-commutative67.0%

        \[\leadsto \frac{\frac{\frac{\cos \left(\sqrt{\color{blue}{\left(x \cdot 2\right)} \cdot \left(2 \cdot x\right)}\right)}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}{{c}^{2}} \]
      7. *-commutative67.0%

        \[\leadsto \frac{\frac{\frac{\cos \left(\sqrt{\left(x \cdot 2\right) \cdot \color{blue}{\left(x \cdot 2\right)}}\right)}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}{{c}^{2}} \]
      8. swap-sqr67.0%

        \[\leadsto \frac{\frac{\frac{\cos \left(\sqrt{\color{blue}{\left(x \cdot x\right) \cdot \left(2 \cdot 2\right)}}\right)}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}{{c}^{2}} \]
      9. metadata-eval67.0%

        \[\leadsto \frac{\frac{\frac{\cos \left(\sqrt{\left(x \cdot x\right) \cdot \color{blue}{4}}\right)}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}{{c}^{2}} \]
      10. metadata-eval67.0%

        \[\leadsto \frac{\frac{\frac{\cos \left(\sqrt{\left(x \cdot x\right) \cdot \color{blue}{\left(-2 \cdot -2\right)}}\right)}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}{{c}^{2}} \]
      11. swap-sqr67.0%

        \[\leadsto \frac{\frac{\frac{\cos \left(\sqrt{\color{blue}{\left(x \cdot -2\right) \cdot \left(x \cdot -2\right)}}\right)}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}{{c}^{2}} \]
      12. sqrt-unprod47.6%

        \[\leadsto \frac{\frac{\frac{\cos \color{blue}{\left(\sqrt{x \cdot -2} \cdot \sqrt{x \cdot -2}\right)}}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}{{c}^{2}} \]
      13. add-sqr-sqrt89.7%

        \[\leadsto \frac{\frac{\frac{\cos \color{blue}{\left(x \cdot -2\right)}}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}{{c}^{2}} \]
    8. Applied egg-rr89.7%

      \[\leadsto \frac{\color{blue}{\frac{\frac{\cos \left(x \cdot -2\right)}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}}{{c}^{2}} \]
    9. Step-by-step derivation
      1. unpow289.7%

        \[\leadsto \frac{\frac{\frac{\cos \left(x \cdot -2\right)}{x}}{s} \cdot \frac{\frac{1}{x}}{s}}{\color{blue}{c \cdot c}} \]
      2. times-frac99.6%

        \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(x \cdot -2\right)}{x}}{s}}{c} \cdot \frac{\frac{\frac{1}{x}}{s}}{c}} \]
      3. associate-/l/99.6%

        \[\leadsto \frac{\color{blue}{\frac{\cos \left(x \cdot -2\right)}{s \cdot x}}}{c} \cdot \frac{\frac{\frac{1}{x}}{s}}{c} \]
      4. *-commutative99.6%

        \[\leadsto \frac{\frac{\cos \left(x \cdot -2\right)}{\color{blue}{x \cdot s}}}{c} \cdot \frac{\frac{\frac{1}{x}}{s}}{c} \]
      5. associate-/l/99.6%

        \[\leadsto \frac{\frac{\cos \left(x \cdot -2\right)}{x \cdot s}}{c} \cdot \frac{\color{blue}{\frac{1}{s \cdot x}}}{c} \]
      6. *-commutative99.6%

        \[\leadsto \frac{\frac{\cos \left(x \cdot -2\right)}{x \cdot s}}{c} \cdot \frac{\frac{1}{\color{blue}{x \cdot s}}}{c} \]
    10. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(x \cdot -2\right)}{x \cdot s}}{c} \cdot \frac{\frac{1}{x \cdot s}}{c}} \]
    11. Step-by-step derivation
      1. *-un-lft-identity99.6%

        \[\leadsto \frac{\frac{\color{blue}{1 \cdot \cos \left(x \cdot -2\right)}}{x \cdot s}}{c} \cdot \frac{\frac{1}{x \cdot s}}{c} \]
      2. times-frac99.6%

        \[\leadsto \frac{\color{blue}{\frac{1}{x} \cdot \frac{\cos \left(x \cdot -2\right)}{s}}}{c} \cdot \frac{\frac{1}{x \cdot s}}{c} \]
    12. Applied egg-rr99.6%

      \[\leadsto \frac{\color{blue}{\frac{1}{x} \cdot \frac{\cos \left(x \cdot -2\right)}{s}}}{c} \cdot \frac{\frac{1}{x \cdot s}}{c} \]

    if +inf.0 < (/.f64 (cos.f64 (*.f64 #s(literal 2 binary64) x)) (*.f64 (pow.f64 c #s(literal 2 binary64)) (*.f64 (*.f64 x (pow.f64 s #s(literal 2 binary64))) x)))

    1. Initial program 0.0%

      \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
    2. Step-by-step derivation
      1. associate-/l/0.0%

        \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}{{c}^{2}}} \]
      2. remove-double-neg0.0%

        \[\leadsto \frac{\color{blue}{-\left(-\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}\right)}}{{c}^{2}} \]
      3. distribute-frac-neg0.0%

        \[\leadsto \frac{-\color{blue}{\frac{-\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}}{{c}^{2}} \]
      4. distribute-neg-frac0.0%

        \[\leadsto \frac{\color{blue}{\frac{-\left(-\cos \left(2 \cdot x\right)\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}}{{c}^{2}} \]
      5. remove-double-neg0.0%

        \[\leadsto \frac{\frac{\color{blue}{\cos \left(2 \cdot x\right)}}{\left(x \cdot {s}^{2}\right) \cdot x}}{{c}^{2}} \]
      6. *-commutative0.0%

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{x \cdot \left(x \cdot {s}^{2}\right)}}}{{c}^{2}} \]
      7. associate-*r*0.0%

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(x \cdot x\right) \cdot {s}^{2}}}}{{c}^{2}} \]
      8. unpow20.0%

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{{x}^{2}} \cdot {s}^{2}}}{{c}^{2}} \]
      9. associate-/r*0.0%

        \[\leadsto \frac{\color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{{x}^{2}}}{{s}^{2}}}}{{c}^{2}} \]
      10. cos-neg0.0%

        \[\leadsto \frac{\frac{\frac{\color{blue}{\cos \left(-2 \cdot x\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
      11. *-commutative0.0%

        \[\leadsto \frac{\frac{\frac{\cos \left(-\color{blue}{x \cdot 2}\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
      12. distribute-rgt-neg-in0.0%

        \[\leadsto \frac{\frac{\frac{\cos \color{blue}{\left(x \cdot \left(-2\right)\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
      13. metadata-eval0.0%

        \[\leadsto \frac{\frac{\frac{\cos \left(x \cdot \color{blue}{-2}\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    3. Simplified0.0%

      \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(x \cdot -2\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity0.0%

        \[\leadsto \frac{\frac{\frac{\color{blue}{1 \cdot \cos \left(x \cdot -2\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
      2. unpow20.0%

        \[\leadsto \frac{\frac{\frac{1 \cdot \cos \left(x \cdot -2\right)}{\color{blue}{x \cdot x}}}{{s}^{2}}}{{c}^{2}} \]
      3. times-frac0.0%

        \[\leadsto \frac{\frac{\color{blue}{\frac{1}{x} \cdot \frac{\cos \left(x \cdot -2\right)}{x}}}{{s}^{2}}}{{c}^{2}} \]
      4. add-sqr-sqrt0.0%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \color{blue}{\left(\sqrt{x \cdot -2} \cdot \sqrt{x \cdot -2}\right)}}{x}}{{s}^{2}}}{{c}^{2}} \]
      5. sqrt-unprod0.0%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \color{blue}{\left(\sqrt{\left(x \cdot -2\right) \cdot \left(x \cdot -2\right)}\right)}}{x}}{{s}^{2}}}{{c}^{2}} \]
      6. *-commutative0.0%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{\left(-2 \cdot x\right)} \cdot \left(x \cdot -2\right)}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
      7. *-commutative0.0%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\left(-2 \cdot x\right) \cdot \color{blue}{\left(-2 \cdot x\right)}}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
      8. swap-sqr0.0%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{\left(-2 \cdot -2\right) \cdot \left(x \cdot x\right)}}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
      9. metadata-eval0.0%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{4} \cdot \left(x \cdot x\right)}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
      10. metadata-eval0.0%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{\left(2 \cdot 2\right)} \cdot \left(x \cdot x\right)}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
      11. swap-sqr0.0%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{\left(2 \cdot x\right) \cdot \left(2 \cdot x\right)}}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
      12. sqrt-unprod0.0%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \color{blue}{\left(\sqrt{2 \cdot x} \cdot \sqrt{2 \cdot x}\right)}}{x}}{{s}^{2}}}{{c}^{2}} \]
      13. add-sqr-sqrt0.0%

        \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{x}}{{s}^{2}}}{{c}^{2}} \]
    6. Applied egg-rr0.0%

      \[\leadsto \frac{\frac{\color{blue}{\frac{1}{x} \cdot \frac{\cos \left(2 \cdot x\right)}{x}}}{{s}^{2}}}{{c}^{2}} \]
    7. Step-by-step derivation
      1. associate-/l/0.5%

        \[\leadsto \color{blue}{\frac{\frac{1}{x} \cdot \frac{\cos \left(2 \cdot x\right)}{x}}{{c}^{2} \cdot {s}^{2}}} \]
      2. *-commutative0.5%

        \[\leadsto \frac{\color{blue}{\frac{\cos \left(2 \cdot x\right)}{x} \cdot \frac{1}{x}}}{{c}^{2} \cdot {s}^{2}} \]
      3. unpow-prod-down71.7%

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x} \cdot \frac{1}{x}}{\color{blue}{{\left(c \cdot s\right)}^{2}}} \]
      4. unpow271.7%

        \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x} \cdot \frac{1}{x}}{\color{blue}{\left(c \cdot s\right) \cdot \left(c \cdot s\right)}} \]
      5. times-frac99.3%

        \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s}} \]
      6. add-sqr-sqrt45.1%

        \[\leadsto \frac{\frac{\cos \color{blue}{\left(\sqrt{2 \cdot x} \cdot \sqrt{2 \cdot x}\right)}}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
      7. sqrt-unprod67.4%

        \[\leadsto \frac{\frac{\cos \color{blue}{\left(\sqrt{\left(2 \cdot x\right) \cdot \left(2 \cdot x\right)}\right)}}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
      8. *-commutative67.4%

        \[\leadsto \frac{\frac{\cos \left(\sqrt{\color{blue}{\left(x \cdot 2\right)} \cdot \left(2 \cdot x\right)}\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
      9. *-commutative67.4%

        \[\leadsto \frac{\frac{\cos \left(\sqrt{\left(x \cdot 2\right) \cdot \color{blue}{\left(x \cdot 2\right)}}\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
      10. swap-sqr67.4%

        \[\leadsto \frac{\frac{\cos \left(\sqrt{\color{blue}{\left(x \cdot x\right) \cdot \left(2 \cdot 2\right)}}\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
      11. metadata-eval67.4%

        \[\leadsto \frac{\frac{\cos \left(\sqrt{\left(x \cdot x\right) \cdot \color{blue}{4}}\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
      12. metadata-eval67.4%

        \[\leadsto \frac{\frac{\cos \left(\sqrt{\left(x \cdot x\right) \cdot \color{blue}{\left(-2 \cdot -2\right)}}\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
      13. swap-sqr67.4%

        \[\leadsto \frac{\frac{\cos \left(\sqrt{\color{blue}{\left(x \cdot -2\right) \cdot \left(x \cdot -2\right)}}\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
      14. sqrt-unprod43.3%

        \[\leadsto \frac{\frac{\cos \color{blue}{\left(\sqrt{x \cdot -2} \cdot \sqrt{x \cdot -2}\right)}}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
      15. add-sqr-sqrt99.3%

        \[\leadsto \frac{\frac{\cos \color{blue}{\left(x \cdot -2\right)}}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
    8. Applied egg-rr99.3%

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(x \cdot -2\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(x \cdot \left(x \cdot {s}^{2}\right)\right)} \leq \infty:\\ \;\;\;\;\frac{\frac{1}{x} \cdot \frac{\cos \left(x \cdot -2\right)}{s}}{c} \cdot \frac{\frac{1}{x \cdot s}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cos \left(x \cdot -2\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 97.1% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \frac{\frac{\cos \left(x \cdot -2\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (* (/ (/ (cos (* x -2.0)) x) (* c s)) (/ (/ 1.0 x) (* c s))))
double code(double x, double c, double s) {
	return ((cos((x * -2.0)) / x) / (c * s)) * ((1.0 / x) / (c * s));
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    code = ((cos((x * (-2.0d0))) / x) / (c * s)) * ((1.0d0 / x) / (c * s))
end function
public static double code(double x, double c, double s) {
	return ((Math.cos((x * -2.0)) / x) / (c * s)) * ((1.0 / x) / (c * s));
}
def code(x, c, s):
	return ((math.cos((x * -2.0)) / x) / (c * s)) * ((1.0 / x) / (c * s))
function code(x, c, s)
	return Float64(Float64(Float64(cos(Float64(x * -2.0)) / x) / Float64(c * s)) * Float64(Float64(1.0 / x) / Float64(c * s)))
end
function tmp = code(x, c, s)
	tmp = ((cos((x * -2.0)) / x) / (c * s)) * ((1.0 / x) / (c * s));
end
code[x_, c_, s_] := N[(N[(N[(N[Cos[N[(x * -2.0), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision] / N[(c * s), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{\cos \left(x \cdot -2\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s}
\end{array}
Derivation
  1. Initial program 62.1%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Step-by-step derivation
    1. associate-/l/62.1%

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}{{c}^{2}}} \]
    2. remove-double-neg62.1%

      \[\leadsto \frac{\color{blue}{-\left(-\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}\right)}}{{c}^{2}} \]
    3. distribute-frac-neg62.1%

      \[\leadsto \frac{-\color{blue}{\frac{-\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}}{{c}^{2}} \]
    4. distribute-neg-frac62.1%

      \[\leadsto \frac{\color{blue}{\frac{-\left(-\cos \left(2 \cdot x\right)\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}}{{c}^{2}} \]
    5. remove-double-neg62.1%

      \[\leadsto \frac{\frac{\color{blue}{\cos \left(2 \cdot x\right)}}{\left(x \cdot {s}^{2}\right) \cdot x}}{{c}^{2}} \]
    6. *-commutative62.1%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{x \cdot \left(x \cdot {s}^{2}\right)}}}{{c}^{2}} \]
    7. associate-*r*57.4%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(x \cdot x\right) \cdot {s}^{2}}}}{{c}^{2}} \]
    8. unpow257.4%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{{x}^{2}} \cdot {s}^{2}}}{{c}^{2}} \]
    9. associate-/r*57.5%

      \[\leadsto \frac{\color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{{x}^{2}}}{{s}^{2}}}}{{c}^{2}} \]
    10. cos-neg57.5%

      \[\leadsto \frac{\frac{\frac{\color{blue}{\cos \left(-2 \cdot x\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    11. *-commutative57.5%

      \[\leadsto \frac{\frac{\frac{\cos \left(-\color{blue}{x \cdot 2}\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    12. distribute-rgt-neg-in57.5%

      \[\leadsto \frac{\frac{\frac{\cos \color{blue}{\left(x \cdot \left(-2\right)\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    13. metadata-eval57.5%

      \[\leadsto \frac{\frac{\frac{\cos \left(x \cdot \color{blue}{-2}\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
  3. Simplified57.5%

    \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(x \cdot -2\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. *-un-lft-identity57.5%

      \[\leadsto \frac{\frac{\frac{\color{blue}{1 \cdot \cos \left(x \cdot -2\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    2. unpow257.5%

      \[\leadsto \frac{\frac{\frac{1 \cdot \cos \left(x \cdot -2\right)}{\color{blue}{x \cdot x}}}{{s}^{2}}}{{c}^{2}} \]
    3. times-frac57.5%

      \[\leadsto \frac{\frac{\color{blue}{\frac{1}{x} \cdot \frac{\cos \left(x \cdot -2\right)}{x}}}{{s}^{2}}}{{c}^{2}} \]
    4. add-sqr-sqrt30.7%

      \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \color{blue}{\left(\sqrt{x \cdot -2} \cdot \sqrt{x \cdot -2}\right)}}{x}}{{s}^{2}}}{{c}^{2}} \]
    5. sqrt-unprod45.3%

      \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \color{blue}{\left(\sqrt{\left(x \cdot -2\right) \cdot \left(x \cdot -2\right)}\right)}}{x}}{{s}^{2}}}{{c}^{2}} \]
    6. *-commutative45.3%

      \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{\left(-2 \cdot x\right)} \cdot \left(x \cdot -2\right)}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
    7. *-commutative45.3%

      \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\left(-2 \cdot x\right) \cdot \color{blue}{\left(-2 \cdot x\right)}}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
    8. swap-sqr45.3%

      \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{\left(-2 \cdot -2\right) \cdot \left(x \cdot x\right)}}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
    9. metadata-eval45.3%

      \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{4} \cdot \left(x \cdot x\right)}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
    10. metadata-eval45.3%

      \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{\left(2 \cdot 2\right)} \cdot \left(x \cdot x\right)}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
    11. swap-sqr45.3%

      \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \left(\sqrt{\color{blue}{\left(2 \cdot x\right) \cdot \left(2 \cdot x\right)}}\right)}{x}}{{s}^{2}}}{{c}^{2}} \]
    12. sqrt-unprod24.5%

      \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \color{blue}{\left(\sqrt{2 \cdot x} \cdot \sqrt{2 \cdot x}\right)}}{x}}{{s}^{2}}}{{c}^{2}} \]
    13. add-sqr-sqrt57.5%

      \[\leadsto \frac{\frac{\frac{1}{x} \cdot \frac{\cos \color{blue}{\left(2 \cdot x\right)}}{x}}{{s}^{2}}}{{c}^{2}} \]
  6. Applied egg-rr57.5%

    \[\leadsto \frac{\frac{\color{blue}{\frac{1}{x} \cdot \frac{\cos \left(2 \cdot x\right)}{x}}}{{s}^{2}}}{{c}^{2}} \]
  7. Step-by-step derivation
    1. associate-/l/57.5%

      \[\leadsto \color{blue}{\frac{\frac{1}{x} \cdot \frac{\cos \left(2 \cdot x\right)}{x}}{{c}^{2} \cdot {s}^{2}}} \]
    2. *-commutative57.5%

      \[\leadsto \frac{\color{blue}{\frac{\cos \left(2 \cdot x\right)}{x} \cdot \frac{1}{x}}}{{c}^{2} \cdot {s}^{2}} \]
    3. unpow-prod-down77.3%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x} \cdot \frac{1}{x}}{\color{blue}{{\left(c \cdot s\right)}^{2}}} \]
    4. unpow277.3%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{x} \cdot \frac{1}{x}}{\color{blue}{\left(c \cdot s\right) \cdot \left(c \cdot s\right)}} \]
    5. times-frac97.3%

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s}} \]
    6. add-sqr-sqrt41.5%

      \[\leadsto \frac{\frac{\cos \color{blue}{\left(\sqrt{2 \cdot x} \cdot \sqrt{2 \cdot x}\right)}}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
    7. sqrt-unprod72.2%

      \[\leadsto \frac{\frac{\cos \color{blue}{\left(\sqrt{\left(2 \cdot x\right) \cdot \left(2 \cdot x\right)}\right)}}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
    8. *-commutative72.2%

      \[\leadsto \frac{\frac{\cos \left(\sqrt{\color{blue}{\left(x \cdot 2\right)} \cdot \left(2 \cdot x\right)}\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
    9. *-commutative72.2%

      \[\leadsto \frac{\frac{\cos \left(\sqrt{\left(x \cdot 2\right) \cdot \color{blue}{\left(x \cdot 2\right)}}\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
    10. swap-sqr72.2%

      \[\leadsto \frac{\frac{\cos \left(\sqrt{\color{blue}{\left(x \cdot x\right) \cdot \left(2 \cdot 2\right)}}\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
    11. metadata-eval72.2%

      \[\leadsto \frac{\frac{\cos \left(\sqrt{\left(x \cdot x\right) \cdot \color{blue}{4}}\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
    12. metadata-eval72.2%

      \[\leadsto \frac{\frac{\cos \left(\sqrt{\left(x \cdot x\right) \cdot \color{blue}{\left(-2 \cdot -2\right)}}\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
    13. swap-sqr72.2%

      \[\leadsto \frac{\frac{\cos \left(\sqrt{\color{blue}{\left(x \cdot -2\right) \cdot \left(x \cdot -2\right)}}\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
    14. sqrt-unprod49.1%

      \[\leadsto \frac{\frac{\cos \color{blue}{\left(\sqrt{x \cdot -2} \cdot \sqrt{x \cdot -2}\right)}}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
    15. add-sqr-sqrt97.3%

      \[\leadsto \frac{\frac{\cos \color{blue}{\left(x \cdot -2\right)}}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s} \]
  8. Applied egg-rr97.3%

    \[\leadsto \color{blue}{\frac{\frac{\cos \left(x \cdot -2\right)}{x}}{c \cdot s} \cdot \frac{\frac{1}{x}}{c \cdot s}} \]
  9. Add Preprocessing

Alternative 3: 97.2% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ \frac{1}{t\_0} \cdot \frac{\cos \left(x \cdot -2\right)}{t\_0} \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s)))) (* (/ 1.0 t_0) (/ (cos (* x -2.0)) t_0))))
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return (1.0 / t_0) * (cos((x * -2.0)) / t_0);
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    real(8) :: t_0
    t_0 = c * (x * s)
    code = (1.0d0 / t_0) * (cos((x * (-2.0d0))) / t_0)
end function
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return (1.0 / t_0) * (Math.cos((x * -2.0)) / t_0);
}
def code(x, c, s):
	t_0 = c * (x * s)
	return (1.0 / t_0) * (math.cos((x * -2.0)) / t_0)
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	return Float64(Float64(1.0 / t_0) * Float64(cos(Float64(x * -2.0)) / t_0))
end
function tmp = code(x, c, s)
	t_0 = c * (x * s);
	tmp = (1.0 / t_0) * (cos((x * -2.0)) / t_0);
end
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[Cos[N[(x * -2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\frac{1}{t\_0} \cdot \frac{\cos \left(x \cdot -2\right)}{t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 62.1%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Step-by-step derivation
    1. associate-/l/62.1%

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}{{c}^{2}}} \]
    2. remove-double-neg62.1%

      \[\leadsto \frac{\color{blue}{-\left(-\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}\right)}}{{c}^{2}} \]
    3. distribute-frac-neg62.1%

      \[\leadsto \frac{-\color{blue}{\frac{-\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}}{{c}^{2}} \]
    4. distribute-neg-frac62.1%

      \[\leadsto \frac{\color{blue}{\frac{-\left(-\cos \left(2 \cdot x\right)\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}}{{c}^{2}} \]
    5. remove-double-neg62.1%

      \[\leadsto \frac{\frac{\color{blue}{\cos \left(2 \cdot x\right)}}{\left(x \cdot {s}^{2}\right) \cdot x}}{{c}^{2}} \]
    6. *-commutative62.1%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{x \cdot \left(x \cdot {s}^{2}\right)}}}{{c}^{2}} \]
    7. associate-*r*57.4%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(x \cdot x\right) \cdot {s}^{2}}}}{{c}^{2}} \]
    8. unpow257.4%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{{x}^{2}} \cdot {s}^{2}}}{{c}^{2}} \]
    9. associate-/r*57.5%

      \[\leadsto \frac{\color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{{x}^{2}}}{{s}^{2}}}}{{c}^{2}} \]
    10. cos-neg57.5%

      \[\leadsto \frac{\frac{\frac{\color{blue}{\cos \left(-2 \cdot x\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    11. *-commutative57.5%

      \[\leadsto \frac{\frac{\frac{\cos \left(-\color{blue}{x \cdot 2}\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    12. distribute-rgt-neg-in57.5%

      \[\leadsto \frac{\frac{\frac{\cos \color{blue}{\left(x \cdot \left(-2\right)\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    13. metadata-eval57.5%

      \[\leadsto \frac{\frac{\frac{\cos \left(x \cdot \color{blue}{-2}\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
  3. Simplified57.5%

    \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(x \cdot -2\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around inf 57.4%

    \[\leadsto \color{blue}{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
  6. Step-by-step derivation
    1. associate-/r*57.0%

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{{s}^{2} \cdot {x}^{2}}} \]
    2. unpow257.0%

      \[\leadsto \frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{\color{blue}{\left(s \cdot s\right)} \cdot {x}^{2}} \]
    3. unpow257.0%

      \[\leadsto \frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{\left(s \cdot s\right) \cdot \color{blue}{\left(x \cdot x\right)}} \]
    4. swap-sqr73.0%

      \[\leadsto \frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{\color{blue}{\left(s \cdot x\right) \cdot \left(s \cdot x\right)}} \]
    5. unpow273.0%

      \[\leadsto \frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{\color{blue}{{\left(s \cdot x\right)}^{2}}} \]
    6. associate-/r*73.3%

      \[\leadsto \color{blue}{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2} \cdot {\left(s \cdot x\right)}^{2}}} \]
    7. *-commutative73.3%

      \[\leadsto \frac{\cos \color{blue}{\left(x \cdot -2\right)}}{{c}^{2} \cdot {\left(s \cdot x\right)}^{2}} \]
    8. unpow273.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot c\right)} \cdot {\left(s \cdot x\right)}^{2}} \]
    9. rem-square-sqrt73.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\left(c \cdot c\right) \cdot \color{blue}{\left(\sqrt{{\left(s \cdot x\right)}^{2}} \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}} \]
    10. swap-sqr85.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right) \cdot \left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}} \]
    11. unpow285.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{{\left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}^{2}}} \]
    12. unpow285.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{{\left(c \cdot \sqrt{\color{blue}{\left(s \cdot x\right) \cdot \left(s \cdot x\right)}}\right)}^{2}} \]
    13. rem-sqrt-square96.2%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{{\left(c \cdot \color{blue}{\left|s \cdot x\right|}\right)}^{2}} \]
  7. Simplified96.2%

    \[\leadsto \color{blue}{\frac{\cos \left(x \cdot -2\right)}{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}} \]
  8. Step-by-step derivation
    1. *-un-lft-identity96.2%

      \[\leadsto \frac{\color{blue}{1 \cdot \cos \left(x \cdot -2\right)}}{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}} \]
    2. unpow296.2%

      \[\leadsto \frac{1 \cdot \cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot \left|s \cdot x\right|\right) \cdot \left(c \cdot \left|s \cdot x\right|\right)}} \]
    3. times-frac96.6%

      \[\leadsto \color{blue}{\frac{1}{c \cdot \left|s \cdot x\right|} \cdot \frac{\cos \left(x \cdot -2\right)}{c \cdot \left|s \cdot x\right|}} \]
    4. add-sqr-sqrt59.9%

      \[\leadsto \frac{1}{c \cdot \left|\color{blue}{\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}}\right|} \cdot \frac{\cos \left(x \cdot -2\right)}{c \cdot \left|s \cdot x\right|} \]
    5. fabs-sqr59.9%

      \[\leadsto \frac{1}{c \cdot \color{blue}{\left(\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}\right)}} \cdot \frac{\cos \left(x \cdot -2\right)}{c \cdot \left|s \cdot x\right|} \]
    6. add-sqr-sqrt69.6%

      \[\leadsto \frac{1}{c \cdot \color{blue}{\left(s \cdot x\right)}} \cdot \frac{\cos \left(x \cdot -2\right)}{c \cdot \left|s \cdot x\right|} \]
    7. add-sqr-sqrt56.4%

      \[\leadsto \frac{1}{c \cdot \left(s \cdot x\right)} \cdot \frac{\cos \left(x \cdot -2\right)}{c \cdot \left|\color{blue}{\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}}\right|} \]
    8. fabs-sqr56.4%

      \[\leadsto \frac{1}{c \cdot \left(s \cdot x\right)} \cdot \frac{\cos \left(x \cdot -2\right)}{c \cdot \color{blue}{\left(\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}\right)}} \]
    9. add-sqr-sqrt96.6%

      \[\leadsto \frac{1}{c \cdot \left(s \cdot x\right)} \cdot \frac{\cos \left(x \cdot -2\right)}{c \cdot \color{blue}{\left(s \cdot x\right)}} \]
  9. Applied egg-rr96.6%

    \[\leadsto \color{blue}{\frac{1}{c \cdot \left(s \cdot x\right)} \cdot \frac{\cos \left(x \cdot -2\right)}{c \cdot \left(s \cdot x\right)}} \]
  10. Final simplification96.6%

    \[\leadsto \frac{1}{c \cdot \left(x \cdot s\right)} \cdot \frac{\cos \left(x \cdot -2\right)}{c \cdot \left(x \cdot s\right)} \]
  11. Add Preprocessing

Alternative 4: 97.0% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ \frac{\cos \left(x \cdot -2\right)}{t\_0 \cdot t\_0} \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s)))) (/ (cos (* x -2.0)) (* t_0 t_0))))
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return cos((x * -2.0)) / (t_0 * t_0);
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    real(8) :: t_0
    t_0 = c * (x * s)
    code = cos((x * (-2.0d0))) / (t_0 * t_0)
end function
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return Math.cos((x * -2.0)) / (t_0 * t_0);
}
def code(x, c, s):
	t_0 = c * (x * s)
	return math.cos((x * -2.0)) / (t_0 * t_0)
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	return Float64(cos(Float64(x * -2.0)) / Float64(t_0 * t_0))
end
function tmp = code(x, c, s)
	t_0 = c * (x * s);
	tmp = cos((x * -2.0)) / (t_0 * t_0);
end
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(N[Cos[N[(x * -2.0), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\frac{\cos \left(x \cdot -2\right)}{t\_0 \cdot t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 62.1%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Step-by-step derivation
    1. associate-/l/62.1%

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}{{c}^{2}}} \]
    2. remove-double-neg62.1%

      \[\leadsto \frac{\color{blue}{-\left(-\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}\right)}}{{c}^{2}} \]
    3. distribute-frac-neg62.1%

      \[\leadsto \frac{-\color{blue}{\frac{-\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}}{{c}^{2}} \]
    4. distribute-neg-frac62.1%

      \[\leadsto \frac{\color{blue}{\frac{-\left(-\cos \left(2 \cdot x\right)\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}}{{c}^{2}} \]
    5. remove-double-neg62.1%

      \[\leadsto \frac{\frac{\color{blue}{\cos \left(2 \cdot x\right)}}{\left(x \cdot {s}^{2}\right) \cdot x}}{{c}^{2}} \]
    6. *-commutative62.1%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{x \cdot \left(x \cdot {s}^{2}\right)}}}{{c}^{2}} \]
    7. associate-*r*57.4%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(x \cdot x\right) \cdot {s}^{2}}}}{{c}^{2}} \]
    8. unpow257.4%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{{x}^{2}} \cdot {s}^{2}}}{{c}^{2}} \]
    9. associate-/r*57.5%

      \[\leadsto \frac{\color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{{x}^{2}}}{{s}^{2}}}}{{c}^{2}} \]
    10. cos-neg57.5%

      \[\leadsto \frac{\frac{\frac{\color{blue}{\cos \left(-2 \cdot x\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    11. *-commutative57.5%

      \[\leadsto \frac{\frac{\frac{\cos \left(-\color{blue}{x \cdot 2}\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    12. distribute-rgt-neg-in57.5%

      \[\leadsto \frac{\frac{\frac{\cos \color{blue}{\left(x \cdot \left(-2\right)\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    13. metadata-eval57.5%

      \[\leadsto \frac{\frac{\frac{\cos \left(x \cdot \color{blue}{-2}\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
  3. Simplified57.5%

    \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(x \cdot -2\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around inf 57.4%

    \[\leadsto \color{blue}{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
  6. Step-by-step derivation
    1. associate-/r*57.0%

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{{s}^{2} \cdot {x}^{2}}} \]
    2. unpow257.0%

      \[\leadsto \frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{\color{blue}{\left(s \cdot s\right)} \cdot {x}^{2}} \]
    3. unpow257.0%

      \[\leadsto \frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{\left(s \cdot s\right) \cdot \color{blue}{\left(x \cdot x\right)}} \]
    4. swap-sqr73.0%

      \[\leadsto \frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{\color{blue}{\left(s \cdot x\right) \cdot \left(s \cdot x\right)}} \]
    5. unpow273.0%

      \[\leadsto \frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{\color{blue}{{\left(s \cdot x\right)}^{2}}} \]
    6. associate-/r*73.3%

      \[\leadsto \color{blue}{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2} \cdot {\left(s \cdot x\right)}^{2}}} \]
    7. *-commutative73.3%

      \[\leadsto \frac{\cos \color{blue}{\left(x \cdot -2\right)}}{{c}^{2} \cdot {\left(s \cdot x\right)}^{2}} \]
    8. unpow273.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot c\right)} \cdot {\left(s \cdot x\right)}^{2}} \]
    9. rem-square-sqrt73.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\left(c \cdot c\right) \cdot \color{blue}{\left(\sqrt{{\left(s \cdot x\right)}^{2}} \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}} \]
    10. swap-sqr85.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right) \cdot \left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}} \]
    11. unpow285.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{{\left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}^{2}}} \]
    12. unpow285.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{{\left(c \cdot \sqrt{\color{blue}{\left(s \cdot x\right) \cdot \left(s \cdot x\right)}}\right)}^{2}} \]
    13. rem-sqrt-square96.2%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{{\left(c \cdot \color{blue}{\left|s \cdot x\right|}\right)}^{2}} \]
  7. Simplified96.2%

    \[\leadsto \color{blue}{\frac{\cos \left(x \cdot -2\right)}{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}} \]
  8. Step-by-step derivation
    1. unpow-prod-down73.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{{c}^{2} \cdot {\left(\left|s \cdot x\right|\right)}^{2}}} \]
    2. unpow273.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot c\right)} \cdot {\left(\left|s \cdot x\right|\right)}^{2}} \]
    3. pow273.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\left(c \cdot c\right) \cdot \color{blue}{\left(\left|s \cdot x\right| \cdot \left|s \cdot x\right|\right)}} \]
    4. sqr-abs73.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\left(c \cdot c\right) \cdot \color{blue}{\left(\left(s \cdot x\right) \cdot \left(s \cdot x\right)\right)}} \]
    5. swap-sqr96.2%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left(s \cdot x\right)\right)}} \]
  9. Applied egg-rr96.2%

    \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left(s \cdot x\right)\right)}} \]
  10. Final simplification96.2%

    \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)} \]
  11. Add Preprocessing

Alternative 5: 78.5% accurate, 3.0× speedup?

\[\begin{array}{l} \\ {\left(c \cdot \left(x \cdot s\right)\right)}^{-2} \end{array} \]
(FPCore (x c s) :precision binary64 (pow (* c (* x s)) -2.0))
double code(double x, double c, double s) {
	return pow((c * (x * s)), -2.0);
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    code = (c * (x * s)) ** (-2.0d0)
end function
public static double code(double x, double c, double s) {
	return Math.pow((c * (x * s)), -2.0);
}
def code(x, c, s):
	return math.pow((c * (x * s)), -2.0)
function code(x, c, s)
	return Float64(c * Float64(x * s)) ^ -2.0
end
function tmp = code(x, c, s)
	tmp = (c * (x * s)) ^ -2.0;
end
code[x_, c_, s_] := N[Power[N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}

\\
{\left(c \cdot \left(x \cdot s\right)\right)}^{-2}
\end{array}
Derivation
  1. Initial program 62.1%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Step-by-step derivation
    1. associate-/l/62.1%

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}{{c}^{2}}} \]
    2. remove-double-neg62.1%

      \[\leadsto \frac{\color{blue}{-\left(-\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}\right)}}{{c}^{2}} \]
    3. distribute-frac-neg62.1%

      \[\leadsto \frac{-\color{blue}{\frac{-\cos \left(2 \cdot x\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}}{{c}^{2}} \]
    4. distribute-neg-frac62.1%

      \[\leadsto \frac{\color{blue}{\frac{-\left(-\cos \left(2 \cdot x\right)\right)}{\left(x \cdot {s}^{2}\right) \cdot x}}}{{c}^{2}} \]
    5. remove-double-neg62.1%

      \[\leadsto \frac{\frac{\color{blue}{\cos \left(2 \cdot x\right)}}{\left(x \cdot {s}^{2}\right) \cdot x}}{{c}^{2}} \]
    6. *-commutative62.1%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{x \cdot \left(x \cdot {s}^{2}\right)}}}{{c}^{2}} \]
    7. associate-*r*57.4%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(x \cdot x\right) \cdot {s}^{2}}}}{{c}^{2}} \]
    8. unpow257.4%

      \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\color{blue}{{x}^{2}} \cdot {s}^{2}}}{{c}^{2}} \]
    9. associate-/r*57.5%

      \[\leadsto \frac{\color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{{x}^{2}}}{{s}^{2}}}}{{c}^{2}} \]
    10. cos-neg57.5%

      \[\leadsto \frac{\frac{\frac{\color{blue}{\cos \left(-2 \cdot x\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    11. *-commutative57.5%

      \[\leadsto \frac{\frac{\frac{\cos \left(-\color{blue}{x \cdot 2}\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    12. distribute-rgt-neg-in57.5%

      \[\leadsto \frac{\frac{\frac{\cos \color{blue}{\left(x \cdot \left(-2\right)\right)}}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
    13. metadata-eval57.5%

      \[\leadsto \frac{\frac{\frac{\cos \left(x \cdot \color{blue}{-2}\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}} \]
  3. Simplified57.5%

    \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(x \cdot -2\right)}{{x}^{2}}}{{s}^{2}}}{{c}^{2}}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around inf 57.4%

    \[\leadsto \color{blue}{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
  6. Step-by-step derivation
    1. associate-/r*57.0%

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{{s}^{2} \cdot {x}^{2}}} \]
    2. unpow257.0%

      \[\leadsto \frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{\color{blue}{\left(s \cdot s\right)} \cdot {x}^{2}} \]
    3. unpow257.0%

      \[\leadsto \frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{\left(s \cdot s\right) \cdot \color{blue}{\left(x \cdot x\right)}} \]
    4. swap-sqr73.0%

      \[\leadsto \frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{\color{blue}{\left(s \cdot x\right) \cdot \left(s \cdot x\right)}} \]
    5. unpow273.0%

      \[\leadsto \frac{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2}}}{\color{blue}{{\left(s \cdot x\right)}^{2}}} \]
    6. associate-/r*73.3%

      \[\leadsto \color{blue}{\frac{\cos \left(-2 \cdot x\right)}{{c}^{2} \cdot {\left(s \cdot x\right)}^{2}}} \]
    7. *-commutative73.3%

      \[\leadsto \frac{\cos \color{blue}{\left(x \cdot -2\right)}}{{c}^{2} \cdot {\left(s \cdot x\right)}^{2}} \]
    8. unpow273.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot c\right)} \cdot {\left(s \cdot x\right)}^{2}} \]
    9. rem-square-sqrt73.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\left(c \cdot c\right) \cdot \color{blue}{\left(\sqrt{{\left(s \cdot x\right)}^{2}} \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}} \]
    10. swap-sqr85.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right) \cdot \left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}} \]
    11. unpow285.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{{\left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}^{2}}} \]
    12. unpow285.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{{\left(c \cdot \sqrt{\color{blue}{\left(s \cdot x\right) \cdot \left(s \cdot x\right)}}\right)}^{2}} \]
    13. rem-sqrt-square96.2%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{{\left(c \cdot \color{blue}{\left|s \cdot x\right|}\right)}^{2}} \]
  7. Simplified96.2%

    \[\leadsto \color{blue}{\frac{\cos \left(x \cdot -2\right)}{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}} \]
  8. Taylor expanded in x around 0 63.7%

    \[\leadsto \color{blue}{\frac{1}{{c}^{2} \cdot {\left(\left|s \cdot x\right|\right)}^{2}}} \]
  9. Step-by-step derivation
    1. associate-/r*63.5%

      \[\leadsto \color{blue}{\frac{\frac{1}{{c}^{2}}}{{\left(\left|s \cdot x\right|\right)}^{2}}} \]
    2. unpow263.5%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\color{blue}{\left|s \cdot x\right| \cdot \left|s \cdot x\right|}} \]
    3. sqr-abs63.5%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\color{blue}{\left(s \cdot x\right) \cdot \left(s \cdot x\right)}} \]
    4. unpow263.5%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\color{blue}{{\left(s \cdot x\right)}^{2}}} \]
    5. associate-/r*63.7%

      \[\leadsto \color{blue}{\frac{1}{{c}^{2} \cdot {\left(s \cdot x\right)}^{2}}} \]
    6. unpow263.7%

      \[\leadsto \frac{1}{\color{blue}{\left(c \cdot c\right)} \cdot {\left(s \cdot x\right)}^{2}} \]
    7. unpow263.7%

      \[\leadsto \frac{1}{\left(c \cdot c\right) \cdot \color{blue}{\left(\left(s \cdot x\right) \cdot \left(s \cdot x\right)\right)}} \]
    8. swap-sqr79.8%

      \[\leadsto \frac{1}{\color{blue}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left(s \cdot x\right)\right)}} \]
    9. unpow279.8%

      \[\leadsto \frac{1}{\color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{2}}} \]
    10. unpow-179.8%

      \[\leadsto \color{blue}{{\left({\left(c \cdot \left(s \cdot x\right)\right)}^{2}\right)}^{-1}} \]
    11. exp-to-pow47.3%

      \[\leadsto {\color{blue}{\left(e^{\log \left(c \cdot \left(s \cdot x\right)\right) \cdot 2}\right)}}^{-1} \]
    12. *-commutative47.3%

      \[\leadsto {\left(e^{\color{blue}{2 \cdot \log \left(c \cdot \left(s \cdot x\right)\right)}}\right)}^{-1} \]
    13. exp-prod47.5%

      \[\leadsto \color{blue}{e^{\left(2 \cdot \log \left(c \cdot \left(s \cdot x\right)\right)\right) \cdot -1}} \]
    14. *-commutative47.5%

      \[\leadsto e^{\color{blue}{\left(\log \left(c \cdot \left(s \cdot x\right)\right) \cdot 2\right)} \cdot -1} \]
    15. associate-*l*47.5%

      \[\leadsto e^{\color{blue}{\log \left(c \cdot \left(s \cdot x\right)\right) \cdot \left(2 \cdot -1\right)}} \]
    16. metadata-eval47.5%

      \[\leadsto e^{\log \left(c \cdot \left(s \cdot x\right)\right) \cdot \color{blue}{-2}} \]
    17. exp-to-pow80.1%

      \[\leadsto \color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-2}} \]
  10. Simplified80.1%

    \[\leadsto \color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-2}} \]
  11. Final simplification80.1%

    \[\leadsto {\left(c \cdot \left(x \cdot s\right)\right)}^{-2} \]
  12. Add Preprocessing

Alternative 6: 78.5% accurate, 24.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ \frac{\frac{1}{t\_0}}{t\_0} \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s)))) (/ (/ 1.0 t_0) t_0)))
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return (1.0 / t_0) / t_0;
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    real(8) :: t_0
    t_0 = c * (x * s)
    code = (1.0d0 / t_0) / t_0
end function
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return (1.0 / t_0) / t_0;
}
def code(x, c, s):
	t_0 = c * (x * s)
	return (1.0 / t_0) / t_0
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	return Float64(Float64(1.0 / t_0) / t_0)
end
function tmp = code(x, c, s)
	t_0 = c * (x * s);
	tmp = (1.0 / t_0) / t_0;
end
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\frac{\frac{1}{t\_0}}{t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 62.1%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 52.8%

    \[\leadsto \color{blue}{\frac{1}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
  4. Step-by-step derivation
    1. associate-/r*52.4%

      \[\leadsto \color{blue}{\frac{\frac{1}{{c}^{2}}}{{s}^{2} \cdot {x}^{2}}} \]
    2. unpow252.4%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\color{blue}{\left(s \cdot s\right)} \cdot {x}^{2}} \]
    3. unpow252.4%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\left(s \cdot s\right) \cdot \color{blue}{\left(x \cdot x\right)}} \]
    4. swap-sqr63.5%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\color{blue}{\left(s \cdot x\right) \cdot \left(s \cdot x\right)}} \]
    5. unpow263.5%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\color{blue}{{\left(s \cdot x\right)}^{2}}} \]
    6. associate-/r*63.7%

      \[\leadsto \color{blue}{\frac{1}{{c}^{2} \cdot {\left(s \cdot x\right)}^{2}}} \]
    7. unpow263.7%

      \[\leadsto \frac{1}{\color{blue}{\left(c \cdot c\right)} \cdot {\left(s \cdot x\right)}^{2}} \]
    8. rem-square-sqrt63.7%

      \[\leadsto \frac{1}{\left(c \cdot c\right) \cdot \color{blue}{\left(\sqrt{{\left(s \cdot x\right)}^{2}} \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}} \]
    9. swap-sqr73.2%

      \[\leadsto \frac{1}{\color{blue}{\left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right) \cdot \left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}} \]
    10. unpow273.2%

      \[\leadsto \frac{1}{\color{blue}{{\left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}^{2}}} \]
    11. unpow273.2%

      \[\leadsto \frac{1}{{\left(c \cdot \sqrt{\color{blue}{\left(s \cdot x\right) \cdot \left(s \cdot x\right)}}\right)}^{2}} \]
    12. rem-sqrt-square79.8%

      \[\leadsto \frac{1}{{\left(c \cdot \color{blue}{\left|s \cdot x\right|}\right)}^{2}} \]
  5. Simplified79.8%

    \[\leadsto \color{blue}{\frac{1}{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}} \]
  6. Step-by-step derivation
    1. unpow-prod-down73.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{{c}^{2} \cdot {\left(\left|s \cdot x\right|\right)}^{2}}} \]
    2. unpow273.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot c\right)} \cdot {\left(\left|s \cdot x\right|\right)}^{2}} \]
    3. pow273.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\left(c \cdot c\right) \cdot \color{blue}{\left(\left|s \cdot x\right| \cdot \left|s \cdot x\right|\right)}} \]
    4. sqr-abs73.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\left(c \cdot c\right) \cdot \color{blue}{\left(\left(s \cdot x\right) \cdot \left(s \cdot x\right)\right)}} \]
    5. swap-sqr96.2%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left(s \cdot x\right)\right)}} \]
  7. Applied egg-rr79.8%

    \[\leadsto \frac{1}{\color{blue}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left(s \cdot x\right)\right)}} \]
  8. Step-by-step derivation
    1. metadata-eval79.8%

      \[\leadsto \frac{\color{blue}{1 \cdot 1}}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left(s \cdot x\right)\right)} \]
    2. frac-times80.0%

      \[\leadsto \color{blue}{\frac{1}{c \cdot \left(s \cdot x\right)} \cdot \frac{1}{c \cdot \left(s \cdot x\right)}} \]
    3. associate-*r*78.7%

      \[\leadsto \frac{1}{\color{blue}{\left(c \cdot s\right) \cdot x}} \cdot \frac{1}{c \cdot \left(s \cdot x\right)} \]
    4. associate-/l/78.7%

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{c \cdot s}} \cdot \frac{1}{c \cdot \left(s \cdot x\right)} \]
    5. associate-*r*80.2%

      \[\leadsto \frac{\frac{1}{x}}{c \cdot s} \cdot \frac{1}{\color{blue}{\left(c \cdot s\right) \cdot x}} \]
    6. associate-/l/80.2%

      \[\leadsto \frac{\frac{1}{x}}{c \cdot s} \cdot \color{blue}{\frac{\frac{1}{x}}{c \cdot s}} \]
    7. associate-*r/77.6%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{x}}{c \cdot s} \cdot \frac{1}{x}}{c \cdot s}} \]
    8. times-frac75.2%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{x}}{c \cdot s}}{c} \cdot \frac{\frac{1}{x}}{s}} \]
    9. associate-/l/75.2%

      \[\leadsto \frac{\color{blue}{\frac{1}{\left(c \cdot s\right) \cdot x}}}{c} \cdot \frac{\frac{1}{x}}{s} \]
    10. associate-*r*76.2%

      \[\leadsto \frac{\frac{1}{\color{blue}{c \cdot \left(s \cdot x\right)}}}{c} \cdot \frac{\frac{1}{x}}{s} \]
    11. *-commutative76.2%

      \[\leadsto \frac{\frac{1}{c \cdot \color{blue}{\left(x \cdot s\right)}}}{c} \cdot \frac{\frac{1}{x}}{s} \]
    12. associate-/l/76.2%

      \[\leadsto \frac{\frac{1}{c \cdot \left(x \cdot s\right)}}{c} \cdot \color{blue}{\frac{1}{s \cdot x}} \]
    13. *-commutative76.2%

      \[\leadsto \frac{\frac{1}{c \cdot \left(x \cdot s\right)}}{c} \cdot \frac{1}{\color{blue}{x \cdot s}} \]
  9. Applied egg-rr76.2%

    \[\leadsto \color{blue}{\frac{\frac{1}{c \cdot \left(x \cdot s\right)}}{c} \cdot \frac{1}{x \cdot s}} \]
  10. Step-by-step derivation
    1. *-commutative76.2%

      \[\leadsto \color{blue}{\frac{1}{x \cdot s} \cdot \frac{\frac{1}{c \cdot \left(x \cdot s\right)}}{c}} \]
    2. frac-times80.1%

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{c \cdot \left(x \cdot s\right)}}{\left(x \cdot s\right) \cdot c}} \]
    3. *-un-lft-identity80.1%

      \[\leadsto \frac{\color{blue}{\frac{1}{c \cdot \left(x \cdot s\right)}}}{\left(x \cdot s\right) \cdot c} \]
    4. *-commutative80.1%

      \[\leadsto \frac{\frac{1}{\color{blue}{\left(x \cdot s\right) \cdot c}}}{\left(x \cdot s\right) \cdot c} \]
  11. Applied egg-rr80.1%

    \[\leadsto \color{blue}{\frac{\frac{1}{\left(x \cdot s\right) \cdot c}}{\left(x \cdot s\right) \cdot c}} \]
  12. Final simplification80.1%

    \[\leadsto \frac{\frac{1}{c \cdot \left(x \cdot s\right)}}{c \cdot \left(x \cdot s\right)} \]
  13. Add Preprocessing

Alternative 7: 78.3% accurate, 24.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ \frac{1}{t\_0 \cdot t\_0} \end{array} \end{array} \]
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s)))) (/ 1.0 (* t_0 t_0))))
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return 1.0 / (t_0 * t_0);
}
real(8) function code(x, c, s)
    real(8), intent (in) :: x
    real(8), intent (in) :: c
    real(8), intent (in) :: s
    real(8) :: t_0
    t_0 = c * (x * s)
    code = 1.0d0 / (t_0 * t_0)
end function
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return 1.0 / (t_0 * t_0);
}
def code(x, c, s):
	t_0 = c * (x * s)
	return 1.0 / (t_0 * t_0)
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	return Float64(1.0 / Float64(t_0 * t_0))
end
function tmp = code(x, c, s)
	t_0 = c * (x * s);
	tmp = 1.0 / (t_0 * t_0);
end
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\frac{1}{t\_0 \cdot t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 62.1%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 52.8%

    \[\leadsto \color{blue}{\frac{1}{{c}^{2} \cdot \left({s}^{2} \cdot {x}^{2}\right)}} \]
  4. Step-by-step derivation
    1. associate-/r*52.4%

      \[\leadsto \color{blue}{\frac{\frac{1}{{c}^{2}}}{{s}^{2} \cdot {x}^{2}}} \]
    2. unpow252.4%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\color{blue}{\left(s \cdot s\right)} \cdot {x}^{2}} \]
    3. unpow252.4%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\left(s \cdot s\right) \cdot \color{blue}{\left(x \cdot x\right)}} \]
    4. swap-sqr63.5%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\color{blue}{\left(s \cdot x\right) \cdot \left(s \cdot x\right)}} \]
    5. unpow263.5%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\color{blue}{{\left(s \cdot x\right)}^{2}}} \]
    6. associate-/r*63.7%

      \[\leadsto \color{blue}{\frac{1}{{c}^{2} \cdot {\left(s \cdot x\right)}^{2}}} \]
    7. unpow263.7%

      \[\leadsto \frac{1}{\color{blue}{\left(c \cdot c\right)} \cdot {\left(s \cdot x\right)}^{2}} \]
    8. rem-square-sqrt63.7%

      \[\leadsto \frac{1}{\left(c \cdot c\right) \cdot \color{blue}{\left(\sqrt{{\left(s \cdot x\right)}^{2}} \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}} \]
    9. swap-sqr73.2%

      \[\leadsto \frac{1}{\color{blue}{\left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right) \cdot \left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}} \]
    10. unpow273.2%

      \[\leadsto \frac{1}{\color{blue}{{\left(c \cdot \sqrt{{\left(s \cdot x\right)}^{2}}\right)}^{2}}} \]
    11. unpow273.2%

      \[\leadsto \frac{1}{{\left(c \cdot \sqrt{\color{blue}{\left(s \cdot x\right) \cdot \left(s \cdot x\right)}}\right)}^{2}} \]
    12. rem-sqrt-square79.8%

      \[\leadsto \frac{1}{{\left(c \cdot \color{blue}{\left|s \cdot x\right|}\right)}^{2}} \]
  5. Simplified79.8%

    \[\leadsto \color{blue}{\frac{1}{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}} \]
  6. Step-by-step derivation
    1. unpow-prod-down73.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{{c}^{2} \cdot {\left(\left|s \cdot x\right|\right)}^{2}}} \]
    2. unpow273.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot c\right)} \cdot {\left(\left|s \cdot x\right|\right)}^{2}} \]
    3. pow273.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\left(c \cdot c\right) \cdot \color{blue}{\left(\left|s \cdot x\right| \cdot \left|s \cdot x\right|\right)}} \]
    4. sqr-abs73.3%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\left(c \cdot c\right) \cdot \color{blue}{\left(\left(s \cdot x\right) \cdot \left(s \cdot x\right)\right)}} \]
    5. swap-sqr96.2%

      \[\leadsto \frac{\cos \left(x \cdot -2\right)}{\color{blue}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left(s \cdot x\right)\right)}} \]
  7. Applied egg-rr79.8%

    \[\leadsto \frac{1}{\color{blue}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \left(s \cdot x\right)\right)}} \]
  8. Final simplification79.8%

    \[\leadsto \frac{1}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)} \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2024103 
(FPCore (x c s)
  :name "mixedcos"
  :precision binary64
  (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))