?

Average Accuracy: 60.8% → 98.3%
Time: 18.0s
Precision: binary32
Cost: 3680

?

\[\left(\left(\left(\left(0.0001 \leq alphax \land alphax \leq 1\right) \land \left(0.0001 \leq alphay \land alphay \leq 1\right)\right) \land \left(2.328306437 \cdot 10^{-10} \leq u0 \land u0 \leq 1\right)\right) \land \left(0 \leq cos2phi \land cos2phi \leq 1\right)\right) \land 0 \leq sin2phi\]
\[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
\[\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}} \]
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (/
  (- (log (- 1.0 u0)))
  (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))
(FPCore (alphax alphay u0 cos2phi sin2phi)
 :precision binary32
 (/
  (- (log1p (- u0)))
  (+ (/ cos2phi (* alphax alphax)) (/ (/ sin2phi alphay) alphay))))
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return -logf((1.0f - u0)) / ((cos2phi / (alphax * alphax)) + (sin2phi / (alphay * alphay)));
}
float code(float alphax, float alphay, float u0, float cos2phi, float sin2phi) {
	return -log1pf(-u0) / ((cos2phi / (alphax * alphax)) + ((sin2phi / alphay) / alphay));
}
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(Float32(-log(Float32(Float32(1.0) - u0))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(sin2phi / Float32(alphay * alphay))))
end
function code(alphax, alphay, u0, cos2phi, sin2phi)
	return Float32(Float32(-log1p(Float32(-u0))) / Float32(Float32(cos2phi / Float32(alphax * alphax)) + Float32(Float32(sin2phi / alphay) / alphay)))
end
\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}
\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 60.8%

    \[\frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  2. Simplified98.3%

    \[\leadsto \color{blue}{\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}} \]
    Proof

    [Start]60.8

    \[ \frac{-\log \left(1 - u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]

    sub-neg [=>]60.8

    \[ \frac{-\log \color{blue}{\left(1 + \left(-u0\right)\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]

    log1p-def [=>]98.3

    \[ \frac{-\color{blue}{\mathsf{log1p}\left(-u0\right)}}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
  3. Applied egg-rr98.2%

    \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{1}{alphay \cdot \left(-alphay\right)} \cdot \left(-sin2phi\right)}} \]
    Proof

    [Start]98.3

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]

    frac-2neg [=>]98.3

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{-sin2phi}{-alphay \cdot alphay}}} \]

    clear-num [=>]98.2

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{1}{\frac{-alphay \cdot alphay}{-sin2phi}}}} \]

    associate-/r/ [=>]98.2

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{1}{-alphay \cdot alphay} \cdot \left(-sin2phi\right)}} \]

    distribute-rgt-neg-in [=>]98.2

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{1}{\color{blue}{alphay \cdot \left(-alphay\right)}} \cdot \left(-sin2phi\right)} \]
  4. Applied egg-rr98.3%

    \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{sin2phi}{alphay}}{alphay}}} \]
    Proof

    [Start]98.2

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{1}{alphay \cdot \left(-alphay\right)} \cdot \left(-sin2phi\right)} \]

    associate-*l/ [=>]98.3

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{1 \cdot \left(-sin2phi\right)}{alphay \cdot \left(-alphay\right)}}} \]

    *-un-lft-identity [<=]98.3

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\color{blue}{-sin2phi}}{alphay \cdot \left(-alphay\right)}} \]

    associate-/r* [=>]98.3

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \color{blue}{\frac{\frac{-sin2phi}{alphay}}{-alphay}}} \]

    add-sqr-sqrt [=>]-0.0

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{\color{blue}{\sqrt{-sin2phi} \cdot \sqrt{-sin2phi}}}{alphay}}{-alphay}} \]

    sqrt-unprod [=>]35.4

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{\color{blue}{\sqrt{\left(-sin2phi\right) \cdot \left(-sin2phi\right)}}}{alphay}}{-alphay}} \]

    sqr-neg [=>]35.4

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{\sqrt{\color{blue}{sin2phi \cdot sin2phi}}}{alphay}}{-alphay}} \]

    sqrt-unprod [<=]34.0

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{\color{blue}{\sqrt{sin2phi} \cdot \sqrt{sin2phi}}}{alphay}}{-alphay}} \]

    add-sqr-sqrt [<=]34.0

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{\color{blue}{sin2phi}}{alphay}}{-alphay}} \]

    add-sqr-sqrt [=>]-0.0

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{\color{blue}{\sqrt{-alphay} \cdot \sqrt{-alphay}}}} \]

    sqrt-unprod [=>]98.3

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{\color{blue}{\sqrt{\left(-alphay\right) \cdot \left(-alphay\right)}}}} \]

    sqr-neg [=>]98.3

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{\sqrt{\color{blue}{alphay \cdot alphay}}}} \]

    sqrt-unprod [<=]97.8

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{\color{blue}{\sqrt{alphay} \cdot \sqrt{alphay}}}} \]

    add-sqr-sqrt [<=]98.3

    \[ \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{\color{blue}{alphay}}} \]
  5. Final simplification98.3%

    \[\leadsto \frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{\frac{sin2phi}{alphay}}{alphay}} \]

Alternatives

