\[\frac{1}{x} - \cot x\]
Test:
NMSE example 3.9
Bits:
128 bits
Bits error versus x
Time: 6.0 s
Input Error: 29.4
Output Error: 0.3
Log:
Profile: 🕒
\(x \cdot \frac{1}{3} + \left(\frac{2}{945} \cdot {x}^{5} + {x}^3 \cdot \frac{1}{45}\right)\)
  1. Started with
    \[\frac{1}{x} - \cot x\]
    29.4
  2. Applied taylor to get
    \[\frac{1}{x} - \cot x \leadsto \frac{2}{945} \cdot {x}^{5} + \left(\frac{1}{45} \cdot {x}^{3} + \frac{1}{3} \cdot x\right)\]
    0.3
  3. Taylor expanded around 0 to get
    \[\color{red}{\frac{2}{945} \cdot {x}^{5} + \left(\frac{1}{45} \cdot {x}^{3} + \frac{1}{3} \cdot x\right)} \leadsto \color{blue}{\frac{2}{945} \cdot {x}^{5} + \left(\frac{1}{45} \cdot {x}^{3} + \frac{1}{3} \cdot x\right)}\]
    0.3
  4. Applied simplify to get
    \[\color{red}{\frac{2}{945} \cdot {x}^{5} + \left(\frac{1}{45} \cdot {x}^{3} + \frac{1}{3} \cdot x\right)} \leadsto \color{blue}{x \cdot \frac{1}{3} + \left(\frac{2}{945} \cdot {x}^{5} + {x}^3 \cdot \frac{1}{45}\right)}\]
    0.3

  5. Removed slow pow expressions

Original test:


(lambda ((x default))
  #:name "NMSE example 3.9"
  (- (/ 1 x) (cotan x))
  #:target
  (if (< (fabs x) 0.026) (* (/ x 3) (+ 1 (/ (sqr x) 15))) (- (/ 1 x) (cotan x))))