| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 14016 |
\[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\left(-y\right) + -0.5 \cdot {y}^{2}\right)\right) - t
\]
(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))
(*
(- z 1.0)
(+ (- y) (+ (* -0.5 (pow y 2.0)) (* -0.3333333333333333 (pow y 3.0))))))
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)) + ((z - 1.0) * (-y + ((-0.5 * pow(y, 2.0)) + (-0.3333333333333333 * pow(y, 3.0)))))) - 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)) + ((z - 1.0d0) * (-y + (((-0.5d0) * (y ** 2.0d0)) + ((-0.3333333333333333d0) * (y ** 3.0d0)))))) - 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)) + ((z - 1.0) * (-y + ((-0.5 * Math.pow(y, 2.0)) + (-0.3333333333333333 * Math.pow(y, 3.0)))))) - 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)) + ((z - 1.0) * (-y + ((-0.5 * math.pow(y, 2.0)) + (-0.3333333333333333 * math.pow(y, 3.0)))))) - 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(z - 1.0) * Float64(Float64(-y) + Float64(Float64(-0.5 * (y ^ 2.0)) + Float64(-0.3333333333333333 * (y ^ 3.0)))))) - 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)) + ((z - 1.0) * (-y + ((-0.5 * (y ^ 2.0)) + (-0.3333333333333333 * (y ^ 3.0)))))) - 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[(z - 1.0), $MachinePrecision] * N[((-y) + N[(N[(-0.5 * N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-0.3333333333333333 * N[Power[y, 3.0], $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(z - 1\right) \cdot \left(\left(-y\right) + \left(-0.5 \cdot {y}^{2} + -0.3333333333333333 \cdot {y}^{3}\right)\right)\right) - t
Results
Initial program 6.7
Taylor expanded in y around 0 0.3
Simplified0.3
[Start]0.3 | \[ \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(-0.5 \cdot {y}^{2} + \left(-0.3333333333333333 \cdot {y}^{3} + -1 \cdot y\right)\right)\right) - t
\] |
|---|---|
rational.json-simplify-41 [<=]0.3 | \[ \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\left(-1 \cdot y + \left(-0.5 \cdot {y}^{2} + -0.3333333333333333 \cdot {y}^{3}\right)\right)}\right) - t
\] |
rational.json-simplify-2 [=>]0.3 | \[ \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\color{blue}{y \cdot -1} + \left(-0.5 \cdot {y}^{2} + -0.3333333333333333 \cdot {y}^{3}\right)\right)\right) - t
\] |
rational.json-simplify-9 [=>]0.3 | \[ \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\color{blue}{\left(-y\right)} + \left(-0.5 \cdot {y}^{2} + -0.3333333333333333 \cdot {y}^{3}\right)\right)\right) - t
\] |
Final simplification0.3
| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 14016 |
| Alternative 2 | |
|---|---|
| Error | 2.6 |
| Cost | 7560 |
| Alternative 3 | |
|---|---|
| Error | 27.8 |
| Cost | 7384 |
| Alternative 4 | |
|---|---|
| Error | 0.5 |
| Cost | 7232 |
| Alternative 5 | |
|---|---|
| Error | 7.9 |
| Cost | 6984 |
| Alternative 6 | |
|---|---|
| Error | 7.3 |
| Cost | 6976 |
| Alternative 7 | |
|---|---|
| Error | 15.3 |
| Cost | 6920 |
| Alternative 8 | |
|---|---|
| Error | 7.4 |
| Cost | 6848 |
| Alternative 9 | |
|---|---|
| Error | 30.1 |
| Cost | 6792 |
| Alternative 10 | |
|---|---|
| Error | 36.2 |
| Cost | 584 |
| Alternative 11 | |
|---|---|
| Error | 36.4 |
| Cost | 520 |
| Alternative 12 | |
|---|---|
| Error | 40.6 |
| Cost | 128 |
herbie shell --seed 2023077
(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))