
(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}
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0))))
(t_1 (* (+ m n) 0.5)))
(if (<= (* (cos (- (/ (* K (+ m n)) 2.0) M)) t_0) INFINITY)
(* t_0 (cos (- (pow (cbrt (* (+ m n) (* K 0.5))) 3.0) M)))
(* (exp (+ (- n m) (* (- t_1 M) (- M t_1)))) (cos M)))))
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 t_1 = (m + n) * 0.5;
double tmp;
if ((cos((((K * (m + n)) / 2.0) - M)) * t_0) <= ((double) INFINITY)) {
tmp = t_0 * cos((pow(cbrt(((m + n) * (K * 0.5))), 3.0) - M));
} else {
tmp = exp(((n - m) + ((t_1 - M) * (M - t_1)))) * cos(M);
}
return tmp;
}
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 t_1 = (m + n) * 0.5;
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(((m + n) * (K * 0.5))), 3.0) - M));
} else {
tmp = Math.exp(((n - m) + ((t_1 - M) * (M - t_1)))) * Math.cos(M);
}
return tmp;
}
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))) t_1 = Float64(Float64(m + n) * 0.5) 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((cbrt(Float64(Float64(m + n) * Float64(K * 0.5))) ^ 3.0) - M))); else tmp = Float64(exp(Float64(Float64(n - m) + Float64(Float64(t_1 - M) * Float64(M - t_1)))) * cos(M)); end return tmp end
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]}, Block[{t$95$1 = N[(N[(m + n), $MachinePrecision] * 0.5), $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[Power[N[Power[N[(N[(m + n), $MachinePrecision] * N[(K * 0.5), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(t$95$1 - M), $MachinePrecision] * N[(M - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
t_1 := \left(m + n\right) \cdot 0.5\\
\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]{\left(m + n\right) \cdot \left(K \cdot 0.5\right)}\right)}^{3} - M\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n - m\right) + \left(t\_1 - M\right) \cdot \left(M - t\_1\right)} \cdot \cos M\\
\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 95.2%
add-cube-cbrt95.6%
pow396.1%
div-inv96.1%
*-commutative96.1%
associate-*l*96.1%
metadata-eval96.1%
Applied egg-rr96.1%
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 100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
rem-square-sqrt54.3%
fabs-sqr54.3%
rem-square-sqrt100.0%
Simplified100.0%
unpow2100.0%
+-commutative100.0%
+-commutative100.0%
Applied egg-rr100.0%
Final simplification96.8%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- m n))))
(if (<=
(*
(cos (- (/ (* K (+ m n)) 2.0) M))
(exp (- (- t_0 l) (pow (- (/ (+ m n) 2.0) M) 2.0))))
-0.5)
(*
(cos (- (/ (* K m) 2.0) M))
(+ 1.0 (* l (+ (* l (+ 0.5 (* l -0.16666666666666666))) -1.0))))
(* (cos M) (exp (- t_0 (+ l (pow (- (* (+ m n) 0.5) M) 2.0))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n));
double tmp;
if ((cos((((K * (m + n)) / 2.0) - M)) * exp(((t_0 - l) - pow((((m + n) / 2.0) - M), 2.0)))) <= -0.5) {
tmp = cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)));
} else {
tmp = cos(M) * exp((t_0 - (l + pow((((m + n) * 0.5) - M), 2.0))));
}
return tmp;
}
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 = abs((m - n))
if ((cos((((k * (m + n)) / 2.0d0) - m_1)) * exp(((t_0 - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0)))) <= (-0.5d0)) then
tmp = cos((((k * m) / 2.0d0) - m_1)) * (1.0d0 + (l * ((l * (0.5d0 + (l * (-0.16666666666666666d0)))) + (-1.0d0))))
else
tmp = cos(m_1) * exp((t_0 - (l + ((((m + n) * 0.5d0) - m_1) ** 2.0d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.abs((m - n));
double tmp;
if ((Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp(((t_0 - l) - Math.pow((((m + n) / 2.0) - M), 2.0)))) <= -0.5) {
tmp = Math.cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)));
} else {
tmp = Math.cos(M) * Math.exp((t_0 - (l + Math.pow((((m + n) * 0.5) - M), 2.0))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((m - n)) tmp = 0 if (math.cos((((K * (m + n)) / 2.0) - M)) * math.exp(((t_0 - l) - math.pow((((m + n) / 2.0) - M), 2.0)))) <= -0.5: tmp = math.cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))) else: tmp = math.cos(M) * math.exp((t_0 - (l + math.pow((((m + n) * 0.5) - M), 2.0)))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(m - n)) tmp = 0.0 if (Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(t_0 - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)))) <= -0.5) tmp = Float64(cos(Float64(Float64(Float64(K * m) / 2.0) - M)) * Float64(1.0 + Float64(l * Float64(Float64(l * Float64(0.5 + Float64(l * -0.16666666666666666))) + -1.0)))); else tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(l + (Float64(Float64(Float64(m + n) * 0.5) - M) ^ 2.0))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((m - n)); tmp = 0.0; if ((cos((((K * (m + n)) / 2.0) - M)) * exp(((t_0 - l) - ((((m + n) / 2.0) - M) ^ 2.0)))) <= -0.5) tmp = cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))); else tmp = cos(M) * exp((t_0 - (l + ((((m + n) * 0.5) - M) ^ 2.0)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(t$95$0 - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.5], N[(N[Cos[N[(N[(N[(K * m), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(l * N[(N[(l * N[(0.5 + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(l + N[Power[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|m - n\right|\\
\mathbf{if}\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(t\_0 - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}} \leq -0.5:\\
\;\;\;\;\cos \left(\frac{K \cdot m}{2} - M\right) \cdot \left(1 + \ell \cdot \left(\ell \cdot \left(0.5 + \ell \cdot -0.16666666666666666\right) + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{t\_0 - \left(\ell + {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}\right)}\\
\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)))))) < -0.5Initial program 54.5%
Taylor expanded in l around inf 54.5%
mul-1-neg54.5%
Simplified54.5%
Taylor expanded in m around inf 37.6%
*-commutative37.6%
Simplified37.6%
Taylor expanded in l around 0 37.6%
if -0.5 < (*.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 79.4%
Taylor expanded in K around 0 98.0%
Simplified98.0%
Final simplification94.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (+ m n) 0.5)))
(if (<= l -4.2e+235)
(* (cos (- (/ (* K m) 2.0) M)) (+ 1.0 (* l (+ (* l 0.5) -1.0))))
(if (<= l 740.0)
(* (exp (+ (- n m) (* (- t_0 M) (- M t_0)))) (cos M))
(* (cos M) (exp (- l)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double tmp;
if (l <= -4.2e+235) {
tmp = cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * 0.5) + -1.0)));
} else if (l <= 740.0) {
tmp = exp(((n - m) + ((t_0 - M) * (M - t_0)))) * cos(M);
} else {
tmp = cos(M) * exp(-l);
}
return tmp;
}
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 = (m + n) * 0.5d0
if (l <= (-4.2d+235)) then
tmp = cos((((k * m) / 2.0d0) - m_1)) * (1.0d0 + (l * ((l * 0.5d0) + (-1.0d0))))
else if (l <= 740.0d0) then
tmp = exp(((n - m) + ((t_0 - m_1) * (m_1 - t_0)))) * cos(m_1)
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double tmp;
if (l <= -4.2e+235) {
tmp = Math.cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * 0.5) + -1.0)));
} else if (l <= 740.0) {
tmp = Math.exp(((n - m) + ((t_0 - M) * (M - t_0)))) * Math.cos(M);
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = (m + n) * 0.5 tmp = 0 if l <= -4.2e+235: tmp = math.cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * 0.5) + -1.0))) elif l <= 740.0: tmp = math.exp(((n - m) + ((t_0 - M) * (M - t_0)))) * math.cos(M) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) t_0 = Float64(Float64(m + n) * 0.5) tmp = 0.0 if (l <= -4.2e+235) tmp = Float64(cos(Float64(Float64(Float64(K * m) / 2.0) - M)) * Float64(1.0 + Float64(l * Float64(Float64(l * 0.5) + -1.0)))); elseif (l <= 740.0) tmp = Float64(exp(Float64(Float64(n - m) + Float64(Float64(t_0 - M) * Float64(M - t_0)))) * cos(M)); else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = (m + n) * 0.5; tmp = 0.0; if (l <= -4.2e+235) tmp = cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * 0.5) + -1.0))); elseif (l <= 740.0) tmp = exp(((n - m) + ((t_0 - M) * (M - t_0)))) * cos(M); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[l, -4.2e+235], N[(N[Cos[N[(N[(N[(K * m), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(l * N[(N[(l * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 740.0], N[(N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(m + n\right) \cdot 0.5\\
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{+235}:\\
\;\;\;\;\cos \left(\frac{K \cdot m}{2} - M\right) \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.5 + -1\right)\right)\\
\mathbf{elif}\;\ell \leq 740:\\
\;\;\;\;e^{\left(n - m\right) + \left(t\_0 - M\right) \cdot \left(M - t\_0\right)} \cdot \cos M\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < -4.2000000000000001e235Initial program 78.3%
Taylor expanded in l around inf 56.9%
mul-1-neg56.9%
Simplified56.9%
Taylor expanded in m around inf 43.9%
*-commutative43.9%
Simplified43.9%
Taylor expanded in l around 0 43.9%
if -4.2000000000000001e235 < l < 740Initial program 73.3%
Taylor expanded in K around 0 96.6%
Simplified96.6%
Taylor expanded in l around 0 92.6%
rem-square-sqrt44.4%
fabs-sqr44.4%
rem-square-sqrt92.6%
Simplified92.6%
unpow292.6%
+-commutative92.6%
+-commutative92.6%
Applied egg-rr92.6%
if 740 < l Initial program 90.6%
Taylor expanded in l around inf 90.6%
mul-1-neg90.6%
Simplified90.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
*-commutative100.0%
Simplified100.0%
Final simplification90.0%
(FPCore (K m n M l) :precision binary64 (if (<= n 34.0) (* (cos M) (exp (+ (- n m) (* (- (* (+ m n) 0.5) M) (- M (* m 0.5)))))) (exp (* -0.25 (pow n 2.0)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 34.0) {
tmp = cos(M) * exp(((n - m) + ((((m + n) * 0.5) - M) * (M - (m * 0.5)))));
} else {
tmp = exp((-0.25 * pow(n, 2.0)));
}
return tmp;
}
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 (n <= 34.0d0) then
tmp = cos(m_1) * exp(((n - m) + ((((m + n) * 0.5d0) - m_1) * (m_1 - (m * 0.5d0)))))
else
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 34.0) {
tmp = Math.cos(M) * Math.exp(((n - m) + ((((m + n) * 0.5) - M) * (M - (m * 0.5)))));
} else {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 34.0: tmp = math.cos(M) * math.exp(((n - m) + ((((m + n) * 0.5) - M) * (M - (m * 0.5))))) else: tmp = math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 34.0) tmp = Float64(cos(M) * exp(Float64(Float64(n - m) + Float64(Float64(Float64(Float64(m + n) * 0.5) - M) * Float64(M - Float64(m * 0.5)))))); else tmp = exp(Float64(-0.25 * (n ^ 2.0))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 34.0) tmp = cos(M) * exp(((n - m) + ((((m + n) * 0.5) - M) * (M - (m * 0.5))))); else tmp = exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 34.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 34:\\
\;\;\;\;\cos M \cdot e^{\left(n - m\right) + \left(\left(m + n\right) \cdot 0.5 - M\right) \cdot \left(M - m \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < 34Initial program 78.8%
Taylor expanded in K around 0 93.4%
Simplified93.4%
Taylor expanded in l around 0 81.7%
rem-square-sqrt30.9%
fabs-sqr30.9%
rem-square-sqrt81.7%
Simplified81.7%
unpow281.7%
+-commutative81.7%
+-commutative81.7%
Applied egg-rr81.7%
Taylor expanded in n around 0 78.0%
if 34 < n Initial program 75.0%
Taylor expanded in n around inf 75.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
Final simplification82.1%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (cos (- (/ (* K m) 2.0) M))))
(if (<= l -4.2e+235)
(* t_0 (+ 1.0 (* l (+ (* l 0.5) -1.0))))
(if (<= l -1.55e+32)
(* t_0 (exp l))
(if (<= l 700.0)
(* (cos M) (exp (* -0.25 (* n n))))
(* (cos M) (exp (- l))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos((((K * m) / 2.0) - M));
double tmp;
if (l <= -4.2e+235) {
tmp = t_0 * (1.0 + (l * ((l * 0.5) + -1.0)));
} else if (l <= -1.55e+32) {
tmp = t_0 * exp(l);
} else if (l <= 700.0) {
tmp = cos(M) * exp((-0.25 * (n * n)));
} else {
tmp = cos(M) * exp(-l);
}
return tmp;
}
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 = cos((((k * m) / 2.0d0) - m_1))
if (l <= (-4.2d+235)) then
tmp = t_0 * (1.0d0 + (l * ((l * 0.5d0) + (-1.0d0))))
else if (l <= (-1.55d+32)) then
tmp = t_0 * exp(l)
else if (l <= 700.0d0) then
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.cos((((K * m) / 2.0) - M));
double tmp;
if (l <= -4.2e+235) {
tmp = t_0 * (1.0 + (l * ((l * 0.5) + -1.0)));
} else if (l <= -1.55e+32) {
tmp = t_0 * Math.exp(l);
} else if (l <= 700.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos((((K * m) / 2.0) - M)) tmp = 0 if l <= -4.2e+235: tmp = t_0 * (1.0 + (l * ((l * 0.5) + -1.0))) elif l <= -1.55e+32: tmp = t_0 * math.exp(l) elif l <= 700.0: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) t_0 = cos(Float64(Float64(Float64(K * m) / 2.0) - M)) tmp = 0.0 if (l <= -4.2e+235) tmp = Float64(t_0 * Float64(1.0 + Float64(l * Float64(Float64(l * 0.5) + -1.0)))); elseif (l <= -1.55e+32) tmp = Float64(t_0 * exp(l)); elseif (l <= 700.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos((((K * m) / 2.0) - M)); tmp = 0.0; if (l <= -4.2e+235) tmp = t_0 * (1.0 + (l * ((l * 0.5) + -1.0))); elseif (l <= -1.55e+32) tmp = t_0 * exp(l); elseif (l <= 700.0) tmp = cos(M) * exp((-0.25 * (n * n))); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Cos[N[(N[(N[(K * m), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4.2e+235], N[(t$95$0 * N[(1.0 + N[(l * N[(N[(l * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.55e+32], N[(t$95$0 * N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 700.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K \cdot m}{2} - M\right)\\
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{+235}:\\
\;\;\;\;t\_0 \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.5 + -1\right)\right)\\
\mathbf{elif}\;\ell \leq -1.55 \cdot 10^{+32}:\\
\;\;\;\;t\_0 \cdot e^{\ell}\\
\mathbf{elif}\;\ell \leq 700:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < -4.2000000000000001e235Initial program 78.3%
Taylor expanded in l around inf 56.9%
mul-1-neg56.9%
Simplified56.9%
Taylor expanded in m around inf 43.9%
*-commutative43.9%
Simplified43.9%
Taylor expanded in l around 0 43.9%
if -4.2000000000000001e235 < l < -1.54999999999999997e32Initial program 68.8%
Taylor expanded in l around inf 9.3%
mul-1-neg9.3%
Simplified9.3%
Taylor expanded in m around inf 9.4%
*-commutative9.4%
Simplified9.4%
pow19.4%
associate-/l*9.4%
add-sqr-sqrt9.4%
sqrt-unprod9.4%
sqr-neg9.4%
sqrt-unprod0.0%
add-sqr-sqrt66.9%
Applied egg-rr66.9%
unpow166.9%
associate-*r/66.9%
*-commutative66.9%
Simplified66.9%
if -1.54999999999999997e32 < l < 700Initial program 75.1%
Taylor expanded in n around inf 42.2%
Taylor expanded in K around 0 56.8%
cos-neg56.8%
Simplified56.8%
unpow256.8%
Applied egg-rr56.8%
if 700 < l Initial program 90.6%
Taylor expanded in l around inf 90.6%
mul-1-neg90.6%
Simplified90.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
*-commutative100.0%
Simplified100.0%
Final simplification68.3%
(FPCore (K m n M l)
:precision binary64
(if (<= n -54.0)
(exp (* -0.25 (pow n 2.0)))
(if (<= n 55.0)
(* (cos M) (exp (- l)))
(* (cos M) (exp (* -0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -54.0) {
tmp = exp((-0.25 * pow(n, 2.0)));
} else if (n <= 55.0) {
tmp = cos(M) * exp(-l);
} else {
tmp = cos(M) * exp((-0.25 * (n * n)));
}
return tmp;
}
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 (n <= (-54.0d0)) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
else if (n <= 55.0d0) then
tmp = cos(m_1) * exp(-l)
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -54.0) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else if (n <= 55.0) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -54.0: tmp = math.exp((-0.25 * math.pow(n, 2.0))) elif n <= 55.0: tmp = math.cos(M) * math.exp(-l) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -54.0) tmp = exp(Float64(-0.25 * (n ^ 2.0))); elseif (n <= 55.0) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= -54.0) tmp = exp((-0.25 * (n ^ 2.0))); elseif (n <= 55.0) tmp = cos(M) * exp(-l); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -54.0], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 55.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -54:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{elif}\;n \leq 55:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < -54Initial program 71.7%
Taylor expanded in n around inf 68.4%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Taylor expanded in M around 0 96.7%
if -54 < n < 55Initial program 81.6%
Taylor expanded in l around inf 43.5%
mul-1-neg43.5%
Simplified43.5%
Taylor expanded in K around 0 44.0%
cos-neg44.0%
*-commutative44.0%
Simplified44.0%
if 55 < n Initial program 75.0%
Taylor expanded in n around inf 75.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
unpow2100.0%
Applied egg-rr100.0%
Final simplification66.9%
(FPCore (K m n M l) :precision binary64 (if (or (<= n -54.0) (not (<= n 53.0))) (exp (* -0.25 (pow n 2.0))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -54.0) || !(n <= 53.0)) {
tmp = exp((-0.25 * pow(n, 2.0)));
} else {
tmp = cos(M) * exp(-l);
}
return tmp;
}
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 ((n <= (-54.0d0)) .or. (.not. (n <= 53.0d0))) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -54.0) || !(n <= 53.0)) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (n <= -54.0) or not (n <= 53.0): tmp = math.exp((-0.25 * math.pow(n, 2.0))) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((n <= -54.0) || !(n <= 53.0)) tmp = exp(Float64(-0.25 * (n ^ 2.0))); else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((n <= -54.0) || ~((n <= 53.0))) tmp = exp((-0.25 * (n ^ 2.0))); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[n, -54.0], N[Not[LessEqual[n, 53.0]], $MachinePrecision]], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -54 \lor \neg \left(n \leq 53\right):\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if n < -54 or 53 < n Initial program 73.1%
Taylor expanded in n around inf 71.3%
Taylor expanded in K around 0 98.2%
cos-neg98.2%
Simplified98.2%
Taylor expanded in M around 0 98.2%
if -54 < n < 53Initial program 81.6%
Taylor expanded in l around inf 43.5%
mul-1-neg43.5%
Simplified43.5%
Taylor expanded in K around 0 44.0%
cos-neg44.0%
*-commutative44.0%
Simplified44.0%
Final simplification66.9%
(FPCore (K m n M l)
:precision binary64
(if (or (<= n -4.8e-134) (not (<= n 51.0)))
(exp (* -0.25 (pow n 2.0)))
(*
(cos (- (/ (* K m) 2.0) M))
(+ 1.0 (* l (+ (* l (+ 0.5 (* l -0.16666666666666666))) -1.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -4.8e-134) || !(n <= 51.0)) {
tmp = exp((-0.25 * pow(n, 2.0)));
} else {
tmp = cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)));
}
return tmp;
}
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 ((n <= (-4.8d-134)) .or. (.not. (n <= 51.0d0))) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
else
tmp = cos((((k * m) / 2.0d0) - m_1)) * (1.0d0 + (l * ((l * (0.5d0 + (l * (-0.16666666666666666d0)))) + (-1.0d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -4.8e-134) || !(n <= 51.0)) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else {
tmp = Math.cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (n <= -4.8e-134) or not (n <= 51.0): tmp = math.exp((-0.25 * math.pow(n, 2.0))) else: tmp = math.cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((n <= -4.8e-134) || !(n <= 51.0)) tmp = exp(Float64(-0.25 * (n ^ 2.0))); else tmp = Float64(cos(Float64(Float64(Float64(K * m) / 2.0) - M)) * Float64(1.0 + Float64(l * Float64(Float64(l * Float64(0.5 + Float64(l * -0.16666666666666666))) + -1.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((n <= -4.8e-134) || ~((n <= 51.0))) tmp = exp((-0.25 * (n ^ 2.0))); else tmp = cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[n, -4.8e-134], N[Not[LessEqual[n, 51.0]], $MachinePrecision]], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[N[(N[(N[(K * m), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(l * N[(N[(l * N[(0.5 + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.8 \cdot 10^{-134} \lor \neg \left(n \leq 51\right):\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\frac{K \cdot m}{2} - M\right) \cdot \left(1 + \ell \cdot \left(\ell \cdot \left(0.5 + \ell \cdot -0.16666666666666666\right) + -1\right)\right)\\
\end{array}
\end{array}
if n < -4.80000000000000019e-134 or 51 < n Initial program 77.4%
Taylor expanded in n around inf 55.3%
Taylor expanded in K around 0 75.3%
cos-neg75.3%
Simplified75.3%
Taylor expanded in M around 0 75.3%
if -4.80000000000000019e-134 < n < 51Initial program 79.0%
Taylor expanded in l around inf 43.0%
mul-1-neg43.0%
Simplified43.0%
Taylor expanded in m around inf 41.8%
*-commutative41.8%
Simplified41.8%
Taylor expanded in l around 0 20.6%
Final simplification51.6%
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K m) 2.0) M)) (+ 1.0 (* l (+ (* l (+ 0.5 (* l -0.16666666666666666))) -1.0)))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)));
}
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) / 2.0d0) - m_1)) * (1.0d0 + (l * ((l * (0.5d0 + (l * (-0.16666666666666666d0)))) + (-1.0d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)));
}
def code(K, m, n, M, l): return math.cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * m) / 2.0) - M)) * Float64(1.0 + Float64(l * Float64(Float64(l * Float64(0.5 + Float64(l * -0.16666666666666666))) + -1.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * m), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(l * N[(N[(l * N[(0.5 + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot m}{2} - M\right) \cdot \left(1 + \ell \cdot \left(\ell \cdot \left(0.5 + \ell \cdot -0.16666666666666666\right) + -1\right)\right)
\end{array}
Initial program 78.1%
Taylor expanded in l around inf 36.2%
mul-1-neg36.2%
Simplified36.2%
Taylor expanded in m around inf 36.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in l around 0 12.5%
Final simplification12.5%
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K m) 2.0) M)) (+ 1.0 (* l (+ (* l 0.5) -1.0)))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * 0.5) + -1.0)));
}
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) / 2.0d0) - m_1)) * (1.0d0 + (l * ((l * 0.5d0) + (-1.0d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * 0.5) + -1.0)));
}
def code(K, m, n, M, l): return math.cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * 0.5) + -1.0)))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * m) / 2.0) - M)) * Float64(1.0 + Float64(l * Float64(Float64(l * 0.5) + -1.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * m) / 2.0) - M)) * (1.0 + (l * ((l * 0.5) + -1.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * m), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(l * N[(N[(l * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot m}{2} - M\right) \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.5 + -1\right)\right)
\end{array}
Initial program 78.1%
Taylor expanded in l around inf 36.2%
mul-1-neg36.2%
Simplified36.2%
Taylor expanded in m around inf 36.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in l around 0 11.8%
Final simplification11.8%
(FPCore (K m n M l) :precision binary64 (cos M))
double code(double K, double m, double n, double M, double l) {
return cos(M);
}
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(m_1)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M);
}
def code(K, m, n, M, l): return math.cos(M)
function code(K, m, n, M, l) return cos(M) end
function tmp = code(K, m, n, M, l) tmp = cos(M); end
code[K_, m_, n_, M_, l_] := N[Cos[M], $MachinePrecision]
\begin{array}{l}
\\
\cos M
\end{array}
Initial program 78.1%
Taylor expanded in l around inf 36.2%
mul-1-neg36.2%
Simplified36.2%
Taylor expanded in l around 0 7.7%
Taylor expanded in K around 0 8.0%
cos-neg8.0%
Simplified8.0%
herbie shell --seed 2024146
(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)))))))