Alternative 1
Accuracy98.3%
Cost3680
\[\frac{-\mathsf{log1p}\left(-u0\right)}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
Alternative 2
Accuracy92.6%
Cost3556
\[\begin{array}{l} \mathbf{if}\;sin2phi \leq 2.799999952316284:\\ \;\;\;\;\frac{u0 + \left(u0 \cdot u0\right) \cdot 0.5}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot \frac{\mathsf{log1p}\left(-u0\right)}{sin2phi}\right) \cdot \left(-alphay\right)\\ \end{array} \]
Alternative 3
Accuracy83.1%
Cost740
\[\begin{array}{l} t_0 := \frac{sin2phi}{alphay \cdot alphay}\\ \mathbf{if}\;t_0 \leq 6:\\ \;\;\;\;\frac{u0}{t_0 + \frac{cos2phi}{alphax} \cdot \frac{1}{alphax}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(alphay \cdot alphay\right) \cdot \left(u0 + \left(u0 \cdot u0\right) \cdot \left(0.5 - u0 \cdot -0.3333333333333333\right)\right)}{sin2phi}\\ \end{array} \]
Alternative 4
Accuracy81.1%
Cost676
\[\begin{array}{l} t_0 := \frac{sin2phi}{alphay \cdot alphay}\\ \mathbf{if}\;t_0 \leq 500:\\ \;\;\;\;\frac{u0}{t_0 + \frac{cos2phi}{alphax} \cdot \frac{1}{alphax}}\\ \mathbf{else}:\\ \;\;\;\;alphay \cdot \left(alphay \cdot \frac{u0 + \left(u0 \cdot u0\right) \cdot 0.5}{sin2phi}\right)\\ \end{array} \]
Alternative 5
Accuracy81.1%
Cost676
\[\begin{array}{l} t_0 := \frac{sin2phi}{alphay \cdot alphay}\\ \mathbf{if}\;t_0 \leq 500:\\ \;\;\;\;\frac{u0}{t_0 + \frac{cos2phi}{alphax} \cdot \frac{1}{alphax}}\\ \mathbf{else}:\\ \;\;\;\;alphay \cdot \left(alphay \cdot \left(\frac{u0}{sin2phi} + \frac{u0 \cdot u0}{sin2phi} \cdot 0.5\right)\right)\\ \end{array} \]
Alternative 6
Accuracy66.3%
Cost612
\[\begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;\frac{alphax \cdot \left(u0 \cdot alphax\right)}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0}{\frac{1}{\frac{\frac{alphay}{sin2phi}}{alphax}}} \cdot \left(alphax \cdot alphay\right)\\ \end{array} \]
Alternative 7
Accuracy81.1%
Cost612
\[\begin{array}{l} t_0 := \frac{sin2phi}{alphay \cdot alphay}\\ \mathbf{if}\;t_0 \leq 500:\\ \;\;\;\;\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + t_0}\\ \mathbf{else}:\\ \;\;\;\;alphay \cdot \left(alphay \cdot \frac{u0 + \left(u0 \cdot u0\right) \cdot 0.5}{sin2phi}\right)\\ \end{array} \]
Alternative 8
Accuracy87.0%
Cost608
\[\frac{u0 + \left(u0 \cdot u0\right) \cdot 0.5}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
Alternative 9
Accuracy66.4%
Cost420
\[\begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;u0 \cdot \frac{alphax}{\frac{cos2phi}{alphax}}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0}{sin2phi}\\ \end{array} \]
Alternative 10
Accuracy66.4%
Cost420
\[\begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;\frac{alphax \cdot \left(u0 \cdot alphax\right)}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;\left(alphay \cdot alphay\right) \cdot \frac{u0}{sin2phi}\\ \end{array} \]
Alternative 11
Accuracy66.4%
Cost420
\[\begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;\frac{alphax \cdot \left(u0 \cdot alphax\right)}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;alphay \cdot \left(u0 \cdot \frac{alphay}{sin2phi}\right)\\ \end{array} \]
Alternative 12
Accuracy66.4%
Cost420
\[\begin{array}{l} \mathbf{if}\;\frac{sin2phi}{alphay \cdot alphay} \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;\frac{alphax \cdot \left(u0 \cdot alphax\right)}{cos2phi}\\ \mathbf{else}:\\ \;\;\;\;\frac{u0 \cdot \left(alphay \cdot alphay\right)}{sin2phi}\\ \end{array} \]
Alternative 13
Accuracy75.5%
Cost416
\[\frac{u0}{\frac{cos2phi}{alphax \cdot alphax} + \frac{sin2phi}{alphay \cdot alphay}} \]
Alternative 14
Accuracy23.5%
Cost224
\[alphax \cdot \left(u0 \cdot \frac{alphax}{cos2phi}\right) \]
Alternative 15
Accuracy23.5%
Cost224
\[u0 \cdot \left(alphax \cdot \frac{alphax}{cos2phi}\right) \]
Alternative 16
Accuracy23.5%
Cost224
\[u0 \cdot \frac{alphax}{\frac{cos2phi}{alphax}} \]

Error

Reproduce?

herbie shell --seed 2023138 
(FPCore (alphax alphay u0 cos2phi sin2phi)
  :name "Beckmann Distribution sample, tan2theta, alphax != alphay, u1 <= 0.5"
  :precision binary32
  :pre (and (and (and (and (and (<= 0.0001 alphax) (<= alphax 1.0)) (and (<= 0.0001 alphay) (<= alphay 1.0))) (and (<= 2.328306437e-10 u0) (<= u0 1.0))) (and (<= 0.0 cos2phi) (<= cos2phi 1.0))) (<= 0.0 sin2phi))
  (/ (- (log (- 1.0 u0))) (+ (/ cos2phi (* alphax alphax)) (/ sin2phi (* alphay alphay)))))