mixedcos

Percentage Accurate: 67.2% → 98.8%
Time: 16.5s
Alternatives: 12
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 12 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: 67.2% 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.8% accurate, 2.6× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} \mathbf{if}\;x_m \leq 0.24:\\ \;\;\;\;{\left(c_m \cdot \left(x_m \cdot s_m\right)\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(x_m \cdot -2\right)}{s_m \cdot \left(\left(x_m \cdot c_m\right) \cdot \left(s_m \cdot \left(x_m \cdot c_m\right)\right)\right)}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (if (<= x_m 0.24)
   (pow (* c_m (* x_m s_m)) -2.0)
   (/ (cos (* x_m -2.0)) (* s_m (* (* x_m c_m) (* s_m (* x_m c_m)))))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double tmp;
	if (x_m <= 0.24) {
		tmp = pow((c_m * (x_m * s_m)), -2.0);
	} else {
		tmp = cos((x_m * -2.0)) / (s_m * ((x_m * c_m) * (s_m * (x_m * c_m))));
	}
	return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: tmp
    if (x_m <= 0.24d0) then
        tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
    else
        tmp = cos((x_m * (-2.0d0))) / (s_m * ((x_m * c_m) * (s_m * (x_m * c_m))))
    end if
    code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double tmp;
	if (x_m <= 0.24) {
		tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
	} else {
		tmp = Math.cos((x_m * -2.0)) / (s_m * ((x_m * c_m) * (s_m * (x_m * c_m))));
	}
	return tmp;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	tmp = 0
	if x_m <= 0.24:
		tmp = math.pow((c_m * (x_m * s_m)), -2.0)
	else:
		tmp = math.cos((x_m * -2.0)) / (s_m * ((x_m * c_m) * (s_m * (x_m * c_m))))
	return tmp
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	tmp = 0.0
	if (x_m <= 0.24)
		tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0;
	else
		tmp = Float64(cos(Float64(x_m * -2.0)) / Float64(s_m * Float64(Float64(x_m * c_m) * Float64(s_m * Float64(x_m * c_m)))));
	end
	return tmp
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
	tmp = 0.0;
	if (x_m <= 0.24)
		tmp = (c_m * (x_m * s_m)) ^ -2.0;
	else
		tmp = cos((x_m * -2.0)) / (s_m * ((x_m * c_m) * (s_m * (x_m * c_m))));
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := If[LessEqual[x$95$m, 0.24], N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] / N[(s$95$m * N[(N[(x$95$m * c$95$m), $MachinePrecision] * N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
\mathbf{if}\;x_m \leq 0.24:\\
\;\;\;\;{\left(c_m \cdot \left(x_m \cdot s_m\right)\right)}^{-2}\\

\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x_m \cdot -2\right)}{s_m \cdot \left(\left(x_m \cdot c_m\right) \cdot \left(s_m \cdot \left(x_m \cdot c_m\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.23999999999999999

    1. Initial program 73.6%

      \[\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-/r*73.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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*69.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.23999999999999999 < x

    1. Initial program 66.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. associate-/r*64.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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*56.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 93.4% accurate, 2.6× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} \mathbf{if}\;x_m \leq 1.25 \cdot 10^{-204}:\\ \;\;\;\;\frac{\frac{1}{c_m}}{\left(x_m \cdot \left(s_m \cdot c_m\right)\right) \cdot \left(x_m \cdot s_m\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(x_m \cdot -2\right)}{\left(s_m \cdot c_m\right) \cdot \left(x_m \cdot \left(c_m \cdot \left(x_m \cdot s_m\right)\right)\right)}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (if (<= x_m 1.25e-204)
   (/ (/ 1.0 c_m) (* (* x_m (* s_m c_m)) (* x_m s_m)))
   (/ (cos (* x_m -2.0)) (* (* s_m c_m) (* x_m (* c_m (* x_m s_m)))))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double tmp;
	if (x_m <= 1.25e-204) {
		tmp = (1.0 / c_m) / ((x_m * (s_m * c_m)) * (x_m * s_m));
	} else {
		tmp = cos((x_m * -2.0)) / ((s_m * c_m) * (x_m * (c_m * (x_m * s_m))));
	}
	return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: tmp
    if (x_m <= 1.25d-204) then
        tmp = (1.0d0 / c_m) / ((x_m * (s_m * c_m)) * (x_m * s_m))
    else
        tmp = cos((x_m * (-2.0d0))) / ((s_m * c_m) * (x_m * (c_m * (x_m * s_m))))
    end if
    code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double tmp;
	if (x_m <= 1.25e-204) {
		tmp = (1.0 / c_m) / ((x_m * (s_m * c_m)) * (x_m * s_m));
	} else {
		tmp = Math.cos((x_m * -2.0)) / ((s_m * c_m) * (x_m * (c_m * (x_m * s_m))));
	}
	return tmp;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	tmp = 0
	if x_m <= 1.25e-204:
		tmp = (1.0 / c_m) / ((x_m * (s_m * c_m)) * (x_m * s_m))
	else:
		tmp = math.cos((x_m * -2.0)) / ((s_m * c_m) * (x_m * (c_m * (x_m * s_m))))
	return tmp
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	tmp = 0.0
	if (x_m <= 1.25e-204)
		tmp = Float64(Float64(1.0 / c_m) / Float64(Float64(x_m * Float64(s_m * c_m)) * Float64(x_m * s_m)));
	else
		tmp = Float64(cos(Float64(x_m * -2.0)) / Float64(Float64(s_m * c_m) * Float64(x_m * Float64(c_m * Float64(x_m * s_m)))));
	end
	return tmp
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
	tmp = 0.0;
	if (x_m <= 1.25e-204)
		tmp = (1.0 / c_m) / ((x_m * (s_m * c_m)) * (x_m * s_m));
	else
		tmp = cos((x_m * -2.0)) / ((s_m * c_m) * (x_m * (c_m * (x_m * s_m))));
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := If[LessEqual[x$95$m, 1.25e-204], N[(N[(1.0 / c$95$m), $MachinePrecision] / N[(N[(x$95$m * N[(s$95$m * c$95$m), $MachinePrecision]), $MachinePrecision] * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] / N[(N[(s$95$m * c$95$m), $MachinePrecision] * N[(x$95$m * N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
\mathbf{if}\;x_m \leq 1.25 \cdot 10^{-204}:\\
\;\;\;\;\frac{\frac{1}{c_m}}{\left(x_m \cdot \left(s_m \cdot c_m\right)\right) \cdot \left(x_m \cdot s_m\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x_m \cdot -2\right)}{\left(s_m \cdot c_m\right) \cdot \left(x_m \cdot \left(c_m \cdot \left(x_m \cdot s_m\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.25e-204

    1. Initial program 75.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-/r*75.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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*71.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{{\left(s \cdot \left(c \cdot x\right)\right)}^{2}}} \]
      11. /-rgt-identity83.9%

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

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

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

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

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

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

        \[\leadsto {\left(s \cdot \left(c \cdot x\right)\right)}^{-1} \cdot \color{blue}{{\left(s \cdot \left(c \cdot x\right)\right)}^{-1}} \]
      18. pow-sqr83.9%

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

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

      \[\leadsto \color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-2}} \]
    11. Step-by-step derivation
      1. metadata-eval85.6%

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

        \[\leadsto \color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-1} \cdot {\left(c \cdot \left(s \cdot x\right)\right)}^{-1}} \]
      3. inv-pow85.5%

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

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

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

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

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

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

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

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

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

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

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

    if 1.25e-204 < x

    1. Initial program 67.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-/r*65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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*58.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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)}} \]
      5. associate-*r*93.8%

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

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

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

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

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

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

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

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

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

Alternative 3: 96.6% accurate, 2.6× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} \mathbf{if}\;x_m \leq 8.5 \cdot 10^{-9}:\\ \;\;\;\;{\left(c_m \cdot \left(x_m \cdot s_m\right)\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(x_m \cdot -2\right)}{\left(s_m \cdot c_m\right) \cdot \left(x_m \cdot \left(s_m \cdot \left(x_m \cdot c_m\right)\right)\right)}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (if (<= x_m 8.5e-9)
   (pow (* c_m (* x_m s_m)) -2.0)
   (/ (cos (* x_m -2.0)) (* (* s_m c_m) (* x_m (* s_m (* x_m c_m)))))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double tmp;
	if (x_m <= 8.5e-9) {
		tmp = pow((c_m * (x_m * s_m)), -2.0);
	} else {
		tmp = cos((x_m * -2.0)) / ((s_m * c_m) * (x_m * (s_m * (x_m * c_m))));
	}
	return tmp;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: tmp
    if (x_m <= 8.5d-9) then
        tmp = (c_m * (x_m * s_m)) ** (-2.0d0)
    else
        tmp = cos((x_m * (-2.0d0))) / ((s_m * c_m) * (x_m * (s_m * (x_m * c_m))))
    end if
    code = tmp
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double tmp;
	if (x_m <= 8.5e-9) {
		tmp = Math.pow((c_m * (x_m * s_m)), -2.0);
	} else {
		tmp = Math.cos((x_m * -2.0)) / ((s_m * c_m) * (x_m * (s_m * (x_m * c_m))));
	}
	return tmp;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	tmp = 0
	if x_m <= 8.5e-9:
		tmp = math.pow((c_m * (x_m * s_m)), -2.0)
	else:
		tmp = math.cos((x_m * -2.0)) / ((s_m * c_m) * (x_m * (s_m * (x_m * c_m))))
	return tmp
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	tmp = 0.0
	if (x_m <= 8.5e-9)
		tmp = Float64(c_m * Float64(x_m * s_m)) ^ -2.0;
	else
		tmp = Float64(cos(Float64(x_m * -2.0)) / Float64(Float64(s_m * c_m) * Float64(x_m * Float64(s_m * Float64(x_m * c_m)))));
	end
	return tmp
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp_2 = code(x_m, c_m, s_m)
	tmp = 0.0;
	if (x_m <= 8.5e-9)
		tmp = (c_m * (x_m * s_m)) ^ -2.0;
	else
		tmp = cos((x_m * -2.0)) / ((s_m * c_m) * (x_m * (s_m * (x_m * c_m))));
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := If[LessEqual[x$95$m, 8.5e-9], N[Power[N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] / N[(N[(s$95$m * c$95$m), $MachinePrecision] * N[(x$95$m * N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
\mathbf{if}\;x_m \leq 8.5 \cdot 10^{-9}:\\
\;\;\;\;{\left(c_m \cdot \left(x_m \cdot s_m\right)\right)}^{-2}\\

\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(x_m \cdot -2\right)}{\left(s_m \cdot c_m\right) \cdot \left(x_m \cdot \left(s_m \cdot \left(x_m \cdot c_m\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 8.5e-9

    1. Initial program 73.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. associate-/r*73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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*69.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(s \cdot \left(c \cdot x\right)\right)}^{-1} \cdot \color{blue}{{\left(s \cdot \left(c \cdot x\right)\right)}^{-1}} \]
      18. pow-sqr87.1%

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

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

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

    if 8.5e-9 < x

    1. Initial program 67.2%

      \[\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-/r*65.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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)}} \]
      5. associate-*r*91.8%

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

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

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

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

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

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

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

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

Alternative 4: 97.2% accurate, 2.7× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \frac{\frac{\cos \left(x_m \cdot -2\right)}{s_m} \cdot \frac{1}{x_m \cdot c_m}}{s_m \cdot \left(x_m \cdot c_m\right)} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (/ (* (/ (cos (* x_m -2.0)) s_m) (/ 1.0 (* x_m c_m))) (* s_m (* x_m c_m))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	return ((cos((x_m * -2.0)) / s_m) * (1.0 / (x_m * c_m))) / (s_m * (x_m * c_m));
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    code = ((cos((x_m * (-2.0d0))) / s_m) * (1.0d0 / (x_m * c_m))) / (s_m * (x_m * c_m))
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	return ((Math.cos((x_m * -2.0)) / s_m) * (1.0 / (x_m * c_m))) / (s_m * (x_m * c_m));
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	return ((math.cos((x_m * -2.0)) / s_m) * (1.0 / (x_m * c_m))) / (s_m * (x_m * c_m))
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	return Float64(Float64(Float64(cos(Float64(x_m * -2.0)) / s_m) * Float64(1.0 / Float64(x_m * c_m))) / Float64(s_m * Float64(x_m * c_m)))
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	tmp = ((cos((x_m * -2.0)) / s_m) * (1.0 / (x_m * c_m))) / (s_m * (x_m * c_m));
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := N[(N[(N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] / s$95$m), $MachinePrecision] * N[(1.0 / N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\frac{\frac{\cos \left(x_m \cdot -2\right)}{s_m} \cdot \frac{1}{x_m \cdot c_m}}{s_m \cdot \left(x_m \cdot c_m\right)}
\end{array}
Derivation
  1. Initial program 71.8%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/r*71.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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)}} \]
    6. associate-/r*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)}} \]
  6. Applied egg-rr97.8%

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

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

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

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

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

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

Alternative 5: 97.4% accurate, 2.7× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} t_0 := s_m \cdot \left(x_m \cdot c_m\right)\\ \frac{\frac{\cos \left(x_m \cdot -2\right)}{t_0}}{t_0} \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (let* ((t_0 (* s_m (* x_m c_m)))) (/ (/ (cos (* x_m -2.0)) t_0) t_0)))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double t_0 = s_m * (x_m * c_m);
	return (cos((x_m * -2.0)) / t_0) / t_0;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: t_0
    t_0 = s_m * (x_m * c_m)
    code = (cos((x_m * (-2.0d0))) / t_0) / t_0
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double t_0 = s_m * (x_m * c_m);
	return (Math.cos((x_m * -2.0)) / t_0) / t_0;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	t_0 = s_m * (x_m * c_m)
	return (math.cos((x_m * -2.0)) / t_0) / t_0
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	t_0 = Float64(s_m * Float64(x_m * c_m))
	return Float64(Float64(cos(Float64(x_m * -2.0)) / t_0) / t_0)
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	t_0 = s_m * (x_m * c_m);
	tmp = (cos((x_m * -2.0)) / t_0) / t_0;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := s_m \cdot \left(x_m \cdot c_m\right)\\
\frac{\frac{\cos \left(x_m \cdot -2\right)}{t_0}}{t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 71.8%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/r*71.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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)}} \]
    6. associate-/r*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)}} \]
  6. Applied egg-rr97.8%

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

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

Alternative 6: 97.5% accurate, 2.7× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \frac{\frac{\frac{\cos \left(x_m \cdot -2\right)}{s_m}}{x_m \cdot c_m}}{s_m \cdot \left(x_m \cdot c_m\right)} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (/ (/ (/ (cos (* x_m -2.0)) s_m) (* x_m c_m)) (* s_m (* x_m c_m))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	return ((cos((x_m * -2.0)) / s_m) / (x_m * c_m)) / (s_m * (x_m * c_m));
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    code = ((cos((x_m * (-2.0d0))) / s_m) / (x_m * c_m)) / (s_m * (x_m * c_m))
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	return ((Math.cos((x_m * -2.0)) / s_m) / (x_m * c_m)) / (s_m * (x_m * c_m));
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	return ((math.cos((x_m * -2.0)) / s_m) / (x_m * c_m)) / (s_m * (x_m * c_m))
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	return Float64(Float64(Float64(cos(Float64(x_m * -2.0)) / s_m) / Float64(x_m * c_m)) / Float64(s_m * Float64(x_m * c_m)))
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	tmp = ((cos((x_m * -2.0)) / s_m) / (x_m * c_m)) / (s_m * (x_m * c_m));
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := N[(N[(N[(N[Cos[N[(x$95$m * -2.0), $MachinePrecision]], $MachinePrecision] / s$95$m), $MachinePrecision] / N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision] / N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\frac{\frac{\frac{\cos \left(x_m \cdot -2\right)}{s_m}}{x_m \cdot c_m}}{s_m \cdot \left(x_m \cdot c_m\right)}
\end{array}
Derivation
  1. Initial program 71.8%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/r*71.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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)}} \]
    6. associate-/r*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)}} \]
  6. Applied egg-rr97.8%

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

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

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

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

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

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

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

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

