Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A

?

Percentage Accurate: 98.5% → 98.5%
Time: 48.6s
Precision: binary64
Cost: 20160

?

\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t + -1\right) \cdot \log a\right) - b}}{y} \]
(FPCore (x y z t a b)
 :precision binary64
 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))
(FPCore (x y z t a b)
 :precision binary64
 (/ (* x (exp (- (+ (* y (log z)) (* (+ t -1.0) (log a))) b))) y))
double code(double x, double y, double z, double t, double a, double b) {
	return (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
}
double code(double x, double y, double z, double t, double a, double b) {
	return (x * exp((((y * log(z)) + ((t + -1.0) * log(a))) - b))) / y;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (x * exp((((y * log(z)) + ((t - 1.0d0) * log(a))) - b))) / y
end function
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (x * exp((((y * log(z)) + ((t + (-1.0d0)) * log(a))) - b))) / y
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return (x * Math.exp((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b))) / y;
}
public static double code(double x, double y, double z, double t, double a, double b) {
	return (x * Math.exp((((y * Math.log(z)) + ((t + -1.0) * Math.log(a))) - b))) / y;
}
def code(x, y, z, t, a, b):
	return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
def code(x, y, z, t, a, b):
	return (x * math.exp((((y * math.log(z)) + ((t + -1.0) * math.log(a))) - b))) / y
function code(x, y, z, t, a, b)
	return Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y)
end
function code(x, y, z, t, a, b)
	return Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t + -1.0) * log(a))) - b))) / y)
end
function tmp = code(x, y, z, t, a, b)
	tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
