Average Error: 4.5 → 2.4
Time: 29.5s
Precision: 64
$9.999999974752427078783512115478515625 \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(\left(\sin \left(\frac{p0}{2}\right) \cdot \cos \left(\frac{pR \cdot t - p0}{2}\right) - \cos \left(\frac{p0}{2}\right) \cdot \sin \left(\frac{pR \cdot t - p0}{2}\right)\right) \cdot \sin \left(-\frac{t \cdot pR}{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(\left(\sin \left(\frac{p0}{2}\right) \cdot \cos \left(\frac{pR \cdot t - p0}{2}\right) - \cos \left(\frac{p0}{2}\right) \cdot \sin \left(\frac{pR \cdot t - p0}{2}\right)\right) \cdot \sin \left(-\frac{t \cdot pR}{2}\right)\right)\right)
double f(double a, double pR, double p0, double t) {
double r519858 = a;
double r519859 = pR;
double r519860 = 2.0;
double r519861 = pow(r519859, r519860);
double r519862 = r519858 / r519861;
double r519863 = p0;
double r519864 = t;
double r519865 = r519859 * r519864;
double r519866 = r519863 - r519865;
double r519867 = cos(r519866);
double r519868 = cos(r519863);
double r519869 = r519867 - r519868;
double r519870 = r519862 * r519869;
return r519870;
}


double f(double a, double pR, double p0, double t) {
double r519871 = a;
double r519872 = pR;
double r519873 = 2.0;
double r519874 = pow(r519872, r519873);
double r519875 = r519871 / r519874;
double r519876 = -2.0;
double r519877 = p0;
double r519878 = 2.0;
double r519879 = r519877 / r519878;
double r519880 = sin(r519879);
double r519881 = t;
double r519882 = r519872 * r519881;
double r519883 = r519882 - r519877;
double r519884 = r519883 / r519878;
double r519885 = cos(r519884);
double r519886 = r519880 * r519885;
double r519887 = cos(r519879);
double r519888 = sin(r519884);
double r519889 = r519887 * r519888;
double r519890 = r519886 - r519889;
double r519891 = r519881 * r519872;
double r519892 = r519891 / r519878;
double r519893 = -r519892;
double r519894 = sin(r519893);
double r519895 = r519890 * r519894;
double r519896 = r519876 * r519895;
double r519897 = r519875 * r519896;
return r519897;
}



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.1

$\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{t \cdot pR}{2}\right)\right)}\right)$
5. Using strategy rm
6. Applied associate-+l-2.4

$\leadsto \frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \left(\sin \left(\frac{\color{blue}{p0 - \left(pR \cdot t - p0\right)}}{2}\right) \cdot \sin \left(-\frac{t \cdot pR}{2}\right)\right)\right)$
7. Applied div-sub2.4

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

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

$\leadsto \frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \left(\left(\sin \left(\frac{p0}{2}\right) \cdot \cos \left(\frac{pR \cdot t - p0}{2}\right) - \cos \left(\frac{p0}{2}\right) \cdot \sin \left(\frac{pR \cdot t - p0}{2}\right)\right) \cdot \sin \left(-\frac{t \cdot pR}{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 (<= 9.99999997e-7 (fabs pR) 100)
(* (/ a (pow pR 2)) (- (cos (- p0 (* pR t))) (cos p0))))