?

Average Error: 31.1 → 0.1
Time: 12.5s
Precision: binary64
Cost: 13504

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 31.1

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

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

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

    [Start]15.4

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

    associate-*l* [=>]15.4

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

    associate-*r/ [=>]15.4

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

    *-rgt-identity [=>]15.4

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

    hang-0p-tan [=>]15.2

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

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

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

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

Alternatives

Alternative 1
Error0.3
Cost13448
\[\begin{array}{l} t_0 := 1 - \cos x\\ \mathbf{if}\;x \leq -0.0051:\\ \;\;\;\;\frac{\frac{t_0}{x}}{x}\\ \mathbf{elif}\;x \leq 0.0048:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot {x}^{-2}\\ \end{array} \]
Alternative 2
Error0.4
Cost13376
\[\frac{\sin x}{x \cdot \frac{x}{\tan \left(x \cdot 0.5\right)}} \]
Alternative 3
Error0.1
Cost13376
\[\frac{\tan \left(x \cdot 0.5\right) \cdot \frac{\sin x}{x}}{x} \]
Alternative 4
Error0.6
Cost7113
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0051 \lor \neg \left(x \leq 0.0048\right):\\ \;\;\;\;\frac{1 - \cos x}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \end{array} \]
Alternative 5
Error0.3
Cost7113
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0051 \lor \neg \left(x \leq 0.0048\right):\\ \;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \end{array} \]
Alternative 6
Error14.2
Cost969
\[\begin{array}{l} \mathbf{if}\;x \leq -3.5 \lor \neg \left(x \leq 3.5\right):\\ \;\;\;\;\frac{6 - \frac{72}{x \cdot x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \end{array} \]
Alternative 7
Error14.3
Cost832
\[\frac{1}{x \cdot \left(x \cdot 0.16666666666666666 + 2 \cdot \frac{1}{x}\right)} \]
Alternative 8
Error14.2
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -3.25 \lor \neg \left(x \leq 3.2\right):\\ \;\;\;\;\frac{6}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\ \end{array} \]
Alternative 9
Error14.4
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -3.5 \lor \neg \left(x \leq 3.5\right):\\ \;\;\;\;\frac{6}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5\\ \end{array} \]
Alternative 10
Error31.4
Cost64
\[0.5 \]

Error

Reproduce?

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