?

Average Accuracy: 51.2% → 99.8%
Time: 12.3s
Precision: binary64
Cost: 13504.00

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 51.2%

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

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

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

    [Start]74.8

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

    associate-*l* [=>]74.8

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

    associate-*r/ [=>]74.8

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

    *-rgt-identity [=>]74.8

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

    hang-0p-tan [=>]75.1

    \[ \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}} \]
  5. Applied egg-rr99.8%

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

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

Alternatives

Alternative 1
Accuracy99.6%
Cost13449.00
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0049 \lor \neg \left(x \leq 0.0052\right):\\ \;\;\;\;{x}^{-2} \cdot \left(1 - \cos x\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \end{array} \]
Alternative 2
Accuracy99.8%
Cost13376.00
\[\frac{\tan \left(x \cdot 0.5\right)}{x} \cdot \frac{\sin x}{x} \]
Alternative 3
Accuracy99.1%
Cost7113.00
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0049 \lor \neg \left(x \leq 0.0052\right):\\ \;\;\;\;\frac{1 - \cos x}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \end{array} \]
Alternative 4
Accuracy99.6%
Cost7113.00
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0049 \lor \neg \left(x \leq 0.0052\right):\\ \;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \end{array} \]
Alternative 5
Accuracy99.6%
Cost7112.00
\[\begin{array}{l} t_0 := 1 - \cos x\\ \mathbf{if}\;x \leq -0.0049:\\ \;\;\;\;t_0 \cdot \frac{\frac{1}{x}}{x}\\ \mathbf{elif}\;x \leq 0.0052:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t_0}{x}}{x}\\ \end{array} \]
Alternative 6
Accuracy75.9%
Cost969.00
\[\begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+76} \lor \neg \left(x \leq 1.3 \cdot 10^{+77}\right):\\ \;\;\;\;\frac{1}{x} \cdot \left(\frac{1}{x} + \frac{-1}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5\\ \end{array} \]
Alternative 7
Accuracy78.3%
Cost832.00
\[\frac{-1}{x \cdot \left(x \cdot -0.16666666666666666 + 2 \cdot \frac{-1}{x}\right)} \]
Alternative 8
Accuracy51.2%
Cost64.00
\[0.5 \]

Error

Reproduce?

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