?

Average Accuracy: 50.3% → 99.8%
Time: 14.9s
Precision: binary64
Cost: 13376

?

\[\frac{1 - \cos x}{x \cdot x} \]
\[\frac{\frac{\sin x}{x}}{\frac{x}{\tan \left(x \cdot 0.5\right)}} \]
(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x)))
(FPCore (x) :precision binary64 (/ (/ (sin x) x) (/ x (tan (* x 0.5)))))
double code(double x) {
	return (1.0 - cos(x)) / (x * x);
}
double code(double x) {
	return (sin(x) / x) / (x / tan((x * 0.5)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (1.0d0 - cos(x)) / (x * x)
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = (sin(x) / x) / (x / tan((x * 0.5d0)))
end function
public static double code(double x) {
	return (1.0 - Math.cos(x)) / (x * x);
}
public static double code(double x) {
	return (Math.sin(x) / x) / (x / Math.tan((x * 0.5)));
}
def code(x):
	return (1.0 - math.cos(x)) / (x * x)
def code(x):
	return (math.sin(x) / x) / (x / math.tan((x * 0.5)))
function code(x)
	return Float64(Float64(1.0 - cos(x)) / Float64(x * x))
end
function code(x)
	return Float64(Float64(sin(x) / x) / Float64(x / tan(Float64(x * 0.5))))
end
function tmp = code(x)
	tmp = (1.0 - cos(x)) / (x * x);
end
function tmp = code(x)
	tmp = (sin(x) / x) / (x / tan((x * 0.5)));
end
code[x_] := N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] / N[(x / N[Tan[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1 - \cos x}{x \cdot x}
\frac{\frac{\sin x}{x}}{\frac{x}{\tan \left(x \cdot 0.5\right)}}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 50.3%

    \[\frac{1 - \cos x}{x \cdot x} \]
  2. Applied egg-rr75.2%

    \[\leadsto \frac{\color{blue}{\left(\sin x \cdot \sin x\right) \cdot \frac{1}{1 + \cos x}}}{x \cdot x} \]
    Proof

    [Start]50.3

    \[ \frac{1 - \cos x}{x \cdot x} \]

    flip-- [=>]50.1

    \[ \frac{\color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{1 + \cos x}}}{x \cdot x} \]

    div-inv [=>]50.1

    \[ \frac{\color{blue}{\left(1 \cdot 1 - \cos x \cdot \cos x\right) \cdot \frac{1}{1 + \cos x}}}{x \cdot x} \]

    metadata-eval [=>]50.1

    \[ \frac{\left(\color{blue}{1} - \cos x \cdot \cos x\right) \cdot \frac{1}{1 + \cos x}}{x \cdot x} \]

    1-sub-cos [=>]75.2

    \[ \frac{\color{blue}{\left(\sin x \cdot \sin x\right)} \cdot \frac{1}{1 + \cos x}}{x \cdot x} \]
  3. Simplified75.5%

    \[\leadsto \frac{\color{blue}{\sin x \cdot \tan \left(\frac{x}{2}\right)}}{x \cdot x} \]
    Proof

    [Start]75.2

    \[ \frac{\left(\sin x \cdot \sin x\right) \cdot \frac{1}{1 + \cos x}}{x \cdot x} \]

    associate-*l* [=>]75.2

    \[ \frac{\color{blue}{\sin x \cdot \left(\sin x \cdot \frac{1}{1 + \cos x}\right)}}{x \cdot x} \]

    associate-*r/ [=>]75.2

    \[ \frac{\sin x \cdot \color{blue}{\frac{\sin x \cdot 1}{1 + \cos x}}}{x \cdot x} \]

    *-rgt-identity [=>]75.2

    \[ \frac{\sin x \cdot \frac{\color{blue}{\sin x}}{1 + \cos x}}{x \cdot x} \]

    hang-0p-tan [=>]75.5

    \[ \frac{\sin x \cdot \color{blue}{\tan \left(\frac{x}{2}\right)}}{x \cdot x} \]
  4. Applied egg-rr99.8%

    \[\leadsto \color{blue}{\frac{\tan \left(x \cdot 0.5\right)}{x} \cdot \frac{\sin x}{x}} \]
    Proof

    [Start]75.5

    \[ \frac{\sin x \cdot \tan \left(\frac{x}{2}\right)}{x \cdot x} \]

    times-frac [=>]99.8

    \[ \color{blue}{\frac{\sin x}{x} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x}} \]

    *-commutative [=>]99.8

    \[ \color{blue}{\frac{\tan \left(\frac{x}{2}\right)}{x} \cdot \frac{\sin x}{x}} \]

    div-inv [=>]99.8

    \[ \frac{\tan \color{blue}{\left(x \cdot \frac{1}{2}\right)}}{x} \cdot \frac{\sin x}{x} \]

    metadata-eval [=>]99.8

    \[ \frac{\tan \left(x \cdot \color{blue}{0.5}\right)}{x} \cdot \frac{\sin x}{x} \]
  5. Applied egg-rr99.8%

    \[\leadsto \color{blue}{\frac{\frac{\sin x}{x}}{\frac{x}{\tan \left(x \cdot 0.5\right)}}} \]
    Proof

    [Start]99.8

    \[ \frac{\tan \left(x \cdot 0.5\right)}{x} \cdot \frac{\sin x}{x} \]

    clear-num [=>]99.8

    \[ \color{blue}{\frac{1}{\frac{x}{\tan \left(x \cdot 0.5\right)}}} \cdot \frac{\sin x}{x} \]

    associate-*l/ [=>]99.8

    \[ \color{blue}{\frac{1 \cdot \frac{\sin x}{x}}{\frac{x}{\tan \left(x \cdot 0.5\right)}}} \]

    *-un-lft-identity [<=]99.8

    \[ \frac{\color{blue}{\frac{\sin x}{x}}}{\frac{x}{\tan \left(x \cdot 0.5\right)}} \]
  6. Final simplification99.8%

    \[\leadsto \frac{\frac{\sin x}{x}}{\frac{x}{\tan \left(x \cdot 0.5\right)}} \]

Alternatives

Alternative 1
Accuracy99.0%
Cost20680
\[\begin{array}{l} t_0 := \frac{1 - \cos x}{x \cdot x}\\ t_1 := x \cdot 0.16666666666666666 + \frac{1}{x} \cdot 2\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;\frac{-1}{\frac{t_1}{\frac{-1}{x}}}\\ \mathbf{elif}\;t_0 \leq 0.495:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{t_1}\\ \end{array} \]
Alternative 2
Accuracy99.4%
Cost13641
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0003 \lor \neg \left(x \leq 5 \cdot 10^{-10}\right):\\ \;\;\;\;\tan \left(x \cdot 0.5\right) \cdot \frac{\sin x}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{x \cdot 0.16666666666666666 + \frac{1}{x} \cdot 2}\\ \end{array} \]
Alternative 3
Accuracy99.8%
Cost13376
\[\frac{\sin x}{x} \cdot \frac{\tan \left(x \cdot 0.5\right)}{x} \]
Alternative 4
Accuracy99.6%
Cost7240
\[\begin{array}{l} t_0 := \frac{1 - \cos x}{x}\\ \mathbf{if}\;x \leq -0.005:\\ \;\;\;\;\frac{t_0}{x}\\ \mathbf{elif}\;x \leq 0.0046:\\ \;\;\;\;\frac{\frac{1}{x}}{x \cdot 0.16666666666666666 + \frac{1}{x} \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} \cdot t_0\\ \end{array} \]
Alternative 5
Accuracy99.5%
Cost7240
\[\begin{array}{l} \mathbf{if}\;x \leq -0.005:\\ \;\;\;\;\frac{\frac{1}{x} \cdot \left(-1 + \cos x\right)}{-x}\\ \mathbf{elif}\;x \leq 0.0046:\\ \;\;\;\;\frac{\frac{1}{x}}{x \cdot 0.16666666666666666 + \frac{1}{x} \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{1 - \cos x}{x}\\ \end{array} \]
Alternative 6
Accuracy99.4%
Cost7112
\[\begin{array}{l} t_0 := 1 - \cos x\\ \mathbf{if}\;x \leq -0.005:\\ \;\;\;\;\frac{\frac{t_0}{x}}{x}\\ \mathbf{elif}\;x \leq 0.0046:\\ \;\;\;\;\frac{\frac{1}{x}}{x \cdot 0.16666666666666666 + \frac{1}{x} \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{x \cdot x}\\ \end{array} \]
Alternative 7
Accuracy77.8%
Cost969
\[\begin{array}{l} \mathbf{if}\;x \leq -3.5 \lor \neg \left(x \leq 3.4\right):\\ \;\;\;\;\frac{6 + \frac{-72}{x \cdot x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\ \end{array} \]
Alternative 8
Accuracy77.8%
Cost960
\[\frac{-1}{\frac{x \cdot 0.16666666666666666 + \frac{1}{x} \cdot 2}{\frac{-1}{x}}} \]
Alternative 9
Accuracy77.8%
Cost832
\[\frac{\frac{1}{x}}{x \cdot 0.16666666666666666 + \frac{1}{x} \cdot 2} \]
Alternative 10
Accuracy77.8%
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -3.3 \lor \neg \left(x \leq 3.3\right):\\ \;\;\;\;\frac{6}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\ \end{array} \]
Alternative 11
Accuracy77.6%
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -3.5 \lor \neg \left(x \leq 3.4\right):\\ \;\;\;\;\frac{6}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5\\ \end{array} \]
Alternative 12
Accuracy52.1%
Cost64
\[0.5 \]

Error

Reproduce?

herbie shell --seed 2023131 
(FPCore (x)
  :name "cos2 (problem 3.4.1)"
  :precision binary64
  (/ (- 1.0 (cos x)) (* x x)))