Average Error: 30.6 → 0.1
Time: 24.9s
Precision: 64
$\frac{1 - \cos x}{{x}^{2}}$
$\frac{\sin x}{x} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x}$
\frac{1 - \cos x}{{x}^{2}}
\frac{\sin x}{x} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x}
double f(double x) {
double r11612543 = 1.0;
double r11612544 = x;
double r11612545 = cos(r11612544);
double r11612546 = r11612543 - r11612545;
double r11612547 = 2.0;
double r11612548 = pow(r11612544, r11612547);
double r11612549 = r11612546 / r11612548;
return r11612549;
}


double f(double x) {
double r11612550 = x;
double r11612551 = sin(r11612550);
double r11612552 = r11612551 / r11612550;
double r11612553 = 2.0;
double r11612554 = r11612550 / r11612553;
double r11612555 = tan(r11612554);
double r11612556 = r11612555 / r11612550;
double r11612557 = r11612552 * r11612556;
return r11612557;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 30.6

$\frac{1 - \cos x}{{x}^{2}}$
2. Simplified30.6

$\leadsto \color{blue}{\frac{1 - \cos x}{x \cdot x}}$
3. Using strategy rm
4. Applied flip--30.8

$\leadsto \frac{\color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{1 + \cos x}}}{x \cdot x}$
5. Simplified15.3

$\leadsto \frac{\frac{\color{blue}{\sin x \cdot \sin x}}{1 + \cos x}}{x \cdot x}$
6. Using strategy rm
7. Applied *-un-lft-identity15.3

$\leadsto \frac{\frac{\sin x \cdot \sin x}{1 + \color{blue}{1 \cdot \cos x}}}{x \cdot x}$
8. Applied *-un-lft-identity15.3

$\leadsto \frac{\frac{\sin x \cdot \sin x}{\color{blue}{1 \cdot 1} + 1 \cdot \cos x}}{x \cdot x}$
9. Applied distribute-lft-out15.3

$\leadsto \frac{\frac{\sin x \cdot \sin x}{\color{blue}{1 \cdot \left(1 + \cos x\right)}}}{x \cdot x}$
10. Applied times-frac15.3

$\leadsto \frac{\color{blue}{\frac{\sin x}{1} \cdot \frac{\sin x}{1 + \cos x}}}{x \cdot x}$
11. Applied times-frac0.3

$\leadsto \color{blue}{\frac{\frac{\sin x}{1}}{x} \cdot \frac{\frac{\sin x}{1 + \cos x}}{x}}$
12. Simplified0.3

$\leadsto \color{blue}{\frac{\sin x}{x}} \cdot \frac{\frac{\sin x}{1 + \cos x}}{x}$
13. Simplified0.1

$\leadsto \frac{\sin x}{x} \cdot \color{blue}{\frac{\tan \left(\frac{x}{2}\right)}{x}}$
14. Final simplification0.1

$\leadsto \frac{\sin x}{x} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x}$

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "(1-cos(x))/x^2"
(/ (- 1 (cos x)) (pow x 2)))