| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 20416 |
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\left(-z\right) + -0.5 \cdot {z}^{2}\right) - b\right)}
\]
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (- (* a (+ b z))) (+ (* (pow z 2.0) (* -0.5 a)) (* (- (log z) t) y))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
double code(double x, double y, double z, double t, double a, double b) {
return x * exp((-(a * (b + z)) + ((pow(z, 2.0) * (-0.5 * a)) + ((log(z) - t) * 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)) + (a * (log((1.0d0 - z)) - b))))
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((-(a * (b + z)) + (((z ** 2.0d0) * ((-0.5d0) * a)) + ((log(z) - t) * 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)) + (a * (Math.log((1.0 - z)) - b))));
}
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp((-(a * (b + z)) + ((Math.pow(z, 2.0) * (-0.5 * a)) + ((Math.log(z) - t) * y))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
def code(x, y, z, t, a, b): return x * math.exp((-(a * (b + z)) + ((math.pow(z, 2.0) * (-0.5 * a)) + ((math.log(z) - t) * y))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(-Float64(a * Float64(b + z))) + Float64(Float64((z ^ 2.0) * Float64(-0.5 * a)) + Float64(Float64(log(z) - t) * y))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
function tmp = code(x, y, z, t, a, b) tmp = x * exp((-(a * (b + z)) + (((z ^ 2.0) * (-0.5 * a)) + ((log(z) - t) * y)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[((-N[(a * N[(b + z), $MachinePrecision]), $MachinePrecision]) + N[(N[(N[Power[z, 2.0], $MachinePrecision] * N[(-0.5 * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
x \cdot e^{\left(-a \cdot \left(b + z\right)\right) + \left({z}^{2} \cdot \left(-0.5 \cdot a\right) + \left(\log z - t\right) \cdot y\right)}
Results
Initial program 1.9
Taylor expanded in z around 0 0.4
Simplified0.4
[Start]0.4 | \[ x \cdot e^{-0.5 \cdot \left(a \cdot {z}^{2}\right) + \left(-1 \cdot \left(a \cdot z\right) + \left(y \cdot \left(\log z - t\right) + -1 \cdot \left(a \cdot b\right)\right)\right)}
\] |
|---|---|
rational.json-simplify-41 [=>]0.4 | \[ x \cdot e^{-0.5 \cdot \left(a \cdot {z}^{2}\right) + \color{blue}{\left(y \cdot \left(\log z - t\right) + \left(-1 \cdot \left(a \cdot b\right) + -1 \cdot \left(a \cdot z\right)\right)\right)}}
\] |
rational.json-simplify-41 [=>]0.4 | \[ x \cdot e^{\color{blue}{y \cdot \left(\log z - t\right) + \left(\left(-1 \cdot \left(a \cdot b\right) + -1 \cdot \left(a \cdot z\right)\right) + -0.5 \cdot \left(a \cdot {z}^{2}\right)\right)}}
\] |
rational.json-simplify-41 [=>]0.4 | \[ x \cdot e^{\color{blue}{\left(-1 \cdot \left(a \cdot b\right) + -1 \cdot \left(a \cdot z\right)\right) + \left(-0.5 \cdot \left(a \cdot {z}^{2}\right) + y \cdot \left(\log z - t\right)\right)}}
\] |
rational.json-simplify-2 [=>]0.4 | \[ x \cdot e^{\left(-1 \cdot \left(a \cdot b\right) + \color{blue}{\left(a \cdot z\right) \cdot -1}\right) + \left(-0.5 \cdot \left(a \cdot {z}^{2}\right) + y \cdot \left(\log z - t\right)\right)}
\] |
rational.json-simplify-47 [=>]0.4 | \[ x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z + a \cdot b\right)} + \left(-0.5 \cdot \left(a \cdot {z}^{2}\right) + y \cdot \left(\log z - t\right)\right)}
\] |
rational.json-simplify-2 [=>]0.4 | \[ x \cdot e^{\color{blue}{\left(a \cdot z + a \cdot b\right) \cdot -1} + \left(-0.5 \cdot \left(a \cdot {z}^{2}\right) + y \cdot \left(\log z - t\right)\right)}
\] |
rational.json-simplify-9 [=>]0.4 | \[ x \cdot e^{\color{blue}{\left(-\left(a \cdot z + a \cdot b\right)\right)} + \left(-0.5 \cdot \left(a \cdot {z}^{2}\right) + y \cdot \left(\log z - t\right)\right)}
\] |
rational.json-simplify-2 [=>]0.4 | \[ x \cdot e^{\left(-\left(a \cdot z + \color{blue}{b \cdot a}\right)\right) + \left(-0.5 \cdot \left(a \cdot {z}^{2}\right) + y \cdot \left(\log z - t\right)\right)}
\] |
rational.json-simplify-47 [=>]0.4 | \[ x \cdot e^{\left(-\color{blue}{a \cdot \left(b + z\right)}\right) + \left(-0.5 \cdot \left(a \cdot {z}^{2}\right) + y \cdot \left(\log z - t\right)\right)}
\] |
rational.json-simplify-43 [=>]0.4 | \[ x \cdot e^{\left(-a \cdot \left(b + z\right)\right) + \left(\color{blue}{a \cdot \left({z}^{2} \cdot -0.5\right)} + y \cdot \left(\log z - t\right)\right)}
\] |
rational.json-simplify-43 [=>]0.4 | \[ x \cdot e^{\left(-a \cdot \left(b + z\right)\right) + \left(\color{blue}{{z}^{2} \cdot \left(-0.5 \cdot a\right)} + y \cdot \left(\log z - t\right)\right)}
\] |
rational.json-simplify-2 [<=]0.4 | \[ x \cdot e^{\left(-a \cdot \left(b + z\right)\right) + \left({z}^{2} \cdot \left(-0.5 \cdot a\right) + \color{blue}{\left(\log z - t\right) \cdot y}\right)}
\] |
Final simplification0.4
| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 20416 |
| Alternative 2 | |
|---|---|
| Error | 0.4 |
| Cost | 13696 |
| Alternative 3 | |
|---|---|
| Error | 6.6 |
| Cost | 7176 |
| Alternative 4 | |
|---|---|
| Error | 24.5 |
| Cost | 7052 |
| Alternative 5 | |
|---|---|
| Error | 8.1 |
| Cost | 7048 |
| Alternative 6 | |
|---|---|
| Error | 10.7 |
| Cost | 6916 |
| Alternative 7 | |
|---|---|
| Error | 33.4 |
| Cost | 1164 |
| Alternative 8 | |
|---|---|
| Error | 34.8 |
| Cost | 1032 |
| Alternative 9 | |
|---|---|
| Error | 39.3 |
| Cost | 840 |
| Alternative 10 | |
|---|---|
| Error | 39.4 |
| Cost | 712 |
| Alternative 11 | |
|---|---|
| Error | 39.2 |
| Cost | 648 |
| Alternative 12 | |
|---|---|
| Error | 40.1 |
| Cost | 516 |
| Alternative 13 | |
|---|---|
| Error | 43.6 |
| Cost | 64 |
herbie shell --seed 2023077
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B"
:precision binary64
(* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))