Alternative 7: 78.7% accurate, 2.8× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \frac{1}{\frac{1}{{\left(x_m \cdot \left(s_m \cdot c_m\right)\right)}^{-2}}} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (/ 1.0 (/ 1.0 (pow (* x_m (* s_m c_m)) -2.0))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	return 1.0 / (1.0 / pow((x_m * (s_m * c_m)), -2.0));
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    code = 1.0d0 / (1.0d0 / ((x_m * (s_m * c_m)) ** (-2.0d0)))
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	return 1.0 / (1.0 / Math.pow((x_m * (s_m * c_m)), -2.0));
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	return 1.0 / (1.0 / math.pow((x_m * (s_m * c_m)), -2.0))
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	return Float64(1.0 / Float64(1.0 / (Float64(x_m * Float64(s_m * c_m)) ^ -2.0)))
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	tmp = 1.0 / (1.0 / ((x_m * (s_m * c_m)) ^ -2.0));
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := N[(1.0 / N[(1.0 / N[Power[N[(x$95$m * N[(s$95$m * c$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\frac{1}{\frac{1}{{\left(x_m \cdot \left(s_m \cdot c_m\right)\right)}^{-2}}}
\end{array}
Derivation
  1. Initial program 71.8%

    \[\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 61.2%

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

      \[\leadsto \color{blue}{\frac{\frac{1}{{c}^{2}}}{{s}^{2} \cdot {x}^{2}}} \]
    2. *-commutative60.8%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\color{blue}{{x}^{2} \cdot {s}^{2}}} \]
    3. unpow260.8%

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)}} \]
    11. unpow281.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\left(-\color{blue}{\left(c \cdot x\right) \cdot s}\right) \cdot \left(-s \cdot \left(c \cdot x\right)\right)} \]
    8. distribute-rgt-neg-in81.0%

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

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

      \[\leadsto \frac{1}{\left(\left(x \cdot c\right) \cdot \left(-s\right)\right) \cdot \left(-\color{blue}{\left(c \cdot x\right) \cdot s}\right)} \]
    11. distribute-rgt-neg-in81.0%

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

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

    \[\leadsto \color{blue}{\frac{1}{\left(\left(x \cdot c\right) \cdot \left(-s\right)\right) \cdot \left(\left(x \cdot c\right) \cdot \left(-s\right)\right)}} \]
  10. Step-by-step derivation
    1. /-rgt-identity81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\frac{1}{\frac{\frac{1}{c \cdot \left(s \cdot x\right)}}{\color{blue}{c \cdot \left(s \cdot x\right)}}}} \]
    15. un-div-inv81.6%

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\frac{1}{c \cdot \left(s \cdot x\right)} \cdot \frac{1}{c \cdot \left(s \cdot x\right)}}}} \]
    16. inv-pow81.6%

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-1}} \cdot \frac{1}{c \cdot \left(s \cdot x\right)}}} \]
    17. inv-pow81.6%

      \[\leadsto \frac{1}{\frac{1}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-1} \cdot \color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-1}}}} \]
    18. pow-sqr81.6%

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

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

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

