?

Average Accuracy: 55.3% → 95.8%
Time: 14.8s
Precision: binary64
Cost: 13440

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 55.3%

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

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

    [Start]55.3

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

    *-commutative [=>]55.3

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

    associate-*r* [=>]49.7

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

    associate-*r* [=>]49.5

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

    unpow2 [=>]49.5

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

    unswap-sqr [=>]68.2

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

    unpow2 [=>]68.2

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

    swap-sqr [<=]95.4

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

    *-commutative [<=]95.4

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

    *-commutative [<=]95.4

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

    *-commutative [=>]95.4

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

    *-commutative [=>]95.4

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

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

    [Start]95.4

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

    clear-num [=>]95.4

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

    associate-/r/ [=>]95.4

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

    pow2 [=>]95.4

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

    pow-flip [=>]95.8

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

    metadata-eval [=>]95.8

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

    cos-2 [=>]95.7

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

    cos-sum [<=]95.8

    \[ {\left(s \cdot \left(x \cdot c\right)\right)}^{-2} \cdot \color{blue}{\cos \left(x + x\right)} \]
  4. Final simplification95.8%

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

Alternatives

Alternative 1
Accuracy77.1%
Cost7756
\[\begin{array}{l} t_0 := c \cdot \left(s \cdot x\right)\\ t_1 := \frac{\cos \left(x \cdot 2\right)}{s \cdot \left(\left(x \cdot x\right) \cdot \left(s \cdot \left(c \cdot c\right)\right)\right)}\\ \mathbf{if}\;x \leq -2.8 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-15}:\\ \;\;\;\;\frac{1}{s \cdot \left(x \cdot c\right)} \cdot \frac{\frac{1}{s}}{x \cdot c}\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+123}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_0 \cdot t_0}\\ \end{array} \]
Alternative 2
Accuracy75.9%
Cost7756
\[\begin{array}{l} t_0 := c \cdot \left(s \cdot x\right)\\ t_1 := \cos \left(x \cdot 2\right)\\ \mathbf{if}\;x \leq -1.1 \cdot 10^{-6}:\\ \;\;\;\;\frac{t_1}{x \cdot \left(\left(x \cdot \left(c \cdot c\right)\right) \cdot \left(s \cdot s\right)\right)}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-15}:\\ \;\;\;\;\frac{1}{s \cdot \left(x \cdot c\right)} \cdot \frac{\frac{1}{s}}{x \cdot c}\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+123}:\\ \;\;\;\;\frac{t_1}{s \cdot \left(\left(x \cdot x\right) \cdot \left(s \cdot \left(c \cdot c\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_0 \cdot t_0}\\ \end{array} \]
Alternative 3
Accuracy96.2%
Cost7488
\[\cos \left(x + x\right) \cdot \frac{\frac{\frac{1}{c}}{s \cdot x}}{c \cdot \left(s \cdot x\right)} \]
Alternative 4
Accuracy95.8%
Cost7488
\[\begin{array}{l} t_0 := s \cdot \left(x \cdot c\right)\\ \frac{\cos \left(x + x\right)}{t_0} \cdot \frac{1}{t_0} \end{array} \]
Alternative 5
Accuracy92.4%
Cost7360
\[\frac{\cos \left(x \cdot 2\right)}{\left(s \cdot \left(x \cdot c\right)\right) \cdot \left(c \cdot \left(s \cdot x\right)\right)} \]
Alternative 6
Accuracy95.4%
Cost7360
\[\begin{array}{l} t_0 := s \cdot \left(x \cdot c\right)\\ \frac{\cos \left(x \cdot 2\right)}{t_0 \cdot t_0} \end{array} \]
Alternative 7
Accuracy73.1%
Cost960
\[\frac{1}{s \cdot \left(x \cdot c\right)} \cdot \frac{\frac{1}{s}}{x \cdot c} \]
Alternative 8
Accuracy73.1%
Cost832
\[\begin{array}{l} t_0 := c \cdot \left(s \cdot x\right)\\ \frac{1}{t_0 \cdot t_0} \end{array} \]
Alternative 9
Accuracy72.9%
Cost832
\[\begin{array}{l} t_0 := s \cdot \left(x \cdot c\right)\\ \frac{1}{t_0 \cdot t_0} \end{array} \]
Alternative 10
Accuracy73.1%
Cost832
\[\begin{array}{l} t_0 := s \cdot \left(x \cdot c\right)\\ \frac{\frac{1}{t_0}}{t_0} \end{array} \]

Error

Reproduce?

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