?

Average Accuracy: 49.9% → 99.8%
Time: 13.0s
Precision: binary64
Cost: 13376

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 49.9%

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

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

    [Start]49.9

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

    associate-/r* [=>]51.0

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

    div-inv [=>]51.0

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

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

    [Start]51.0

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

    flip-- [=>]50.8

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

    div-inv [=>]50.8

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

    metadata-eval [=>]50.8

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

    1-sub-cos [=>]75.3

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

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

    [Start]75.3

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

    *-commutative [<=]75.3

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

    associate-*l/ [=>]75.3

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

    *-lft-identity [=>]75.3

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

    associate-*l/ [<=]75.3

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

    *-commutative [=>]75.3

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

    hang-0p-tan [=>]75.5

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

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

    [Start]75.5

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

    un-div-inv [=>]75.6

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

    *-commutative [=>]75.6

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

    *-un-lft-identity [=>]75.6

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

    times-frac [=>]99.8

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

    tan-quot [=>]99.8

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

    associate-/l/ [=>]99.8

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

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

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

    tan-quot [<=]99.8

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

    div-inv [=>]99.8

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

    metadata-eval [=>]99.8

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

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

    [Start]99.8

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

    associate-*r/ [=>]75.6

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

    associate-/l* [=>]99.8

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

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

Alternatives

Alternative 1
Accuracy99.4%
Cost13640
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0052:\\ \;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-35}:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\tan \left(x \cdot 0.5\right) \cdot \frac{\sin x}{x \cdot x}\\ \end{array} \]
Alternative 2
Accuracy99.4%
Cost13376
\[\frac{\tan \left(x \cdot 0.5\right)}{x \cdot \frac{x}{\sin x}} \]
Alternative 3
Accuracy99.8%
Cost13376
\[\frac{\tan \left(x \cdot 0.5\right) \cdot \frac{\sin x}{x}}{x} \]
Alternative 4
Accuracy99.2%
Cost7113
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0052 \lor \neg \left(x \leq 0.0047\right):\\ \;\;\;\;\frac{1 - \cos x}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \end{array} \]
Alternative 5
Accuracy99.3%
Cost7112
\[\begin{array}{l} t_0 := 1 - \cos x\\ \mathbf{if}\;x \leq -0.0052:\\ \;\;\;\;\frac{\frac{t_0}{x}}{x}\\ \mathbf{elif}\;x \leq 0.0047:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{x \cdot x}\\ \end{array} \]
Alternative 6
Accuracy78.2%
Cost832
\[\frac{\frac{1}{x}}{x \cdot 0.16666666666666666 + \frac{1}{x} \cdot 2} \]
Alternative 7
Accuracy78.3%
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -3.2 \lor \neg \left(x \leq 3.25\right):\\ \;\;\;\;\frac{6}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \end{array} \]
Alternative 8
Accuracy78.0%
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -3.5 \lor \neg \left(x \leq 3.45\right):\\ \;\;\;\;\frac{6}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5\\ \end{array} \]
Alternative 9
Accuracy52.6%
Cost64
\[0.5 \]

Error

Reproduce?

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