\[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\]
Test:
math.cube on complex, real part
Bits:
128 bits
Bits error versus x.re
Bits error versus x.im
Time: 9.5 s
Input Error: 7.0
Output Error: 0.3
Log:
Profile: 🕒
\({x.re}^2 \cdot x.re + x.im \cdot \left(x.re \cdot \left(\left(-x.im\right) - \left(x.im + x.im\right)\right)\right)\)
  1. Started with
    \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\]
    7.0
  2. Applied simplify to get
    \[\color{red}{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im} \leadsto \color{blue}{x.re \cdot \left({x.re}^2 - x.im \cdot x.im\right) - \left(x.im \cdot x.im\right) \cdot \left(x.re + x.re\right)}\]
    7.0
  3. Using strategy rm
    7.0
  4. Applied sub-neg to get
    \[x.re \cdot \color{red}{\left({x.re}^2 - x.im \cdot x.im\right)} - \left(x.im \cdot x.im\right) \cdot \left(x.re + x.re\right) \leadsto x.re \cdot \color{blue}{\left({x.re}^2 + \left(-x.im \cdot x.im\right)\right)} - \left(x.im \cdot x.im\right) \cdot \left(x.re + x.re\right)\]
    7.0
  5. Applied distribute-rgt-in to get
    \[\color{red}{x.re \cdot \left({x.re}^2 + \left(-x.im \cdot x.im\right)\right)} - \left(x.im \cdot x.im\right) \cdot \left(x.re + x.re\right) \leadsto \color{blue}{\left({x.re}^2 \cdot x.re + \left(-x.im \cdot x.im\right) \cdot x.re\right)} - \left(x.im \cdot x.im\right) \cdot \left(x.re + x.re\right)\]
    7.0
  6. Applied associate--l+ to get
    \[\color{red}{\left({x.re}^2 \cdot x.re + \left(-x.im \cdot x.im\right) \cdot x.re\right) - \left(x.im \cdot x.im\right) \cdot \left(x.re + x.re\right)} \leadsto \color{blue}{{x.re}^2 \cdot x.re + \left(\left(-x.im \cdot x.im\right) \cdot x.re - \left(x.im \cdot x.im\right) \cdot \left(x.re + x.re\right)\right)}\]
    7.0
  7. Applied simplify to get
    \[{x.re}^2 \cdot x.re + \color{red}{\left(\left(-x.im \cdot x.im\right) \cdot x.re - \left(x.im \cdot x.im\right) \cdot \left(x.re + x.re\right)\right)} \leadsto {x.re}^2 \cdot x.re + \color{blue}{\left(x.im \cdot x.re\right) \cdot \left(\left(-x.im\right) - \left(x.im + x.im\right)\right)}\]
    0.2
  8. Using strategy rm
    0.2
  9. Applied associate-*l* to get
    \[{x.re}^2 \cdot x.re + \color{red}{\left(x.im \cdot x.re\right) \cdot \left(\left(-x.im\right) - \left(x.im + x.im\right)\right)} \leadsto {x.re}^2 \cdot x.re + \color{blue}{x.im \cdot \left(x.re \cdot \left(\left(-x.im\right) - \left(x.im + x.im\right)\right)\right)}\]
    0.3

  10. Removed slow pow expressions

Original test:


(lambda ((x.re default) (x.im default))
  #:name "math.cube on complex, real part"
  (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))