mixedcos

Percentage Accurate: 66.9% → 98.2%
Time: 11.3s
Alternatives: 5
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 5 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: 66.9% 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: 98.2% accurate, 1.4× speedup?

\[\begin{array}{l} c = |c|\\ s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ \mathbf{if}\;{c}^{2} \leq 4 \cdot 10^{-54}:\\ \;\;\;\;\frac{\frac{1}{x}}{c \cdot s} \cdot \frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot s\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{t_0}}{t_0}\\ \end{array} \end{array} \]
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s))))
   (if (<= (pow c 2.0) 4e-54)
     (* (/ (/ 1.0 x) (* c s)) (/ (cos (* 2.0 x)) (* x (* c s))))
     (/ (/ 1.0 t_0) t_0))))
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	double tmp;
	if (pow(c, 2.0) <= 4e-54) {
		tmp = ((1.0 / x) / (c * s)) * (cos((2.0 * x)) / (x * (c * s)));
	} else {
		tmp = (1.0 / t_0) / t_0;
	}
	return tmp;
}
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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
    real(8) :: tmp
    t_0 = c * (x * s)
    if ((c ** 2.0d0) <= 4d-54) then
        tmp = ((1.0d0 / x) / (c * s)) * (cos((2.0d0 * x)) / (x * (c * s)))
    else
        tmp = (1.0d0 / t_0) / t_0
    end if
    code = tmp
end function
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	double tmp;
	if (Math.pow(c, 2.0) <= 4e-54) {
		tmp = ((1.0 / x) / (c * s)) * (Math.cos((2.0 * x)) / (x * (c * s)));
	} else {
		tmp = (1.0 / t_0) / t_0;
	}
	return tmp;
}
c = abs(c)
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	t_0 = c * (x * s)
	tmp = 0
	if math.pow(c, 2.0) <= 4e-54:
		tmp = ((1.0 / x) / (c * s)) * (math.cos((2.0 * x)) / (x * (c * s)))
	else:
		tmp = (1.0 / t_0) / t_0
	return tmp
c = abs(c)
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	tmp = 0.0
	if ((c ^ 2.0) <= 4e-54)
		tmp = Float64(Float64(Float64(1.0 / x) / Float64(c * s)) * Float64(cos(Float64(2.0 * x)) / Float64(x * Float64(c * s))));
	else
		tmp = Float64(Float64(1.0 / t_0) / t_0);
	end
	return tmp
end
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp_2 = code(x, c, s)
	t_0 = c * (x * s);
	tmp = 0.0;
	if ((c ^ 2.0) <= 4e-54)
		tmp = ((1.0 / x) / (c * s)) * (cos((2.0 * x)) / (x * (c * s)));
	else
		tmp = (1.0 / t_0) / t_0;
	end
	tmp_2 = tmp;
end
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[c, 2.0], $MachinePrecision], 4e-54], N[(N[(N[(1.0 / x), $MachinePrecision] / N[(c * s), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / N[(x * N[(c * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\mathbf{if}\;{c}^{2} \leq 4 \cdot 10^{-54}:\\
\;\;\;\;\frac{\frac{1}{x}}{c \cdot s} \cdot \frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot s\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t_0}}{t_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 c 2) < 4.0000000000000001e-54

    1. Initial program 72.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. *-un-lft-identity72.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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)}} \]
      6. times-frac97.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)}} \]
      7. *-commutative97.6%

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{c}}{x \cdot s}} \cdot \frac{\cos \left(x \cdot 2\right)}{c \cdot \left(s \cdot x\right)} \]
      10. *-un-lft-identity97.7%

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

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

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

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

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

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

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

    if 4.0000000000000001e-54 < (pow.f64 c 2)

    1. Initial program 58.4%

      \[\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. add-cbrt-cube58.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\cos \left(2 \cdot x\right)}}{\sqrt[3]{{\left({\left(c \cdot \left|s \cdot x\right|\right)}^{2}\right)}^{3}}} \]
      8. rem-cbrt-cube96.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{c}^{2} \leq 4 \cdot 10^{-54}:\\ \;\;\;\;\frac{\frac{1}{x}}{c \cdot s} \cdot \frac{\cos \left(2 \cdot x\right)}{x \cdot \left(c \cdot s\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{c \cdot \left(x \cdot s\right)}}{c \cdot \left(x \cdot s\right)}\\ \end{array} \]

