# ?

Average Error: 23.1 → 0.1
Time: 34.8s
Precision: binary64
Cost: 14400

# ?

$\left(\left(\left(\left(\left(0 \leq na \land na \leq 10000000\right) \land \left(0 \leq nb \land nb \leq 10000000\right)\right) \land \left(0 \leq va \land va \leq 10000000\right)\right) \land \left(0 \leq vb \land vb \leq 10000000\right)\right) \land \left(0 \leq ve \land ve \leq 10000000\right)\right) \land \left(0 \leq p_h0 \land p_h0 \leq 1\right)$
$\log \left(\frac{\left(\left(\left(\left(\left(na + nb\right) - va\right) - vb\right) - ve\right) \cdot \left|va - vb\right|\right) \cdot \left(1 - p_h0\right)}{\left(\left(va + vb\right) + ve\right) \cdot p_h0}\right)$
$\log \left(\frac{\left(\left(na + nb\right) - \left(va + vb\right)\right) - ve}{\frac{va + \left(vb + ve\right)}{\left|va - vb\right|}} \cdot \frac{1 - p_h0}{p_h0}\right)$
(FPCore (na nb va vb ve p_h0)
:precision binary64
(log
(/
(* (* (- (- (- (+ na nb) va) vb) ve) (fabs (- va vb))) (- 1.0 p_h0))
(* (+ (+ va vb) ve) p_h0))))
(FPCore (na nb va vb ve p_h0)
:precision binary64
(log
(*
(/ (- (- (+ na nb) (+ va vb)) ve) (/ (+ va (+ vb ve)) (fabs (- va vb))))
(/ (- 1.0 p_h0) p_h0))))
double code(double na, double nb, double va, double vb, double ve, double p_h0) {
return log((((((((na + nb) - va) - vb) - ve) * fabs((va - vb))) * (1.0 - p_h0)) / (((va + vb) + ve) * p_h0)));
}

double code(double na, double nb, double va, double vb, double ve, double p_h0) {
return log((((((na + nb) - (va + vb)) - ve) / ((va + (vb + ve)) / fabs((va - vb)))) * ((1.0 - p_h0) / p_h0)));
}

real(8) function code(na, nb, va, vb, ve, p_h0)
real(8), intent (in) :: na
real(8), intent (in) :: nb
real(8), intent (in) :: va
real(8), intent (in) :: vb
real(8), intent (in) :: ve
real(8), intent (in) :: p_h0
code = log((((((((na + nb) - va) - vb) - ve) * abs((va - vb))) * (1.0d0 - p_h0)) / (((va + vb) + ve) * p_h0)))
end function

real(8) function code(na, nb, va, vb, ve, p_h0)
real(8), intent (in) :: na
real(8), intent (in) :: nb
real(8), intent (in) :: va
real(8), intent (in) :: vb
real(8), intent (in) :: ve
real(8), intent (in) :: p_h0
code = log((((((na + nb) - (va + vb)) - ve) / ((va + (vb + ve)) / abs((va - vb)))) * ((1.0d0 - p_h0) / p_h0)))
end function

public static double code(double na, double nb, double va, double vb, double ve, double p_h0) {
return Math.log((((((((na + nb) - va) - vb) - ve) * Math.abs((va - vb))) * (1.0 - p_h0)) / (((va + vb) + ve) * p_h0)));
}

public static double code(double na, double nb, double va, double vb, double ve, double p_h0) {
return Math.log((((((na + nb) - (va + vb)) - ve) / ((va + (vb + ve)) / Math.abs((va - vb)))) * ((1.0 - p_h0) / p_h0)));
}

def code(na, nb, va, vb, ve, p_h0):
return math.log((((((((na + nb) - va) - vb) - ve) * math.fabs((va - vb))) * (1.0 - p_h0)) / (((va + vb) + ve) * p_h0)))

