| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 27456 |
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
(FPCore (x y z t)
:precision binary64
(-
(+
(* (- x 1.0) (log y))
(+
(* -0.3333333333333333 (* (pow y 3.0) (+ -1.0 z)))
(+
(* (- y) (+ -1.0 z))
(+
(* -0.5 (* (pow y 2.0) (+ -1.0 z)))
(* -0.25 (* (pow y 4.0) (+ -1.0 z)))))))
t))double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((-0.3333333333333333 * (pow(y, 3.0) * (-1.0 + z))) + ((-y * (-1.0 + z)) + ((-0.5 * (pow(y, 2.0) * (-1.0 + z))) + (-0.25 * (pow(y, 4.0) * (-1.0 + z))))))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + (((-0.3333333333333333d0) * ((y ** 3.0d0) * ((-1.0d0) + z))) + ((-y * ((-1.0d0) + z)) + (((-0.5d0) * ((y ** 2.0d0) * ((-1.0d0) + z))) + ((-0.25d0) * ((y ** 4.0d0) * ((-1.0d0) + z))))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((-0.3333333333333333 * (Math.pow(y, 3.0) * (-1.0 + z))) + ((-y * (-1.0 + z)) + ((-0.5 * (Math.pow(y, 2.0) * (-1.0 + z))) + (-0.25 * (Math.pow(y, 4.0) * (-1.0 + z))))))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((-0.3333333333333333 * (math.pow(y, 3.0) * (-1.0 + z))) + ((-y * (-1.0 + z)) + ((-0.5 * (math.pow(y, 2.0) * (-1.0 + z))) + (-0.25 * (math.pow(y, 4.0) * (-1.0 + z))))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(-0.3333333333333333 * Float64((y ^ 3.0) * Float64(-1.0 + z))) + Float64(Float64(Float64(-y) * Float64(-1.0 + z)) + Float64(Float64(-0.5 * Float64((y ^ 2.0) * Float64(-1.0 + z))) + Float64(-0.25 * Float64((y ^ 4.0) * Float64(-1.0 + z))))))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((-0.3333333333333333 * ((y ^ 3.0) * (-1.0 + z))) + ((-y * (-1.0 + z)) + ((-0.5 * ((y ^ 2.0) * (-1.0 + z))) + (-0.25 * ((y ^ 4.0) * (-1.0 + z))))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.3333333333333333 * N[(N[Power[y, 3.0], $MachinePrecision] * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[((-y) * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * N[(N[Power[y, 2.0], $MachinePrecision] * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.25 * N[(N[Power[y, 4.0], $MachinePrecision] * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left({y}^{3} \cdot \left(-1 + z\right)\right) + \left(\left(-y\right) \cdot \left(-1 + z\right) + \left(-0.5 \cdot \left({y}^{2} \cdot \left(-1 + z\right)\right) + -0.25 \cdot \left({y}^{4} \cdot \left(-1 + z\right)\right)\right)\right)\right)\right) - t
Results
Initial program 6.6
Taylor expanded in y around 0 0.2
Simplified0.2
[Start]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + \left(-0.3333333333333333 \cdot \left(\left(z - 1\right) \cdot {y}^{3}\right) + \left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
|---|---|
rational_best_oopsla_all_46_json_45_simplify-82 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-0.3333333333333333 \cdot \left(\left(z - 1\right) \cdot {y}^{3}\right) + \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + \left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)}\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-45 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left(\color{blue}{\left(z + -1\right)} \cdot {y}^{3}\right) + \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + \left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \color{blue}{\left({y}^{3} \cdot \left(z + -1\right)\right)} + \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + \left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left({y}^{3} \cdot \color{blue}{\left(-1 + z\right)}\right) + \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + \left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-82 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left({y}^{3} \cdot \left(-1 + z\right)\right) + \color{blue}{\left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)}\right)\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-7 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left({y}^{3} \cdot \left(-1 + z\right)\right) + \left(\color{blue}{\left(z - 1\right) \cdot \left(-1 \cdot y\right)} + \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-45 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left({y}^{3} \cdot \left(-1 + z\right)\right) + \left(\color{blue}{\left(z + -1\right)} \cdot \left(-1 \cdot y\right) + \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left({y}^{3} \cdot \left(-1 + z\right)\right) + \left(\color{blue}{\left(-1 \cdot y\right) \cdot \left(z + -1\right)} + \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left({y}^{3} \cdot \left(-1 + z\right)\right) + \left(\color{blue}{\left(y \cdot -1\right)} \cdot \left(z + -1\right) + \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-92 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left({y}^{3} \cdot \left(-1 + z\right)\right) + \left(\color{blue}{\left(-y\right)} \cdot \left(z + -1\right) + \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left({y}^{3} \cdot \left(-1 + z\right)\right) + \left(\left(-y\right) \cdot \color{blue}{\left(-1 + z\right)} + \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-45 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left({y}^{3} \cdot \left(-1 + z\right)\right) + \left(\left(-y\right) \cdot \left(-1 + z\right) + \left(-0.5 \cdot \left(\color{blue}{\left(z + -1\right)} \cdot {y}^{2}\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left({y}^{3} \cdot \left(-1 + z\right)\right) + \left(\left(-y\right) \cdot \left(-1 + z\right) + \left(-0.5 \cdot \color{blue}{\left({y}^{2} \cdot \left(z + -1\right)\right)} + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]0.2 | \[ \left(\left(x - 1\right) \cdot \log y + \left(-0.3333333333333333 \cdot \left({y}^{3} \cdot \left(-1 + z\right)\right) + \left(\left(-y\right) \cdot \left(-1 + z\right) + \left(-0.5 \cdot \left({y}^{2} \cdot \color{blue}{\left(-1 + z\right)}\right) + -0.25 \cdot \left(\left(z - 1\right) \cdot {y}^{4}\right)\right)\right)\right)\right) - t
\] |
Final simplification0.2
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 27456 |
| Alternative 2 | |
|---|---|
| Error | 0.2 |
| Cost | 20736 |
| Alternative 3 | |
|---|---|
| Error | 0.4 |
| Cost | 20544 |
| Alternative 4 | |
|---|---|
| Error | 0.3 |
| Cost | 14016 |
| Alternative 5 | |
|---|---|
| Error | 1.2 |
| Cost | 7624 |
| Alternative 6 | |
|---|---|
| Error | 3.0 |
| Cost | 7496 |
| Alternative 7 | |
|---|---|
| Error | 0.6 |
| Cost | 7424 |
| Alternative 8 | |
|---|---|
| Error | 0.5 |
| Cost | 7296 |
| Alternative 9 | |
|---|---|
| Error | 7.9 |
| Cost | 7048 |
| Alternative 10 | |
|---|---|
| Error | 7.9 |
| Cost | 6984 |
| Alternative 11 | |
|---|---|
| Error | 9.0 |
| Cost | 6980 |
| Alternative 12 | |
|---|---|
| Error | 15.3 |
| Cost | 6920 |
| Alternative 13 | |
|---|---|
| Error | 21.3 |
| Cost | 6856 |
| Alternative 14 | |
|---|---|
| Error | 37.1 |
| Cost | 520 |
| Alternative 15 | |
|---|---|
| Error | 34.7 |
| Cost | 448 |
| Alternative 16 | |
|---|---|
| Error | 34.8 |
| Cost | 384 |
| Alternative 17 | |
|---|---|
| Error | 41.1 |
| Cost | 128 |
| Alternative 18 | |
|---|---|
| Error | 62.2 |
| Cost | 64 |
herbie shell --seed 2023090
(FPCore (x y z t)
:name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"
:precision binary64
(- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))