Alternative 2: 96.9% accurate, 2.7× speedup?

\[\begin{array}{l} c = |c|\\ s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ \frac{\frac{\cos \left(2 \cdot x\right)}{t_0}}{t_0} \end{array} \end{array} \]
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s)))) (/ (/ (cos (* 2.0 x)) t_0) t_0)))
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return (cos((2.0 * x)) / t_0) / t_0;
}
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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((2.0d0 * x)) / t_0) / t_0
end function
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return (Math.cos((2.0 * x)) / t_0) / t_0;
}
c = abs(c)
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	t_0 = c * (x * s)
	return (math.cos((2.0 * x)) / t_0) / t_0
c = abs(c)
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	return Float64(Float64(cos(Float64(2.0 * x)) / t_0) / t_0)
end
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
	t_0 = c * (x * s);
	tmp = (cos((2.0 * x)) / t_0) / t_0;
end
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := Block[{t$95$0 = N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\begin{array}{l}
t_0 := c \cdot \left(x \cdot s\right)\\
\frac{\frac{\cos \left(2 \cdot x\right)}{t_0}}{t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 65.7%

    \[\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. add-cbrt-cube65.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt[3]{\frac{{\cos \left(2 \cdot x\right)}^{3}}{{\color{blue}{\left(\sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}} \cdot \sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}\right)}}^{3}}} \]
    5. add-sqr-sqrt74.0%

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{{\cos \left(2 \cdot x\right)}^{3}}}{\sqrt[3]{{\left({\left(c \cdot \left|s \cdot x\right|\right)}^{2}\right)}^{3}}}} \]
    7. rem-cbrt-cube74.0%

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{s \cdot x}}{c \cdot \left(s \cdot x\right)}} \]
  8. Taylor expanded in x around inf 97.5%

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

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

    \[\leadsto \frac{\color{blue}{\frac{\cos \left(x \cdot 2\right)}{c \cdot \left(s \cdot x\right)}}}{c \cdot \left(s \cdot x\right)} \]
  11. Final simplification97.5%

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

Alternative 3: 96.9% accurate, 2.7× speedup?

\[\begin{array}{l} c = |c|\\ s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \frac{\frac{\frac{\cos \left(2 \cdot x\right)}{c}}{x \cdot s}}{c \cdot \left(x \cdot s\right)} \end{array} \]
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (/ (/ (/ (cos (* 2.0 x)) c) (* x s)) (* c (* x s))))
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	return ((cos((2.0 * x)) / c) / (x * s)) / (c * (x * s));
}
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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) / (x * s)) / (c * (x * s))
end function
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	return ((Math.cos((2.0 * x)) / c) / (x * s)) / (c * (x * s));
}
c = abs(c)
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	return ((math.cos((2.0 * x)) / c) / (x * s)) / (c * (x * s))
c = abs(c)
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	return Float64(Float64(Float64(cos(Float64(2.0 * x)) / c) / Float64(x * s)) / Float64(c * Float64(x * s)))
end
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
	tmp = ((cos((2.0 * x)) / c) / (x * s)) / (c * (x * s));
