Average Error: 27.8 → 1.5
Time: 23.4s
Precision: 64
\[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot {sin}^{2}\right) \cdot x\right) \cdot {cos}^{2}} \le -0.0:\\ \;\;\;\;\left(\sqrt[3]{\cos \left(2 \cdot x\right)} \cdot \sqrt[3]{\cos \left(2 \cdot x\right)}\right) \cdot \left(\frac{\frac{1}{cos}}{sin \cdot x} \cdot \left(\sqrt[3]{\cos \left(2 \cdot x\right)} \cdot \frac{\frac{1}{cos}}{sin \cdot x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot \left(sin \cdot cos\right)\right) \cdot \left(x \cdot \left(sin \cdot cos\right)\right)}\\ \end{array}\]
\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}
\begin{array}{l}
\mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot {sin}^{2}\right) \cdot x\right) \cdot {cos}^{2}} \le -0.0:\\
\;\;\;\;\left(\sqrt[3]{\cos \left(2 \cdot x\right)} \cdot \sqrt[3]{\cos \left(2 \cdot x\right)}\right) \cdot \left(\frac{\frac{1}{cos}}{sin \cdot x} \cdot \left(\sqrt[3]{\cos \left(2 \cdot x\right)} \cdot \frac{\frac{1}{cos}}{sin \cdot x}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot \left(sin \cdot cos\right)\right) \cdot \left(x \cdot \left(sin \cdot cos\right)\right)}\\

\end{array}
double f(double x, double cos, double sin) {
        double r1917482 = 2.0;
        double r1917483 = x;
        double r1917484 = r1917482 * r1917483;
        double r1917485 = cos(r1917484);
        double r1917486 = cos;
        double r1917487 = pow(r1917486, r1917482);
        double r1917488 = sin;
        double r1917489 = pow(r1917488, r1917482);
        double r1917490 = r1917483 * r1917489;
        double r1917491 = r1917490 * r1917483;
        double r1917492 = r1917487 * r1917491;
        double r1917493 = r1917485 / r1917492;
        return r1917493;
}

double f(double x, double cos, double sin) {
        double r1917494 = 2.0;
        double r1917495 = x;
        double r1917496 = r1917494 * r1917495;
        double r1917497 = cos(r1917496);
        double r1917498 = sin;
        double r1917499 = pow(r1917498, r1917494);
        double r1917500 = r1917495 * r1917499;
        double r1917501 = r1917500 * r1917495;
        double r1917502 = cos;
        double r1917503 = pow(r1917502, r1917494);
        double r1917504 = r1917501 * r1917503;
        double r1917505 = r1917497 / r1917504;
        double r1917506 = -0.0;
        bool r1917507 = r1917505 <= r1917506;
        double r1917508 = cbrt(r1917497);
        double r1917509 = r1917508 * r1917508;
        double r1917510 = 1.0;
        double r1917511 = r1917510 / r1917502;
        double r1917512 = r1917498 * r1917495;
        double r1917513 = r1917511 / r1917512;
        double r1917514 = r1917508 * r1917513;
        double r1917515 = r1917513 * r1917514;
        double r1917516 = r1917509 * r1917515;
        double r1917517 = r1917498 * r1917502;
        double r1917518 = r1917495 * r1917517;
        double r1917519 = r1917518 * r1917518;
        double r1917520 = r1917497 / r1917519;
        double r1917521 = r1917507 ? r1917516 : r1917520;
        return r1917521;
}

Error

Bits error versus x

Bits error versus cos

