?

Average Error: 31.4 → 0.1
Time: 10.6s
Precision: binary64
Cost: 13376

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 31.4

    \[\frac{1 - \cos x}{x \cdot x} \]
  2. Applied egg-rr15.9

    \[\leadsto \frac{\color{blue}{\frac{\sin x}{\frac{1 + \cos x}{\sin x}}}}{x \cdot x} \]
  3. Applied egg-rr0.1

    \[\leadsto \color{blue}{\frac{\tan \left(\frac{x}{2}\right)}{x} \cdot \frac{\sin x}{x}} \]
  4. Applied egg-rr0.1

    \[\leadsto \color{blue}{\frac{\frac{\tan \left(x \cdot 0.5\right)}{x}}{\frac{x}{\sin x}}} \]
  5. Final simplification0.1

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

Alternatives

Alternative 1
Error0.4
Cost13448
\[\begin{array}{l} t_0 := 1 - \cos x\\ \mathbf{if}\;x \leq -0.0046:\\ \;\;\;\;\frac{\frac{1}{\frac{1}{t_0}}}{x \cdot x}\\ \mathbf{elif}\;x \leq 0.0037:\\ \;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot {x}^{-2}\\ \end{array} \]
Alternative 2
Error0.1
Cost13376
\[\frac{\tan \left(\frac{x}{2}\right)}{x} \cdot \frac{\sin x}{x} \]
Alternative 3
Error0.4
Cost7236
\[\begin{array}{l} t_0 := 1 - \cos x\\ \mathbf{if}\;x \leq -0.0046:\\ \;\;\;\;\frac{\frac{1}{\frac{1}{t_0}}}{x \cdot x}\\ \mathbf{elif}\;x \leq 0.0037:\\ \;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t_0}{x}}{x}\\ \end{array} \]
Alternative 4
Error0.6
Cost7113
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0046 \lor \neg \left(x \leq 0.0037\right):\\ \;\;\;\;\frac{1 - \cos x}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\ \end{array} \]
Alternative 5
Error0.4
Cost7112
\[\begin{array}{l} t_0 := 1 - \cos x\\ \mathbf{if}\;x \leq -0.0046:\\ \;\;\;\;\frac{t_0}{x \cdot x}\\ \mathbf{elif}\;x \leq 0.0037:\\ \;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t_0}{x}}{x}\\ \end{array} \]
Alternative 6
Error14.0
Cost1096
\[\begin{array}{l} \mathbf{if}\;x \leq -3.25:\\ \;\;\;\;\frac{6}{x \cdot x}\\ \mathbf{elif}\;x \leq 10^{-6}:\\ \;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{0.16666666666666666 + \frac{2}{x \cdot x}}}{x \cdot x}\\ \end{array} \]
Alternative 7
Error14.0
Cost969
\[\begin{array}{l} \mathbf{if}\;x \leq -3.25 \lor \neg \left(x \leq 3.3\right):\\ \;\;\;\;\frac{6}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5 + \left(\left(1 + \left(x \cdot x\right) \cdot -0.041666666666666664\right) + -1\right)\\ \end{array} \]
Alternative 8
Error14.0
Cost968
\[\begin{array}{l} \mathbf{if}\;x \leq -3.25:\\ \;\;\;\;\frac{6}{x \cdot x}\\ \mathbf{elif}\;x \leq 3.45:\\ \;\;\;\;0.5 + \left(\left(1 + \left(x \cdot x\right) \cdot -0.041666666666666664\right) + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{6 + \frac{-72}{x \cdot x}}{x \cdot x}\\ \end{array} \]
Alternative 9
Error14.0
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -3.25 \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 10
Error14.2
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 11
Error31.1
Cost64
\[0.5 \]

Error

Reproduce?

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