Average Error: 4.5 → 2.4
Time: 19.9s
Precision: 64
$1.000000011686097423080354928970336914062 \cdot 10^{-7} \le \left|pR\right| \le 100$
$\frac{a}{{pR}^{2}} \cdot \left(\cos \left(p0 + pR \cdot t\right) - \cos p0\right)$
$\frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \left(\sin \left(\frac{\left(p0 + pR \cdot t\right) + p0}{2}\right) \cdot \sin \left(\frac{pR \cdot t}{2}\right)\right)\right)$
\frac{a}{{pR}^{2}} \cdot \left(\cos \left(p0 + pR \cdot t\right) - \cos p0\right)
\frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \left(\sin \left(\frac{\left(p0 + pR \cdot t\right) + p0}{2}\right) \cdot \sin \left(\frac{pR \cdot t}{2}\right)\right)\right)
double f(double a, double pR, double p0, double t) {
double r2231350 = a;
double r2231351 = pR;
double r2231352 = 2.0;
double r2231353 = pow(r2231351, r2231352);
double r2231354 = r2231350 / r2231353;
double r2231355 = p0;
double r2231356 = t;
double r2231357 = r2231351 * r2231356;
double r2231358 = r2231355 + r2231357;
double r2231359 = cos(r2231358);
double r2231360 = cos(r2231355);
double r2231361 = r2231359 - r2231360;
double r2231362 = r2231354 * r2231361;
return r2231362;
}


double f(double a, double pR, double p0, double t) {
double r2231363 = a;
double r2231364 = pR;
double r2231365 = 2.0;
double r2231366 = pow(r2231364, r2231365);
double r2231367 = r2231363 / r2231366;
double r2231368 = -2.0;
double r2231369 = p0;
double r2231370 = t;
double r2231371 = r2231364 * r2231370;
double r2231372 = r2231369 + r2231371;
double r2231373 = r2231372 + r2231369;
double r2231374 = 2.0;
double r2231375 = r2231373 / r2231374;
double r2231376 = sin(r2231375);
double r2231377 = r2231371 / r2231374;
double r2231378 = sin(r2231377);
double r2231379 = r2231376 * r2231378;
double r2231380 = r2231368 * r2231379;
double r2231381 = r2231367 * r2231380;
return r2231381;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 4.5

$\frac{a}{{pR}^{2}} \cdot \left(\cos \left(p0 + pR \cdot t\right) - \cos p0\right)$
2. Using strategy rm
3. Applied diff-cos4.0

$\leadsto \frac{a}{{pR}^{2}} \cdot \color{blue}{\left(-2 \cdot \left(\sin \left(\frac{\left(p0 + pR \cdot t\right) - p0}{2}\right) \cdot \sin \left(\frac{\left(p0 + pR \cdot t\right) + p0}{2}\right)\right)\right)}$
4. Simplified2.4

$\leadsto \frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \color{blue}{\left(\sin \left(\frac{\left(p0 + pR \cdot t\right) + p0}{2}\right) \cdot \sin \left(\frac{pR \cdot t}{2}\right)\right)}\right)$
5. Final simplification2.4

$\leadsto \frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \left(\sin \left(\frac{\left(p0 + pR \cdot t\right) + p0}{2}\right) \cdot \sin \left(\frac{pR \cdot t}{2}\right)\right)\right)$

# Reproduce

herbie shell --seed 1
(FPCore (a pR p0 t)
:name "a/pR^2*(cos(p0 + pR*t) - cos(p0))"
:precision binary32
:pre (<= 1.00000001e-7 (fabs pR) 100)
(* (/ a (pow pR 2)) (- (cos (+ p0 (* pR t))) (cos p0))))