
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
(if (<= (* (cos (- (/ (* K (+ m n)) 2.0) M)) t_0) INFINITY)
(* t_0 (cos (- (* (pow (cbrt K) 2.0) (* (cbrt K) (* (+ m n) 0.5))) M)))
(exp (+ (- (- m n) l) (* (pow n 2.0) -0.25))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((cos((((K * (m + n)) / 2.0) - M)) * t_0) <= ((double) INFINITY)) {
tmp = t_0 * cos(((pow(cbrt(K), 2.0) * (cbrt(K) * ((m + n) * 0.5))) - M));
} else {
tmp = exp((((m - n) - l) + (pow(n, 2.0) * -0.25)));
}
return tmp;
}
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((Math.cos((((K * (m + n)) / 2.0) - M)) * t_0) <= Double.POSITIVE_INFINITY) {
tmp = t_0 * Math.cos(((Math.pow(Math.cbrt(K), 2.0) * (Math.cbrt(K) * ((m + n) * 0.5))) - M));
} else {
tmp = Math.exp((((m - n) - l) + (Math.pow(n, 2.0) * -0.25)));
}
return tmp;
}
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) tmp = 0.0 if (Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * t_0) <= Inf) tmp = Float64(t_0 * cos(Float64(Float64((cbrt(K) ^ 2.0) * Float64(cbrt(K) * Float64(Float64(m + n) * 0.5))) - M))); else tmp = exp(Float64(Float64(Float64(m - n) - l) + Float64((n ^ 2.0) * -0.25))); end return tmp end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], Infinity], N[(t$95$0 * N[Cos[N[(N[(N[Power[N[Power[K, 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[K, 1/3], $MachinePrecision] * N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision] + N[(N[Power[n, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
\mathbf{if}\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot t\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot \cos \left({\left(\sqrt[3]{K}\right)}^{2} \cdot \left(\sqrt[3]{K} \cdot \left(\left(m + n\right) \cdot 0.5\right)\right) - M\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left(m - n\right) - \ell\right) + {n}^{2} \cdot -0.25}\\
\end{array}
\end{array}
if (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) < +inf.0Initial program 97.3%
associate-/l*97.3%
add-cube-cbrt98.2%
associate-*l*98.6%
pow298.6%
div-inv98.6%
metadata-eval98.6%
Applied egg-rr98.6%
if +inf.0 < (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) Initial program 0.0%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Taylor expanded in M around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 61.4%
fabs-sub61.4%
sub-neg61.4%
mul-1-neg61.4%
fabs-neg61.4%
associate--r+61.4%
cancel-sign-sub-inv61.4%
fabs-neg61.4%
mul-1-neg61.4%
sub-neg61.4%
fabs-sub61.4%
rem-square-sqrt39.5%
fabs-sqr39.5%
rem-square-sqrt84.6%
metadata-eval84.6%
*-commutative84.6%
Simplified84.6%
Final simplification95.8%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
(if (<= (* (cos (- (/ (* K (+ m n)) 2.0) M)) t_0) 2.0)
(* t_0 (cos (- (/ 1.0 (/ (/ 2.0 K) (+ m n))) M)))
(exp (+ (- (- m n) l) (* (pow n 2.0) -0.25))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((cos((((K * (m + n)) / 2.0) - M)) * t_0) <= 2.0) {
tmp = t_0 * cos(((1.0 / ((2.0 / K) / (m + n))) - M));
} else {
tmp = exp((((m - n) - l) + (pow(n, 2.0) * -0.25)));
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = exp(((abs((m - n)) - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0)))
if ((cos((((k * (m + n)) / 2.0d0) - m_1)) * t_0) <= 2.0d0) then
tmp = t_0 * cos(((1.0d0 / ((2.0d0 / k) / (m + n))) - m_1))
else
tmp = exp((((m - n) - l) + ((n ** 2.0d0) * (-0.25d0))))
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((Math.cos((((K * (m + n)) / 2.0) - M)) * t_0) <= 2.0) {
tmp = t_0 * Math.cos(((1.0 / ((2.0 / K) / (m + n))) - M));
} else {
tmp = Math.exp((((m - n) - l) + (Math.pow(n, 2.0) * -0.25)));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0))) tmp = 0 if (math.cos((((K * (m + n)) / 2.0) - M)) * t_0) <= 2.0: tmp = t_0 * math.cos(((1.0 / ((2.0 / K) / (m + n))) - M)) else: tmp = math.exp((((m - n) - l) + (math.pow(n, 2.0) * -0.25))) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) tmp = 0.0 if (Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * t_0) <= 2.0) tmp = Float64(t_0 * cos(Float64(Float64(1.0 / Float64(Float64(2.0 / K) / Float64(m + n))) - M))); else tmp = exp(Float64(Float64(Float64(m - n) - l) + Float64((n ^ 2.0) * -0.25))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0)));
tmp = 0.0;
if ((cos((((K * (m + n)) / 2.0) - M)) * t_0) <= 2.0)
tmp = t_0 * cos(((1.0 / ((2.0 / K) / (m + n))) - M));
else
tmp = exp((((m - n) - l) + ((n ^ 2.0) * -0.25)));
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], 2.0], N[(t$95$0 * N[Cos[N[(N[(1.0 / N[(N[(2.0 / K), $MachinePrecision] / N[(m + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision] + N[(N[Power[n, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
\mathbf{if}\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot t\_0 \leq 2:\\
\;\;\;\;t\_0 \cdot \cos \left(\frac{1}{\frac{\frac{2}{K}}{m + n}} - M\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left(m - n\right) - \ell\right) + {n}^{2} \cdot -0.25}\\
\end{array}
\end{array}
if (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) < 2Initial program 98.7%
clear-num99.1%
inv-pow99.1%
associate-/r*99.1%
Applied egg-rr99.1%
unpow-199.1%
Simplified99.1%
if 2 < (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) Initial program 6.9%
Taylor expanded in K around 0 93.1%
cos-neg93.1%
Simplified93.1%
Taylor expanded in M around 0 94.8%
*-commutative94.8%
Simplified94.8%
Taylor expanded in m around 0 60.9%
fabs-sub60.9%
sub-neg60.9%
mul-1-neg60.9%
fabs-neg60.9%
associate--r+60.9%
cancel-sign-sub-inv60.9%
fabs-neg60.9%
mul-1-neg60.9%
sub-neg60.9%
fabs-sub60.9%
rem-square-sqrt36.4%
fabs-sqr36.4%
rem-square-sqrt81.3%
metadata-eval81.3%
*-commutative81.3%
Simplified81.3%
Final simplification95.0%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
(if (<= (* (cos (- (/ (* K (+ m n)) 2.0) M)) t_0) INFINITY)
(* t_0 (cos (* K (* (+ m n) 0.5))))
(exp (+ (- (- m n) l) (* (pow n 2.0) -0.25))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((cos((((K * (m + n)) / 2.0) - M)) * t_0) <= ((double) INFINITY)) {
tmp = t_0 * cos((K * ((m + n) * 0.5)));
} else {
tmp = exp((((m - n) - l) + (pow(n, 2.0) * -0.25)));
}
return tmp;
}
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((Math.cos((((K * (m + n)) / 2.0) - M)) * t_0) <= Double.POSITIVE_INFINITY) {
tmp = t_0 * Math.cos((K * ((m + n) * 0.5)));
} else {
tmp = Math.exp((((m - n) - l) + (Math.pow(n, 2.0) * -0.25)));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0))) tmp = 0 if (math.cos((((K * (m + n)) / 2.0) - M)) * t_0) <= math.inf: tmp = t_0 * math.cos((K * ((m + n) * 0.5))) else: tmp = math.exp((((m - n) - l) + (math.pow(n, 2.0) * -0.25))) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) tmp = 0.0 if (Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * t_0) <= Inf) tmp = Float64(t_0 * cos(Float64(K * Float64(Float64(m + n) * 0.5)))); else tmp = exp(Float64(Float64(Float64(m - n) - l) + Float64((n ^ 2.0) * -0.25))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0)));
tmp = 0.0;
if ((cos((((K * (m + n)) / 2.0) - M)) * t_0) <= Inf)
tmp = t_0 * cos((K * ((m + n) * 0.5)));
else
tmp = exp((((m - n) - l) + ((n ^ 2.0) * -0.25)));
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], Infinity], N[(t$95$0 * N[Cos[N[(K * N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision] + N[(N[Power[n, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
\mathbf{if}\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot t\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot \cos \left(K \cdot \left(\left(m + n\right) \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left(m - n\right) - \ell\right) + {n}^{2} \cdot -0.25}\\
\end{array}
\end{array}
if (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) < +inf.0Initial program 97.3%
Taylor expanded in M around 0 97.6%
*-commutative97.6%
associate-*r*97.6%
Simplified97.6%
if +inf.0 < (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) Initial program 0.0%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Taylor expanded in M around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 61.4%
fabs-sub61.4%
sub-neg61.4%
mul-1-neg61.4%
fabs-neg61.4%
associate--r+61.4%
cancel-sign-sub-inv61.4%
fabs-neg61.4%
mul-1-neg61.4%
sub-neg61.4%
fabs-sub61.4%
rem-square-sqrt39.5%
fabs-sqr39.5%
rem-square-sqrt84.6%
metadata-eval84.6%
*-commutative84.6%
Simplified84.6%
Final simplification95.0%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (* (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0))) (cos M)))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0))) * cos(M);
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = exp(((abs((m - n)) - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0))) * cos(m_1)
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0))) * Math.cos(M);
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0))) * math.cos(M)
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return Float64(exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) * cos(M)) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))) * cos(M);
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[(N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}} \cdot \cos M
\end{array}
Initial program 77.9%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Final simplification96.2%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (if (or (<= M -8.5e-5) (not (<= M 700.0))) (* (cos M) (exp (- (pow M 2.0)))) (exp (- (fabs (- m n)) (+ l (* (* (+ m n) (+ m n)) 0.25))))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -8.5e-5) || !(M <= 700.0)) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = exp((fabs((m - n)) - (l + (((m + n) * (m + n)) * 0.25))));
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((m_1 <= (-8.5d-5)) .or. (.not. (m_1 <= 700.0d0))) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = exp((abs((m - n)) - (l + (((m + n) * (m + n)) * 0.25d0))))
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -8.5e-5) || !(M <= 700.0)) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.exp((Math.abs((m - n)) - (l + (((m + n) * (m + n)) * 0.25))));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if (M <= -8.5e-5) or not (M <= 700.0): tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.exp((math.fabs((m - n)) - (l + (((m + n) * (m + n)) * 0.25)))) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if ((M <= -8.5e-5) || !(M <= 700.0)) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = exp(Float64(abs(Float64(m - n)) - Float64(l + Float64(Float64(Float64(m + n) * Float64(m + n)) * 0.25)))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if ((M <= -8.5e-5) || ~((M <= 700.0)))
tmp = cos(M) * exp(-(M ^ 2.0));
else
tmp = exp((abs((m - n)) - (l + (((m + n) * (m + n)) * 0.25))));
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -8.5e-5], N[Not[LessEqual[M, 700.0]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[(N[(N[(m + n), $MachinePrecision] * N[(m + n), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -8.5 \cdot 10^{-5} \lor \neg \left(M \leq 700\right):\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left|m - n\right| - \left(\ell + \left(\left(m + n\right) \cdot \left(m + n\right)\right) \cdot 0.25\right)}\\
\end{array}
\end{array}
if M < -8.500000000000001e-5 or 700 < M Initial program 81.0%
Taylor expanded in K around 0 97.6%
cos-neg97.6%
Simplified97.6%
Taylor expanded in M around inf 97.7%
mul-1-neg97.7%
Simplified97.7%
if -8.500000000000001e-5 < M < 700Initial program 74.9%
Taylor expanded in K around 0 94.9%
cos-neg94.9%
Simplified94.9%
Taylor expanded in M around 0 94.9%
*-commutative94.9%
Simplified94.9%
unpow294.9%
Applied egg-rr94.9%
Final simplification96.2%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (exp (- (fabs (- m n)) (+ l (* (* (+ m n) (+ m n)) 0.25)))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return exp((fabs((m - n)) - (l + (((m + n) * (m + n)) * 0.25))));
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = exp((abs((m - n)) - (l + (((m + n) * (m + n)) * 0.25d0))))
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((Math.abs((m - n)) - (l + (((m + n) * (m + n)) * 0.25))));
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.exp((math.fabs((m - n)) - (l + (((m + n) * (m + n)) * 0.25))))
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return exp(Float64(abs(Float64(m - n)) - Float64(l + Float64(Float64(Float64(m + n) * Float64(m + n)) * 0.25)))) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = exp((abs((m - n)) - (l + (((m + n) * (m + n)) * 0.25))));
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[(N[(N[(m + n), $MachinePrecision] * N[(m + n), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
e^{\left|m - n\right| - \left(\ell + \left(\left(m + n\right) \cdot \left(m + n\right)\right) \cdot 0.25\right)}
\end{array}
Initial program 77.9%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Taylor expanded in M around 0 86.2%
*-commutative86.2%
Simplified86.2%
unpow286.2%
Applied egg-rr86.2%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (exp (+ (- (- m n) l) (* (pow n 2.0) -0.25))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return exp((((m - n) - l) + (pow(n, 2.0) * -0.25)));
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = exp((((m - n) - l) + ((n ** 2.0d0) * (-0.25d0))))
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((((m - n) - l) + (Math.pow(n, 2.0) * -0.25)));
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.exp((((m - n) - l) + (math.pow(n, 2.0) * -0.25)))
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return exp(Float64(Float64(Float64(m - n) - l) + Float64((n ^ 2.0) * -0.25))) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = exp((((m - n) - l) + ((n ^ 2.0) * -0.25)));
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[Exp[N[(N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision] + N[(N[Power[n, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
e^{\left(\left(m - n\right) - \ell\right) + {n}^{2} \cdot -0.25}
\end{array}
Initial program 77.9%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Taylor expanded in M around 0 86.2%
*-commutative86.2%
Simplified86.2%
Taylor expanded in m around 0 62.3%
fabs-sub62.3%
sub-neg62.3%
mul-1-neg62.3%
fabs-neg62.3%
associate--r+62.3%
cancel-sign-sub-inv62.3%
fabs-neg62.3%
mul-1-neg62.3%
sub-neg62.3%
fabs-sub62.3%
rem-square-sqrt34.4%
fabs-sqr34.4%
rem-square-sqrt75.0%
metadata-eval75.0%
*-commutative75.0%
Simplified75.0%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (if (<= m -52.0) (exp (* -0.25 (pow m 2.0))) (exp (* (pow n 2.0) -0.25))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -52.0) {
tmp = exp((-0.25 * pow(m, 2.0)));
} else {
tmp = exp((pow(n, 2.0) * -0.25));
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m <= (-52.0d0)) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = exp(((n ** 2.0d0) * (-0.25d0)))
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -52.0) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.exp((Math.pow(n, 2.0) * -0.25));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if m <= -52.0: tmp = math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.exp((math.pow(n, 2.0) * -0.25)) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (m <= -52.0) tmp = exp(Float64(-0.25 * (m ^ 2.0))); else tmp = exp(Float64((n ^ 2.0) * -0.25)); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (m <= -52.0)
tmp = exp((-0.25 * (m ^ 2.0)));
else
tmp = exp(((n ^ 2.0) * -0.25));
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[m, -52.0], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[Power[n, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;m \leq -52:\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{{n}^{2} \cdot -0.25}\\
\end{array}
\end{array}
if m < -52Initial program 69.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around inf 98.6%
*-commutative98.6%
Simplified98.6%
if -52 < m Initial program 81.1%
Taylor expanded in K around 0 94.9%
cos-neg94.9%
Simplified94.9%
Taylor expanded in M around 0 81.2%
*-commutative81.2%
Simplified81.2%
Taylor expanded in n around inf 62.1%
*-commutative62.1%
Simplified62.1%
Final simplification71.7%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (if (<= l 0.00072) (exp (* -0.25 (pow m 2.0))) (exp (- l))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 0.00072) {
tmp = exp((-0.25 * pow(m, 2.0)));
} else {
tmp = exp(-l);
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (l <= 0.00072d0) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = exp(-l)
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 0.00072) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if l <= 0.00072: tmp = math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.exp(-l) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (l <= 0.00072) tmp = exp(Float64(-0.25 * (m ^ 2.0))); else tmp = exp(Float64(-l)); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (l <= 0.00072)
tmp = exp((-0.25 * (m ^ 2.0)));
else
tmp = exp(-l);
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[l, 0.00072], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 0.00072:\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < 7.20000000000000045e-4Initial program 76.9%
Taylor expanded in K around 0 95.3%
cos-neg95.3%
Simplified95.3%
Taylor expanded in M around 0 82.9%
*-commutative82.9%
Simplified82.9%
Taylor expanded in m around inf 57.2%
*-commutative57.2%
Simplified57.2%
if 7.20000000000000045e-4 < l Initial program 82.0%
Taylor expanded in l around inf 82.0%
mul-1-neg82.0%
Simplified82.0%
Taylor expanded in m around inf 86.0%
associate-*r*86.0%
Simplified86.0%
Taylor expanded in K around 0 100.0%
Final simplification65.6%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (exp (- l)))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return exp(-l);
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = exp(-l)
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(-l);
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.exp(-l)
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return exp(Float64(-l)) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = exp(-l);
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[Exp[(-l)], $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
e^{-\ell}
\end{array}
Initial program 77.9%
Taylor expanded in l around inf 25.8%
mul-1-neg25.8%
Simplified25.8%
Taylor expanded in m around inf 27.2%
associate-*r*27.2%
Simplified27.2%
Taylor expanded in K around 0 29.3%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 1.0)
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return 1.0;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = 1.0d0
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return 1.0;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return 1.0
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return 1.0 end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = 1.0;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := 1.0
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
1
\end{array}
Initial program 77.9%
Taylor expanded in l around inf 25.8%
mul-1-neg25.8%
Simplified25.8%
Taylor expanded in l around 0 8.0%
Taylor expanded in K around 0 8.5%
neg-mul-18.5%
Simplified8.5%
Taylor expanded in M around 0 8.6%
herbie shell --seed 2024113
(FPCore (K m n M l)
:name "Maksimov and Kolovsky, Equation (32)"
:precision binary64
(* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))