Bits error versus sin

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (/ (cos (* 2 x)) (* (pow cos 2) (* (* x (pow sin 2)) x))) < -0.0

    1. Initial program 17.0

      \[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
    2. Simplified1.7

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}}\]
    3. Using strategy rm
    4. Applied div-inv1.7

      \[\leadsto \color{blue}{\cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}}\]
    5. Using strategy rm
    6. Applied pow11.7

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot \color{blue}{{cos}^{1}}\right)\right)}\]
    7. Applied pow11.7

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(\color{blue}{{x}^{1}} \cdot {cos}^{1}\right)\right)}\]
    8. Applied pow-prod-down1.7

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \color{blue}{{\left(x \cdot cos\right)}^{1}}\right)}\]
    9. Applied pow11.7

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(\color{blue}{{sin}^{1}} \cdot {\left(x \cdot cos\right)}^{1}\right)}\]
    10. Applied pow-prod-down1.7

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \color{blue}{{\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}}}\]
    11. Applied pow11.7

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot \color{blue}{{cos}^{1}}\right)\right) \cdot {\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}}\]
    12. Applied pow11.7

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(\color{blue}{{x}^{1}} \cdot {cos}^{1}\right)\right) \cdot {\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}}\]
    13. Applied pow-prod-down1.7

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \color{blue}{{\left(x \cdot cos\right)}^{1}}\right) \cdot {\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}}\]
    14. Applied pow11.7

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(\color{blue}{{sin}^{1}} \cdot {\left(x \cdot cos\right)}^{1}\right) \cdot {\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}}\]
    15. Applied pow-prod-down1.7

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\color{blue}{{\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}} \cdot {\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}}\]
    16. Applied pow-prod-up1.7

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\color{blue}{{\left(sin \cdot \left(x \cdot cos\right)\right)}^{\left(1 + 1\right)}}}\]
    17. Applied pow-flip1.4

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \color{blue}{{\left(sin \cdot \left(x \cdot cos\right)\right)}^{\left(-\left(1 + 1\right)\right)}}\]
    18. Simplified1.4

      \[\leadsto \cos \left(2 \cdot x\right) \cdot {\left(sin \cdot \left(x \cdot cos\right)\right)}^{\color{blue}{-2}}\]
    19. Taylor expanded around inf 2.6

      \[\leadsto \cos \left(2 \cdot x\right) \cdot {\color{blue}{\left(x \cdot \left(cos \cdot sin\right)\right)}}^{-2}\]
    20. Using strategy rm
    21. Applied add-cube-cbrt2.7

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{\cos \left(2 \cdot x\right)} \cdot \sqrt[3]{\cos \left(2 \cdot x\right)}\right) \cdot \sqrt[3]{\cos \left(2 \cdot x\right)}\right)} \cdot {\left(x \cdot \left(cos \cdot sin\right)\right)}^{-2}\]
    22. Applied associate-*l*2.7

      \[\leadsto \color{blue}{\left(\sqrt[3]{\cos \left(2 \cdot x\right)} \cdot \sqrt[3]{\cos \left(2 \cdot x\right)}\right) \cdot \left(\sqrt[3]{\cos \left(2 \cdot x\right)} \cdot {\left(x \cdot \left(cos \cdot sin\right)\right)}^{-2}\right)}\]
    23. Simplified0.4

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

    if -0.0 < (/ (cos (* 2 x)) (* (pow cos 2) (* (* x (pow sin 2)) x)))

    1. Initial program 45.2

      \[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
    2. Simplified4.6

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}}\]
    3. Using strategy rm
    4. Applied div-inv4.6

      \[\leadsto \color{blue}{\cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}}\]
    5. Using strategy rm
    6. Applied pow14.6

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot \color{blue}{{cos}^{1}}\right)\right)}\]
    7. Applied pow14.6

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(\color{blue}{{x}^{1}} \cdot {cos}^{1}\right)\right)}\]
    8. Applied pow-prod-down4.6

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \color{blue}{{\left(x \cdot cos\right)}^{1}}\right)}\]
    9. Applied pow14.6

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(\color{blue}{{sin}^{1}} \cdot {\left(x \cdot cos\right)}^{1}\right)}\]
    10. Applied pow-prod-down4.6

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \color{blue}{{\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}}}\]
    11. Applied pow14.6

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(x \cdot \color{blue}{{cos}^{1}}\right)\right) \cdot {\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}}\]
    12. Applied pow14.6

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \left(\color{blue}{{x}^{1}} \cdot {cos}^{1}\right)\right) \cdot {\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}}\]
    13. Applied pow-prod-down4.6

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(sin \cdot \color{blue}{{\left(x \cdot cos\right)}^{1}}\right) \cdot {\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}}\]
    14. Applied pow14.6

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\left(\color{blue}{{sin}^{1}} \cdot {\left(x \cdot cos\right)}^{1}\right) \cdot {\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}}\]
    15. Applied pow-prod-down4.6

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\color{blue}{{\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}} \cdot {\left(sin \cdot \left(x \cdot cos\right)\right)}^{1}}\]
    16. Applied pow-prod-up4.6

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \frac{1}{\color{blue}{{\left(sin \cdot \left(x \cdot cos\right)\right)}^{\left(1 + 1\right)}}}\]
    17. Applied pow-flip4.5

      \[\leadsto \cos \left(2 \cdot x\right) \cdot \color{blue}{{\left(sin \cdot \left(x \cdot cos\right)\right)}^{\left(-\left(1 + 1\right)\right)}}\]
    18. Simplified4.5

      \[\leadsto \cos \left(2 \cdot x\right) \cdot {\left(sin \cdot \left(x \cdot cos\right)\right)}^{\color{blue}{-2}}\]
    19. Taylor expanded around inf 3.0

      \[\leadsto \cos \left(2 \cdot x\right) \cdot {\color{blue}{\left(x \cdot \left(cos \cdot sin\right)\right)}}^{-2}\]
    20. Taylor expanded around inf 48.4

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left({x}^{2} \cdot {sin}^{2}\right)}}\]
    21. Simplified3.2

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot \left(cos \cdot sin\right)\right) \cdot \left(x \cdot \left(cos \cdot sin\right)\right)}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot {sin}^{2}\right) \cdot x\right) \cdot {cos}^{2}} \le -0.0:\\ \;\;\;\;\left(\sqrt[3]{\cos \left(2 \cdot x\right)} \cdot \sqrt[3]{\cos \left(2 \cdot x\right)}\right) \cdot \left(\frac{\frac{1}{cos}}{sin \cdot x} \cdot \left(\sqrt[3]{\cos \left(2 \cdot x\right)} \cdot \frac{\frac{1}{cos}}{sin \cdot x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot \left(sin \cdot cos\right)\right) \cdot \left(x \cdot \left(sin \cdot cos\right)\right)}\\ \end{array}\]

Reproduce

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