Alternative 8: 78.8% accurate, 2.9× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ {\left(\frac{x_m}{\frac{-1}{s_m \cdot c_m}}\right)}^{-2} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (pow (/ x_m (/ -1.0 (* s_m c_m))) -2.0))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	return pow((x_m / (-1.0 / (s_m * c_m))), -2.0);
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    code = (x_m / ((-1.0d0) / (s_m * c_m))) ** (-2.0d0)
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	return Math.pow((x_m / (-1.0 / (s_m * c_m))), -2.0);
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	return math.pow((x_m / (-1.0 / (s_m * c_m))), -2.0)
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	return Float64(x_m / Float64(-1.0 / Float64(s_m * c_m))) ^ -2.0
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	tmp = (x_m / (-1.0 / (s_m * c_m))) ^ -2.0;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := N[Power[N[(x$95$m / N[(-1.0 / N[(s$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
{\left(\frac{x_m}{\frac{-1}{s_m \cdot c_m}}\right)}^{-2}
\end{array}
Derivation
  1. Initial program 71.8%

    \[\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-/r*71.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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*66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(s \cdot \left(c \cdot x\right)\right)}^{-1} \cdot \color{blue}{{\left(s \cdot \left(c \cdot x\right)\right)}^{-1}} \]
    18. pow-sqr81.0%

      \[\leadsto \color{blue}{{\left(s \cdot \left(c \cdot x\right)\right)}^{\left(2 \cdot -1\right)}} \]
    19. metadata-eval81.0%

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

    \[\leadsto \color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-2}} \]
  11. Step-by-step derivation
    1. /-rgt-identity81.6%

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

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

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

      \[\leadsto {\left(\frac{-\color{blue}{s \cdot \left(x \cdot c\right)}}{-1}\right)}^{-2} \]
    5. distribute-lft-neg-in81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 37.1% accurate, 24.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \frac{\frac{-1}{x_m \cdot \left(s_m \cdot c_m\right)}}{s_m \cdot \left(x_m \cdot c_m\right)} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (/ (/ -1.0 (* x_m (* s_m c_m))) (* s_m (* x_m c_m))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	return (-1.0 / (x_m * (s_m * c_m))) / (s_m * (x_m * c_m));
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    code = ((-1.0d0) / (x_m * (s_m * c_m))) / (s_m * (x_m * c_m))
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	return (-1.0 / (x_m * (s_m * c_m))) / (s_m * (x_m * c_m));
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	return (-1.0 / (x_m * (s_m * c_m))) / (s_m * (x_m * c_m))
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	return Float64(Float64(-1.0 / Float64(x_m * Float64(s_m * c_m))) / Float64(s_m * Float64(x_m * c_m)))
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	tmp = (-1.0 / (x_m * (s_m * c_m))) / (s_m * (x_m * c_m));
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := N[(N[(-1.0 / N[(x$95$m * N[(s$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(s$95$m * N[(x$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\frac{\frac{-1}{x_m \cdot \left(s_m \cdot c_m\right)}}{s_m \cdot \left(x_m \cdot c_m\right)}
\end{array}
Derivation
  1. Initial program 71.8%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/r*71.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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)}} \]
    6. associate-/r*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)}} \]
  6. Applied egg-rr97.8%

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

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

    \[\leadsto \frac{\color{blue}{0 - \frac{\frac{1}{c}}{x \cdot s}}}{s \cdot \left(c \cdot x\right)} \]
  9. Step-by-step derivation
    1. neg-sub039.9%

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

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

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

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

      \[\leadsto \frac{-\frac{1}{\color{blue}{x \cdot \left(c \cdot s\right)}}}{s \cdot \left(c \cdot x\right)} \]
    6. distribute-neg-frac39.9%

      \[\leadsto \frac{\color{blue}{\frac{-1}{x \cdot \left(c \cdot s\right)}}}{s \cdot \left(c \cdot x\right)} \]
    7. metadata-eval39.9%

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

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

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

Alternative 10: 78.0% accurate, 24.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \frac{\frac{1}{c_m}}{\left(x_m \cdot \left(s_m \cdot c_m\right)\right) \cdot \left(x_m \cdot s_m\right)} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (/ (/ 1.0 c_m) (* (* x_m (* s_m c_m)) (* x_m s_m))))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	return (1.0 / c_m) / ((x_m * (s_m * c_m)) * (x_m * s_m));
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    code = (1.0d0 / c_m) / ((x_m * (s_m * c_m)) * (x_m * s_m))
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	return (1.0 / c_m) / ((x_m * (s_m * c_m)) * (x_m * s_m));
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	return (1.0 / c_m) / ((x_m * (s_m * c_m)) * (x_m * s_m))
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	return Float64(Float64(1.0 / c_m) / Float64(Float64(x_m * Float64(s_m * c_m)) * Float64(x_m * s_m)))
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	tmp = (1.0 / c_m) / ((x_m * (s_m * c_m)) * (x_m * s_m));
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := N[(N[(1.0 / c$95$m), $MachinePrecision] / N[(N[(x$95$m * N[(s$95$m * c$95$m), $MachinePrecision]), $MachinePrecision] * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\frac{\frac{1}{c_m}}{\left(x_m \cdot \left(s_m \cdot c_m\right)\right) \cdot \left(x_m \cdot s_m\right)}
\end{array}
Derivation
  1. Initial program 71.8%

    \[\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-/r*71.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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*66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(s \cdot \left(c \cdot x\right)\right)}^{-1} \cdot \color{blue}{{\left(s \cdot \left(c \cdot x\right)\right)}^{-1}} \]
    18. pow-sqr81.0%

      \[\leadsto \color{blue}{{\left(s \cdot \left(c \cdot x\right)\right)}^{\left(2 \cdot -1\right)}} \]
    19. metadata-eval81.0%

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

    \[\leadsto \color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-2}} \]
  11. Step-by-step derivation
    1. metadata-eval81.6%

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

      \[\leadsto \color{blue}{{\left(c \cdot \left(s \cdot x\right)\right)}^{-1} \cdot {\left(c \cdot \left(s \cdot x\right)\right)}^{-1}} \]
    3. inv-pow81.6%

      \[\leadsto \color{blue}{\frac{1}{c \cdot \left(s \cdot x\right)}} \cdot {\left(c \cdot \left(s \cdot x\right)\right)}^{-1} \]
    4. inv-pow81.6%

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 80.1% accurate, 24.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} t_0 := c_m \cdot \left(x_m \cdot s_m\right)\\ \frac{\frac{1}{t_0}}{t_0} \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (let* ((t_0 (* c_m (* x_m s_m)))) (/ (/ 1.0 t_0) t_0)))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double t_0 = c_m * (x_m * s_m);
	return (1.0 / t_0) / t_0;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: t_0
    t_0 = c_m * (x_m * s_m)
    code = (1.0d0 / t_0) / t_0
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double t_0 = c_m * (x_m * s_m);
	return (1.0 / t_0) / t_0;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	t_0 = c_m * (x_m * s_m)
	return (1.0 / t_0) / t_0
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	t_0 = Float64(c_m * Float64(x_m * s_m))
	return Float64(Float64(1.0 / t_0) / t_0)
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	t_0 = c_m * (x_m * s_m);
	tmp = (1.0 / t_0) / t_0;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(c$95$m * N[(x$95$m * s$95$m), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := c_m \cdot \left(x_m \cdot s_m\right)\\
\frac{\frac{1}{t_0}}{t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 71.8%

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/r*71.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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)}} \]
    6. associate-/r*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)}} \]
  6. Applied egg-rr97.8%

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

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

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

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

Alternative 12: 78.8% accurate, 24.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ c_m = \left|c\right| \\ s_m = \left|s\right| \\ [x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\ \\ \begin{array}{l} t_0 := x_m \cdot \left(s_m \cdot c_m\right)\\ \frac{\frac{1}{t_0}}{t_0} \end{array} \end{array} \]
x_m = (fabs.f64 x)
c_m = (fabs.f64 c)
s_m = (fabs.f64 s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
(FPCore (x_m c_m s_m)
 :precision binary64
 (let* ((t_0 (* x_m (* s_m c_m)))) (/ (/ 1.0 t_0) t_0)))
x_m = fabs(x);
c_m = fabs(c);
s_m = fabs(s);
assert(x_m < c_m && c_m < s_m);
double code(double x_m, double c_m, double s_m) {
	double t_0 = x_m * (s_m * c_m);
	return (1.0 / t_0) / t_0;
}
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
real(8) function code(x_m, c_m, s_m)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: c_m
    real(8), intent (in) :: s_m
    real(8) :: t_0
    t_0 = x_m * (s_m * c_m)
    code = (1.0d0 / t_0) / t_0
end function
x_m = Math.abs(x);
c_m = Math.abs(c);
s_m = Math.abs(s);
assert x_m < c_m && c_m < s_m;
public static double code(double x_m, double c_m, double s_m) {
	double t_0 = x_m * (s_m * c_m);
	return (1.0 / t_0) / t_0;
}
x_m = math.fabs(x)
c_m = math.fabs(c)
s_m = math.fabs(s)
[x_m, c_m, s_m] = sort([x_m, c_m, s_m])
def code(x_m, c_m, s_m):
	t_0 = x_m * (s_m * c_m)
	return (1.0 / t_0) / t_0
x_m = abs(x)
c_m = abs(c)
s_m = abs(s)
x_m, c_m, s_m = sort([x_m, c_m, s_m])
function code(x_m, c_m, s_m)
	t_0 = Float64(x_m * Float64(s_m * c_m))
	return Float64(Float64(1.0 / t_0) / t_0)
end
x_m = abs(x);
c_m = abs(c);
s_m = abs(s);
x_m, c_m, s_m = num2cell(sort([x_m, c_m, s_m])){:}
function tmp = code(x_m, c_m, s_m)
	t_0 = x_m * (s_m * c_m);
	tmp = (1.0 / t_0) / t_0;
end
x_m = N[Abs[x], $MachinePrecision]
c_m = N[Abs[c], $MachinePrecision]
s_m = N[Abs[s], $MachinePrecision]
NOTE: x_m, c_m, and s_m should be sorted in increasing order before calling this function.
code[x$95$m_, c$95$m_, s$95$m_] := Block[{t$95$0 = N[(x$95$m * N[(s$95$m * c$95$m), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
c_m = \left|c\right|
\\
s_m = \left|s\right|
\\
[x_m, c_m, s_m] = \mathsf{sort}([x_m, c_m, s_m])\\
\\
\begin{array}{l}
t_0 := x_m \cdot \left(s_m \cdot c_m\right)\\
\frac{\frac{1}{t_0}}{t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 71.8%

    \[\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 61.2%

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

      \[\leadsto \color{blue}{\frac{\frac{1}{{c}^{2}}}{{s}^{2} \cdot {x}^{2}}} \]
    2. *-commutative60.8%

      \[\leadsto \frac{\frac{1}{{c}^{2}}}{\color{blue}{{x}^{2} \cdot {s}^{2}}} \]
    3. unpow260.8%

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\left(c \cdot \left(x \cdot s\right)\right) \cdot \left(c \cdot \left(x \cdot s\right)\right)}} \]
    11. unpow281.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{x \cdot \left(s \cdot c\right)}}{\color{blue}{\left(x \cdot c\right)} \cdot s} \]
    8. associate-*l*82.0%

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

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

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

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

Reproduce

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