def code(na, nb, va, vb, ve, p_h0):
return math.log((((((na + nb) - (va + vb)) - ve) / ((va + (vb + ve)) / math.fabs((va - vb)))) * ((1.0 - p_h0) / p_h0)))

function code(na, nb, va, vb, ve, p_h0)
return log(Float64(Float64(Float64(Float64(Float64(Float64(Float64(na + nb) - va) - vb) - ve) * abs(Float64(va - vb))) * Float64(1.0 - p_h0)) / Float64(Float64(Float64(va + vb) + ve) * p_h0)))
end

function code(na, nb, va, vb, ve, p_h0)
return log(Float64(Float64(Float64(Float64(Float64(na + nb) - Float64(va + vb)) - ve) / Float64(Float64(va + Float64(vb + ve)) / abs(Float64(va - vb)))) * Float64(Float64(1.0 - p_h0) / p_h0)))
end

function tmp = code(na, nb, va, vb, ve, p_h0)
tmp = log((((((((na + nb) - va) - vb) - ve) * abs((va - vb))) * (1.0 - p_h0)) / (((va + vb) + ve) * p_h0)));
end

function tmp = code(na, nb, va, vb, ve, p_h0)
tmp = log((((((na + nb) - (va + vb)) - ve) / ((va + (vb + ve)) / abs((va - vb)))) * ((1.0 - p_h0) / p_h0)));
end

code[na_, nb_, va_, vb_, ve_, p$95$h0_] := N[Log[N[(N[(N[(N[(N[(N[(N[(na + nb), $MachinePrecision] - va),$MachinePrecision] - vb), $MachinePrecision] - ve),$MachinePrecision] * N[Abs[N[(va - vb), $MachinePrecision]],$MachinePrecision]), $MachinePrecision] * N[(1.0 - p$95$h0),$MachinePrecision]), $MachinePrecision] / N[(N[(N[(va + vb),$MachinePrecision] + ve), $MachinePrecision] * p$95$h0),$MachinePrecision]), $MachinePrecision]],$MachinePrecision]

code[na_, nb_, va_, vb_, ve_, p$95$h0_] := N[Log[N[(N[(N[(N[(N[(na + nb), $MachinePrecision] - N[(va + vb),$MachinePrecision]), $MachinePrecision] - ve),$MachinePrecision] / N[(N[(va + N[(vb + ve), $MachinePrecision]),$MachinePrecision] / N[Abs[N[(va - vb), $MachinePrecision]],$MachinePrecision]), $MachinePrecision]),$MachinePrecision] * N[(N[(1.0 - p$95$h0), $MachinePrecision] / p$95$h0),$MachinePrecision]), $MachinePrecision]],$MachinePrecision]

\log \left(\frac{\left(\left(\left(\left(\left(na + nb\right) - va\right) - vb\right) - ve\right) \cdot \left|va - vb\right|\right) \cdot \left(1 - p_h0\right)}{\left(\left(va + vb\right) + ve\right) \cdot p_h0}\right)

\log \left(\frac{\left(\left(na + nb\right) - \left(va + vb\right)\right) - ve}{\frac{va + \left(vb + ve\right)}{\left|va - vb\right|}} \cdot \frac{1 - p_h0}{p_h0}\right)


# Try it out?

Results

 In Out
Enter valid numbers for all inputs

# Derivation?

1. Initial program 23.1

$\log \left(\frac{\left(\left(\left(\left(\left(na + nb\right) - va\right) - vb\right) - ve\right) \cdot \left|va - vb\right|\right) \cdot \left(1 - p_h0\right)}{\left(\left(va + vb\right) + ve\right) \cdot p_h0}\right)$
2. Simplified0.1

