\[\frac{1 - \cos x}{\sin x}\]
Test:
NMSE example 3.4
Bits:
128 bits
Bits error versus x
Time: 16.0 s
Input Error: 30.7
Output Error: 0.5
Log:
Profile: 🕒
\(\begin{cases} \frac{\frac{{\left(\sin x\right)}^2}{1 + \cos x}}{\sin x} & \text{when } x \le -8.61646249982272 \cdot 10^{-12} \\ x \cdot \frac{1}{2} + \left(\frac{1}{240} \cdot {x}^{5} + {x}^3 \cdot \frac{1}{24}\right) & \text{when } x \le 8.584780819621077 \\ \left(1 - \cos x\right) \cdot \frac{1}{\sin x} & \text{otherwise} \end{cases}\)

    if x < -8.61646249982272e-12

    1. Started with
      \[\frac{1 - \cos x}{\sin x}\]
      2.0
    2. Using strategy rm
      2.0
    3. Applied flip-- to get
      \[\frac{\color{red}{1 - \cos x}}{\sin x} \leadsto \frac{\color{blue}{\frac{{1}^2 - {\left(\cos x\right)}^2}{1 + \cos x}}}{\sin x}\]
      2.4
    4. Applied simplify to get
      \[\frac{\frac{\color{red}{{1}^2 - {\left(\cos x\right)}^2}}{1 + \cos x}}{\sin x} \leadsto \frac{\frac{\color{blue}{{\left(\sin x\right)}^2}}{1 + \cos x}}{\sin x}\]
      1.0

    if -8.61646249982272e-12 < x < 8.584780819621077

    1. Started with
      \[\frac{1 - \cos x}{\sin x}\]
      60.1
    2. Applied taylor to get
      \[\frac{1 - \cos x}{\sin x} \leadsto \frac{1}{240} \cdot {x}^{5} + \left(\frac{1}{24} \cdot {x}^{3} + \frac{1}{2} \cdot x\right)\]
      0.0
    3. Taylor expanded around 0 to get
      \[\color{red}{\frac{1}{240} \cdot {x}^{5} + \left(\frac{1}{24} \cdot {x}^{3} + \frac{1}{2} \cdot x\right)} \leadsto \color{blue}{\frac{1}{240} \cdot {x}^{5} + \left(\frac{1}{24} \cdot {x}^{3} + \frac{1}{2} \cdot x\right)}\]
      0.0
    4. Applied simplify to get
      \[\color{red}{\frac{1}{240} \cdot {x}^{5} + \left(\frac{1}{24} \cdot {x}^{3} + \frac{1}{2} \cdot x\right)} \leadsto \color{blue}{x \cdot \frac{1}{2} + \left(\frac{1}{240} \cdot {x}^{5} + {x}^3 \cdot \frac{1}{24}\right)}\]
      0.0

    if 8.584780819621077 < x

    1. Started with
      \[\frac{1 - \cos x}{\sin x}\]
      0.9
    2. Using strategy rm
      0.9
    3. Applied div-inv to get
      \[\color{red}{\frac{1 - \cos x}{\sin x}} \leadsto \color{blue}{\left(1 - \cos x\right) \cdot \frac{1}{\sin x}}\]
      0.9

  1. Removed slow pow expressions

Original test:


(lambda ((x default))
  #:name "NMSE example 3.4"
  (/ (- 1 (cos x)) (sin x))
  #:target
  (tan (/ x 2)))