Average Error: 4.6 → 2.4
Time: 30.0s
Precision: 64
$9.999999960041972002500187954865396022797 \cdot 10^{-12} \le \left|pR\right| \le 10^{4}$
$\left(\frac{1}{{pR}^{2}} \cdot \left(\cos \left(p0 - pR \cdot t\right) - \cos p0\right)\right) \cdot a$
$\left(\frac{1}{{pR}^{2}} \cdot \left(-2 \cdot \left(\sin \left(\frac{\left(p0 - pR \cdot t\right) + p0}{2}\right) \cdot \sin \left(-\frac{t \cdot pR}{2}\right)\right)\right)\right) \cdot a$
\left(\frac{1}{{pR}^{2}} \cdot \left(\cos \left(p0 - pR \cdot t\right) - \cos p0\right)\right) \cdot a
\left(\frac{1}{{pR}^{2}} \cdot \left(-2 \cdot \left(\sin \left(\frac{\left(p0 - pR \cdot t\right) + p0}{2}\right) \cdot \sin \left(-\frac{t \cdot pR}{2}\right)\right)\right)\right) \cdot a
double f(double pR, double p0, double t, double a) {
double r503714 = 1.0;
double r503715 = pR;
double r503716 = 2.0;
double r503717 = pow(r503715, r503716);
double r503718 = r503714 / r503717;
double r503719 = p0;
double r503720 = t;
double r503721 = r503715 * r503720;
double r503722 = r503719 - r503721;
double r503723 = cos(r503722);
double r503724 = cos(r503719);
double r503725 = r503723 - r503724;
double r503726 = r503718 * r503725;
double r503727 = a;
double r503728 = r503726 * r503727;
return r503728;
}


double f(double pR, double p0, double t, double a) {
double r503729 = 1.0;
double r503730 = pR;
double r503731 = 2.0;
double r503732 = pow(r503730, r503731);
double r503733 = r503729 / r503732;
double r503734 = -2.0;
double r503735 = p0;
double r503736 = t;
double r503737 = r503730 * r503736;
double r503738 = r503735 - r503737;
double r503739 = r503738 + r503735;
double r503740 = 2.0;
double r503741 = r503739 / r503740;
double r503742 = sin(r503741);
double r503743 = r503736 * r503730;
double r503744 = r503743 / r503740;
double r503745 = -r503744;
double r503746 = sin(r503745);
double r503747 = r503742 * r503746;
double r503748 = r503734 * r503747;
double r503749 = r503733 * r503748;
double r503750 = a;
double r503751 = r503749 * r503750;
return r503751;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 4.6

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

$\leadsto \left(\frac{1}{{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)}\right) \cdot a$
4. Simplified2.4

$\leadsto \left(\frac{1}{{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)\right) \cdot a$
5. Final simplification2.4

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

# Reproduce

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