$\leadsto \color{blue}{\log \left(\frac{\left(\left(na + nb\right) - \left(va + vb\right)\right) - ve}{\frac{va + \left(vb + ve\right)}{\left|va - vb\right|}} \cdot \frac{1 - p_h0}{p_h0}\right)}$
Proof
[Start]23.1 $\log \left(\frac{\left(\left(\left(\left(\left(na + nb\right) - va\right) - vb\right) - ve\right) \cdot \left|va - vb\right|\right) \cdot \left(1 - p_h0\right)}{\left(\left(va + vb\right) + ve\right) \cdot p_h0}\right)$ $\log \color{blue}{\left(\frac{\left(\left(\left(\left(na + nb\right) - va\right) - vb\right) - ve\right) \cdot \left|va - vb\right|}{\left(va + vb\right) + ve} \cdot \frac{1 - p_h0}{p_h0}\right)}$ $\log \left(\color{blue}{\frac{\left(\left(\left(na + nb\right) - va\right) - vb\right) - ve}{\frac{\left(va + vb\right) + ve}{\left|va - vb\right|}}} \cdot \frac{1 - p_h0}{p_h0}\right)$ $\log \left(\frac{\color{blue}{\left(\left(na + nb\right) - \left(va + vb\right)\right)} - ve}{\frac{\left(va + vb\right) + ve}{\left|va - vb\right|}} \cdot \frac{1 - p_h0}{p_h0}\right)$ $\log \left(\frac{\left(\left(na + nb\right) - \left(va + vb\right)\right) - ve}{\frac{\color{blue}{va + \left(vb + ve\right)}}{\left|va - vb\right|}} \cdot \frac{1 - p_h0}{p_h0}\right)$
3. Final simplification0.1

$\leadsto \log \left(\frac{\left(\left(na + nb\right) - \left(va + vb\right)\right) - ve}{\frac{va + \left(vb + ve\right)}{\left|va - vb\right|}} \cdot \frac{1 - p_h0}{p_h0}\right)$

# Alternatives