end
function tmp = code(x, y, z, t, a, b)
	tmp = (x * exp((((y * log(z)) + ((t + -1.0) * log(a))) - b))) / y;
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t + -1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\frac{x \cdot e^{\left(y \cdot \log z + \left(t + -1\right) \cdot \log a\right) - b}}{y}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 18 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original98.5%
Target71.6%
Herbie98.5%
\[\begin{array}{l} \mathbf{if}\;t < -0.8845848504127471:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \mathbf{elif}\;t < 852031.2288374073:\\ \;\;\;\;\frac{\frac{x}{y} \cdot {a}^{\left(t - 1\right)}}{e^{b - \log z \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \end{array} \]

Derivation?

  1. Initial program 98.4%

    \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
  2. Final simplification98.4%

    \[\leadsto \frac{x \cdot e^{\left(y \cdot \log z + \left(t + -1\right) \cdot \log a\right) - b}}{y} \]

Alternatives

Alternative 1
Accuracy98.5%
Cost20160
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t + -1\right) \cdot \log a\right) - b}}{y} \]
Alternative 2
Accuracy92.2%
Cost33481
\[\begin{array}{l} t_1 := \left(t + -1\right) \cdot \log a\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+23} \lor \neg \left(t_1 \leq 5 \cdot 10^{+108}\right):\\ \;\;\;\;\frac{x \cdot e^{t_1 - b}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z - \log a\right) - b}}{y}\\ \end{array} \]
Alternative 3
Accuracy89.1%
Cost13769
\[\begin{array}{l} \mathbf{if}\;y \leq -1.55 \cdot 10^{+57} \lor \neg \left(y \leq 3.1 \cdot 10^{+148}\right):\\ \;\;\;\;\frac{\frac{x \cdot {z}^{y}}{a}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot e^{\left(t + -1\right) \cdot \log a - b}}{y}\\ \end{array} \]
Alternative 4
Accuracy79.4%
Cost13705
\[\begin{array}{l} \mathbf{if}\;t \leq -2.7 \cdot 10^{+103} \lor \neg \left(t \leq 1.42 \cdot 10^{+65}\right):\\ \;\;\;\;\frac{\frac{x \cdot {a}^{t}}{a}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot {z}^{y}}{y \cdot \left(a \cdot e^{b}\right)}\\ \end{array} \]
Alternative 5
Accuracy79.5%
Cost13704
\[\begin{array}{l} t_1 := \frac{\frac{x \cdot {z}^{y}}{a}}{y}\\ \mathbf{if}\;y \leq -1.3 \cdot 10^{+56}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{-82}:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t + -1\right)}}{e^{b}}}{y}\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+138}:\\ \;\;\;\;\frac{\frac{x \cdot {a}^{t}}{a}}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Accuracy73.1%
Cost7308
\[\begin{array}{l} t_1 := \frac{\frac{x \cdot {z}^{y}}{a}}{y}\\ \mathbf{if}\;y \leq -2.7 \cdot 10^{+54}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-131}:\\ \;\;\;\;\frac{x}{a \cdot \left(y \cdot e^{b}\right)}\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+138}:\\ \;\;\;\;\frac{\frac{x \cdot {a}^{t}}{a}}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Accuracy72.8%
Cost7177
\[\begin{array}{l} \mathbf{if}\;t \leq -3.2 \cdot 10^{+122} \lor \neg \left(t \leq 1.55 \cdot 10^{+65}\right):\\ \;\;\;\;\frac{\frac{x \cdot {a}^{t}}{a}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot \left(y \cdot e^{b}\right)}\\ \end{array} \]
Alternative 8
Accuracy58.3%
Cost6848
\[\frac{x}{a \cdot \left(y \cdot e^{b}\right)} \]
Alternative 9
Accuracy44.2%
Cost1348
\[\begin{array}{l} \mathbf{if}\;b \leq -1.7 \cdot 10^{-58}:\\ \;\;\;\;\frac{\left(\frac{x}{a} - b \cdot \frac{x}{a}\right) + \frac{x \cdot \left(b \cdot b\right)}{a}}{y}\\ \mathbf{elif}\;b \leq 1.95 \cdot 10^{-81}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{b}}{a}}{y}\\ \end{array} \]
Alternative 10
Accuracy39.0%
Cost1028
\[\begin{array}{l} \mathbf{if}\;b \leq -7.8 \cdot 10^{-7}:\\ \;\;\;\;\frac{\frac{x \cdot \left(a \cdot \left(b + -1\right)\right)}{-a \cdot a}}{y}\\ \mathbf{elif}\;b \leq 2.9 \cdot 10^{-81}:\\ \;\;\;\;\frac{x}{y \cdot a} \cdot \left(1 + b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{b}}{a}}{y}\\ \end{array} \]
Alternative 11
Accuracy39.3%
Cost836
\[\begin{array}{l} \mathbf{if}\;b \leq -9.5 \cdot 10^{-59}:\\ \;\;\;\;\frac{x \cdot \left(\frac{1}{a} - \frac{b}{a}\right)}{y}\\ \mathbf{elif}\;b \leq 3.9 \cdot 10^{-82}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{b}}{a}}{y}\\ \end{array} \]
Alternative 12
Accuracy38.3%
Cost712
\[\begin{array}{l} \mathbf{if}\;b \leq -4.1 \cdot 10^{+45}:\\ \;\;\;\;\frac{-b}{a} \cdot \frac{x}{y}\\ \mathbf{elif}\;b \leq 2.8 \cdot 10^{-80}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{b}}{a}}{y}\\ \end{array} \]
Alternative 13
Accuracy39.3%
Cost712
\[\begin{array}{l} \mathbf{if}\;b \leq -3.15 \cdot 10^{+44}:\\ \;\;\;\;-x \cdot \frac{\frac{b}{y}}{a}\\ \mathbf{elif}\;b \leq 2.9 \cdot 10^{-85}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{b}}{a}}{y}\\ \end{array} \]
Alternative 14
Accuracy39.1%
Cost712
\[\begin{array}{l} \mathbf{if}\;b \leq -8.2 \cdot 10^{-8}:\\ \;\;\;\;\frac{\left(-x\right) \cdot \frac{b}{a}}{y}\\ \mathbf{elif}\;b \leq 4.8 \cdot 10^{-81}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{b}}{a}}{y}\\ \end{array} \]
Alternative 15
Accuracy34.8%
Cost580
\[\begin{array}{l} \mathbf{if}\;b \leq 4.8 \cdot 10^{+118}:\\ \;\;\;\;\frac{\frac{x}{a}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot \left(y \cdot b\right)}\\ \end{array} \]
Alternative 16
Accuracy35.0%
Cost580
\[\begin{array}{l} \mathbf{if}\;b \leq 2.9 \cdot 10^{-81}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{a \cdot b}}{y}\\ \end{array} \]
Alternative 17
Accuracy35.1%
Cost580
\[\begin{array}{l} \mathbf{if}\;b \leq 2.85 \cdot 10^{-80}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{b}}{a}}{y}\\ \end{array} \]
Alternative 18
Accuracy30.9%
Cost320
\[\frac{x}{y \cdot a} \]

Reproduce?

herbie shell --seed 2023263 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (if (< t -0.8845848504127471) (/ (* x (/ (pow a (- t 1.0)) y)) (- (+ b 1.0) (* y (log z)))) (if (< t 852031.2288374073) (/ (* (/ x y) (pow a (- t 1.0))) (exp (- b (* (log z) y)))) (/ (* x (/ (pow a (- t 1.0)) y)) (- (+ b 1.0) (* y (log z))))))

  (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))