end
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
code[x_, c_, s_] := N[(N[(N[(N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] / c), $MachinePrecision] / N[(x * s), $MachinePrecision]), $MachinePrecision] / N[(c * N[(x * s), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{c}}{x \cdot s}}{c \cdot \left(x \cdot s\right)}
\end{array}
Derivation
  1. Initial program 65.7%

    \[\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. add-cbrt-cube65.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt[3]{\frac{{\cos \left(2 \cdot x\right)}^{3}}{{\color{blue}{\left(\sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}} \cdot \sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}\right)}}^{3}}} \]
    5. add-sqr-sqrt74.0%

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{{\cos \left(2 \cdot x\right)}^{3}}}{\sqrt[3]{{\left({\left(c \cdot \left|s \cdot x\right|\right)}^{2}\right)}^{3}}}} \]
    7. rem-cbrt-cube74.0%

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{s \cdot x}}{c \cdot \left(s \cdot x\right)}} \]
  8. Final simplification97.5%

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

Alternative 4: 79.4% accurate, 24.1× speedup?

\[\begin{array}{l} c = |c|\\ s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ \frac{1}{t_0 \cdot t_0} \end{array} \end{array} \]
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s)))) (/ 1.0 (* t_0 t_0))))
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return 1.0 / (t_0 * t_0);
}
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return 1.0 / (t_0 * t_0);
}
c = abs(c)
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	t_0 = c * (x * s)
	return 1.0 / (t_0 * t_0)
c = abs(c)
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	return Float64(1.0 / Float64(t_0 * t_0))
end
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
	t_0 = c * (x * s);
	tmp = 1.0 / (t_0 * t_0);
end
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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}
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\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 65.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\left(c \cdot \left(s \cdot x\right)\right) \cdot \left(c \cdot \color{blue}{\left(\sqrt{s \cdot x} \cdot \sqrt{s \cdot x}\right)}\right)} \]
    12. add-sqr-sqrt78.1%

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

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

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

Alternative 5: 79.5% accurate, 24.1× speedup?

\[\begin{array}{l} c = |c|\\ s = |s|\\ [c, s] = \mathsf{sort}([c, s])\\ \\ \begin{array}{l} t_0 := c \cdot \left(x \cdot s\right)\\ \frac{\frac{1}{t_0}}{t_0} \end{array} \end{array} \]
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
(FPCore (x c s)
 :precision binary64
 (let* ((t_0 (* c (* x s)))) (/ (/ 1.0 t_0) t_0)))
c = abs(c);
s = abs(s);
assert(c < s);
double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return (1.0 / t_0) / t_0;
}
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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
c = Math.abs(c);
s = Math.abs(s);
assert c < s;
public static double code(double x, double c, double s) {
	double t_0 = c * (x * s);
	return (1.0 / t_0) / t_0;
}
c = abs(c)
s = abs(s)
[c, s] = sort([c, s])
def code(x, c, s):
	t_0 = c * (x * s)
	return (1.0 / t_0) / t_0
c = abs(c)
s = abs(s)
c, s = sort([c, s])
function code(x, c, s)
	t_0 = Float64(c * Float64(x * s))
	return Float64(Float64(1.0 / t_0) / t_0)
end
c = abs(c)
s = abs(s)
c, s = num2cell(sort([c, s])){:}
function tmp = code(x, c, s)
	t_0 = c * (x * s);
	tmp = (1.0 / t_0) / t_0;
end
NOTE: c should be positive before calling this function
NOTE: s should be positive before calling this function
NOTE: c and s should be sorted in increasing order before calling this function.
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}
c = |c|\\
s = |s|\\
[c, s] = \mathsf{sort}([c, s])\\
\\
\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 65.7%

    \[\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. add-cbrt-cube65.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt[3]{\frac{{\cos \left(2 \cdot x\right)}^{3}}{{\color{blue}{\left(\sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}} \cdot \sqrt{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}\right)}}^{3}}} \]
    5. add-sqr-sqrt74.0%

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{{\cos \left(2 \cdot x\right)}^{3}}}{\sqrt[3]{{\left({\left(c \cdot \left|s \cdot x\right|\right)}^{2}\right)}^{3}}}} \]
    7. rem-cbrt-cube74.0%

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

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

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

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

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

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

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

Reproduce

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