Alternative 1
Error24.4
Cost14288
$\begin{array}{l} t_0 := \left|va - vb\right|\\ t_1 := \log \left(t_0 \cdot \left(\frac{nb}{p_h0} \cdot \frac{1 - p_h0}{vb + ve}\right)\right)\\ \mathbf{if}\;ve \leq 2.55 \cdot 10^{-207}:\\ \;\;\;\;\log \left(\left(\frac{1 - p_h0}{\frac{p_h0}{vb}} + \frac{p_h0 + -1}{\frac{p_h0}{\left(-nb\right) - na}}\right) - \frac{va}{\frac{p_h0}{1 - p_h0}}\right)\\ \mathbf{elif}\;ve \leq 2.1 \cdot 10^{-183}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;ve \leq 9.6 \cdot 10^{-139}:\\ \;\;\;\;\log \left(\frac{vb \cdot \left(1 - p_h0\right)}{p_h0} + \left(\frac{\left(1 - p_h0\right) \cdot \left(na + nb\right)}{p_h0} - \frac{va \cdot \left(1 - p_h0\right)}{p_h0}\right)\right)\\ \mathbf{elif}\;ve \leq 3 \cdot 10^{-122}:\\ \;\;\;\;\log \left(\left(1 - p_h0\right) \cdot \left(\frac{t_0}{p_h0} \cdot \frac{nb}{ve}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}$
Alternative 2
Error11.6
Cost14276
$\begin{array}{l} t_0 := \left|va - vb\right|\\ \mathbf{if}\;p_h0 \leq 5 \cdot 10^{-126}:\\ \;\;\;\;\log \left(\frac{t_0}{p_h0} \cdot \frac{\left(na + nb\right) - \left(vb + ve\right)}{vb + ve}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(t_0 \cdot \left(\frac{1 - p_h0}{p_h0} \cdot \left(\frac{na + nb}{va + \left(vb + ve\right)} + -1\right)\right)\right)\\ \end{array}$
Alternative 3
Error19.2
Cost14144
$\log \left(\frac{1 - p_h0}{p_h0} \cdot \frac{\left|va - vb\right|}{\frac{vb + ve}{nb + \left(na - \left(vb + ve\right)\right)}}\right)$
Alternative 4
Error30.2
Cost13888
$\log \left(\left(1 - p_h0\right) \cdot \left(\frac{\left|va - vb\right|}{p_h0} \cdot \frac{nb}{va + \left(vb + ve\right)}\right)\right)$
Alternative 5
Error19.9
Cost13888
$\log \left(\frac{\left|va - vb\right|}{p_h0} \cdot \frac{\left(na + nb\right) - \left(vb + ve\right)}{vb + ve}\right)$
Alternative 6
Error21.4
Cost13764
$\begin{array}{l} \mathbf{if}\;ve \leq 8 \cdot 10^{-139}:\\ \;\;\;\;\log \left(\left(\frac{1 - p_h0}{\frac{p_h0}{vb}} + \frac{p_h0 + -1}{\frac{p_h0}{\left(-nb\right) - na}}\right) - \frac{va}{\frac{p_h0}{1 - p_h0}}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(\left(1 - p_h0\right) \cdot \left(\frac{\left|va - vb\right|}{p_h0} \cdot \frac{nb}{ve}\right)\right)\\ \end{array}$
Alternative 7
Error38.9
Cost13760
$\log \left(\left(1 - p_h0\right) \cdot \left(\frac{\left|va - vb\right|}{p_h0} \cdot \frac{nb}{vb + ve}\right)\right)$
Alternative 8
Error21.4
Cost8064
$\log \left(\left(\frac{1 - p_h0}{\frac{p_h0}{vb}} + \frac{p_h0 + -1}{\frac{p_h0}{\left(-nb\right) - na}}\right) - \frac{va}{\frac{p_h0}{1 - p_h0}}\right)$
Alternative 9
Error21.4
Cost8000
$\log \left(\frac{vb \cdot \left(1 - p_h0\right)}{p_h0} + \left(\frac{va \cdot \left(p_h0 + -1\right)}{p_h0} + \frac{\left(1 - p_h0\right) \cdot \left(na + nb\right)}{p_h0}\right)\right)$
Alternative 10
Error34.9
Cost7876
$\begin{array}{l} \mathbf{if}\;p_h0 \leq 5.4 \cdot 10^{-193}:\\ \;\;\;\;\log \left(\frac{1 - p_h0}{\frac{p_h0}{vb}}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{va}{\frac{p_h0}{\left(1 - p_h0\right) \cdot \left(\frac{na}{va + ve} + \left(-1 + \frac{nb}{va + ve}\right)\right)}}\right)\\ \end{array}$
Alternative 11
Error20.4
Cost7744
$\log \left(\frac{va \cdot \left(\left(1 - p_h0\right) \cdot \left(-1 + \left(\frac{na}{va + ve} + \frac{nb}{va + ve}\right)\right)\right)}{p_h0}\right)$
Alternative 12
Error55.8
Cost6848
$\log \left(\frac{1 - p_h0}{\frac{p_h0}{vb}}\right)$

# Reproduce?

herbie shell --seed 1
(FPCore (na nb va vb ve p_h0)
:name "log((((na+nb-va-vb-ve)*abs(va-vb))*(1-p_h0))/((va+vb+ve)*p_h0))"
:precision binary64
:pre (and (and (and (and (and (and (<= 0.0 na) (<= na 10000000.0)) (and (<= 0.0 nb) (<= nb 10000000.0))) (and (<= 0.0 va) (<= va 10000000.0))) (and (<= 0.0 vb) (<= vb 10000000.0))) (and (<= 0.0 ve) (<= ve 10000000.0))) (and (<= 0.0 p_h0) (<= p_h0 1.0)))
(log (/ (* (* (- (- (- (+ na nb) va) vb) ve) (fabs (- va vb))) (- 1.0 p_h0)) (* (+ (+ va vb) ve) p_h0))))