| Alternative 1 | |
|---|---|
| Error | 1.4 |
| Cost | 26624 |
(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)))))))
(FPCore (K m n M l) :precision binary64 (if (<= l 2e-95) (* (cos M) (exp (- (- m n) (* M M)))) (* (cos M) (exp (- (- m n) (+ l (* M M)))))))
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)))));
}
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 2e-95) {
tmp = cos(M) * exp(((m - n) - (M * M)));
} else {
tmp = cos(M) * exp(((m - n) - (l + (M * M))));
}
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
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end 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 <= 2d-95) then
tmp = cos(m_1) * exp(((m - n) - (m_1 * m_1)))
else
tmp = cos(m_1) * exp(((m - n) - (l + (m_1 * m_1))))
end if
code = tmp
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)))));
}
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 2e-95) {
tmp = Math.cos(M) * Math.exp(((m - n) - (M * M)));
} else {
tmp = Math.cos(M) * Math.exp(((m - n) - (l + (M * M))));
}
return tmp;
}
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)))))
def code(K, m, n, M, l): tmp = 0 if l <= 2e-95: tmp = math.cos(M) * math.exp(((m - n) - (M * M))) else: tmp = math.cos(M) * math.exp(((m - n) - (l + (M * M)))) return tmp
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 code(K, m, n, M, l) tmp = 0.0 if (l <= 2e-95) tmp = Float64(cos(M) * exp(Float64(Float64(m - n) - Float64(M * M)))); else tmp = Float64(cos(M) * exp(Float64(Float64(m - n) - Float64(l + Float64(M * M))))); end return tmp 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
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 2e-95) tmp = cos(M) * exp(((m - n) - (M * M))); else tmp = cos(M) * exp(((m - n) - (l + (M * M)))); end tmp_2 = tmp; 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]
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 2e-95], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m - n), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m - n), $MachinePrecision] - N[(l + N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\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)}
\begin{array}{l}
\mathbf{if}\;\ell \leq 2 \cdot 10^{-95}:\\
\;\;\;\;\cos M \cdot e^{\left(m - n\right) - M \cdot M}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(m - n\right) - \left(\ell + M \cdot M\right)}\\
\end{array}
Results
if l < 1.99999999999999998e-95Initial program 15.8
Simplified15.7
[Start]15.8 | \[ \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)}
\] |
|---|---|
*-commutative [=>]15.8 | \[ \cos \left(\frac{\color{blue}{\left(m + n\right) \cdot K}}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\] |
associate-*r/ [<=]15.7 | \[ \cos \left(\color{blue}{\left(m + n\right) \cdot \frac{K}{2}} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\] |
associate--r- [=>]15.7 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\color{blue}{\left(\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \ell\right) + \left|m - n\right|}}
\] |
+-commutative [=>]15.7 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\color{blue}{\left|m - n\right| + \left(\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \ell\right)}}
\] |
sub-neg [=>]15.7 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\left|m - n\right| + \color{blue}{\left(\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) + \left(-\ell\right)\right)}}
\] |
distribute-neg-out [=>]15.7 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\left|m - n\right| + \color{blue}{\left(-\left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)\right)}}
\] |
sub-neg [<=]15.7 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\color{blue}{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)}}
\] |
+-commutative [=>]15.7 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\left|m - n\right| - \color{blue}{\left(\ell + {\left(\frac{m + n}{2} - M\right)}^{2}\right)}}
\] |
associate--l- [<=]15.7 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\color{blue}{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}}
\] |
Applied egg-rr15.9
Simplified15.9
[Start]15.9 | \[ e^{\mathsf{log1p}\left(\cos \left(\left(m + n\right) \cdot \left(K \cdot 0.5\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}\right)} - 1
\] |
|---|---|
expm1-def [=>]15.9 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\left(m + n\right) \cdot \left(K \cdot 0.5\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}\right)\right)}
\] |
expm1-log1p [=>]15.9 | \[ \color{blue}{\cos \left(\left(m + n\right) \cdot \left(K \cdot 0.5\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}}
\] |
+-commutative [=>]15.9 | \[ \cos \left(\color{blue}{\left(n + m\right)} \cdot \left(K \cdot 0.5\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-commutative [=>]15.9 | \[ \cos \left(\color{blue}{\left(K \cdot 0.5\right) \cdot \left(n + m\right)} - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-commutative [=>]15.9 | \[ \cos \left(\color{blue}{\left(0.5 \cdot K\right)} \cdot \left(n + m\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
associate-*r* [<=]15.9 | \[ \cos \left(\color{blue}{0.5 \cdot \left(K \cdot \left(n + m\right)\right)} - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
fma-neg [=>]15.9 | \[ \cos \color{blue}{\left(\mathsf{fma}\left(0.5, K \cdot \left(n + m\right), -M\right)\right)} \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
distribute-rgt-in [=>]15.9 | \[ \cos \left(\mathsf{fma}\left(0.5, \color{blue}{n \cdot K + m \cdot K}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-lft-identity [<=]15.9 | \[ \cos \left(\mathsf{fma}\left(0.5, n \cdot K + \color{blue}{\left(1 \cdot m\right)} \cdot K, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
metadata-eval [<=]15.9 | \[ \cos \left(\mathsf{fma}\left(0.5, n \cdot K + \left(\color{blue}{\left(--1\right)} \cdot m\right) \cdot K, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
distribute-rgt-in [<=]15.9 | \[ \cos \left(\mathsf{fma}\left(0.5, \color{blue}{K \cdot \left(n + \left(--1\right) \cdot m\right)}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
cancel-sign-sub-inv [<=]15.9 | \[ \cos \left(\mathsf{fma}\left(0.5, K \cdot \color{blue}{\left(n - -1 \cdot m\right)}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
fma-neg [<=]15.9 | \[ \cos \color{blue}{\left(0.5 \cdot \left(K \cdot \left(n - -1 \cdot m\right)\right) - M\right)} \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
fma-neg [=>]15.9 | \[ \cos \color{blue}{\left(\mathsf{fma}\left(0.5, K \cdot \left(n - -1 \cdot m\right), -M\right)\right)} \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
cancel-sign-sub-inv [=>]15.9 | \[ \cos \left(\mathsf{fma}\left(0.5, K \cdot \color{blue}{\left(n + \left(--1\right) \cdot m\right)}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
distribute-lft-in [=>]15.9 | \[ \cos \left(\mathsf{fma}\left(0.5, \color{blue}{K \cdot n + K \cdot \left(\left(--1\right) \cdot m\right)}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
metadata-eval [=>]15.9 | \[ \cos \left(\mathsf{fma}\left(0.5, K \cdot n + K \cdot \left(\color{blue}{1} \cdot m\right), -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-lft-identity [=>]15.9 | \[ \cos \left(\mathsf{fma}\left(0.5, K \cdot n + K \cdot \color{blue}{m}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
distribute-lft-in [<=]15.9 | \[ \cos \left(\mathsf{fma}\left(0.5, \color{blue}{K \cdot \left(n + m\right)}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
fma-neg [<=]15.9 | \[ \cos \color{blue}{\left(0.5 \cdot \left(K \cdot \left(n + m\right)\right) - M\right)} \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
associate-*r* [=>]15.9 | \[ \cos \left(\color{blue}{\left(0.5 \cdot K\right) \cdot \left(n + m\right)} - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-commutative [<=]15.9 | \[ \cos \left(\color{blue}{\left(K \cdot 0.5\right)} \cdot \left(n + m\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-commutative [<=]15.9 | \[ \cos \left(\color{blue}{\left(n + m\right) \cdot \left(K \cdot 0.5\right)} - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
+-commutative [<=]15.9 | \[ \cos \left(\color{blue}{\left(m + n\right)} \cdot \left(K \cdot 0.5\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
+-commutative [=>]15.9 | \[ \cos \left(\color{blue}{\left(n + m\right)} \cdot \left(K \cdot 0.5\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-commutative [=>]15.9 | \[ \cos \left(\left(n + m\right) \cdot \color{blue}{\left(0.5 \cdot K\right)} - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
associate--l- [=>]15.9 | \[ \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right) \cdot e^{\color{blue}{\left(m - n\right) - \left(\ell + {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}\right)}}
\] |
+-commutative [=>]15.9 | \[ \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right) \cdot e^{\left(m - n\right) - \left(\ell + {\left(\color{blue}{\left(n + m\right)} \cdot 0.5 - M\right)}^{2}\right)}
\] |
*-commutative [=>]15.9 | \[ \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right) \cdot e^{\left(m - n\right) - \left(\ell + {\left(\color{blue}{0.5 \cdot \left(n + m\right)} - M\right)}^{2}\right)}
\] |
Taylor expanded in M around inf 18.0
Simplified18.0
[Start]18.0 | \[ \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right) \cdot e^{\left(m - n\right) - \left(\ell + {M}^{2}\right)}
\] |
|---|---|
unpow2 [=>]18.0 | \[ \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right) \cdot e^{\left(m - n\right) - \left(\ell + \color{blue}{M \cdot M}\right)}
\] |
Taylor expanded in K around 0 4.9
Simplified4.9
[Start]4.9 | \[ \cos \left(-M\right) \cdot e^{\left(m - n\right) - \left(\ell + M \cdot M\right)}
\] |
|---|---|
cos-neg [=>]4.9 | \[ \color{blue}{\cos M} \cdot e^{\left(m - n\right) - \left(\ell + M \cdot M\right)}
\] |
Taylor expanded in l around 0 1.9
Simplified1.9
[Start]1.9 | \[ \cos M \cdot e^{\left(m - n\right) - {M}^{2}}
\] |
|---|---|
unpow2 [=>]1.9 | \[ \cos M \cdot e^{\left(m - n\right) - \color{blue}{M \cdot M}}
\] |
if 1.99999999999999998e-95 < l Initial program 13.9
Simplified13.8
[Start]13.9 | \[ \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)}
\] |
|---|---|
*-commutative [=>]13.9 | \[ \cos \left(\frac{\color{blue}{\left(m + n\right) \cdot K}}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\] |
associate-*r/ [<=]13.8 | \[ \cos \left(\color{blue}{\left(m + n\right) \cdot \frac{K}{2}} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\] |
associate--r- [=>]13.8 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\color{blue}{\left(\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \ell\right) + \left|m - n\right|}}
\] |
+-commutative [=>]13.8 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\color{blue}{\left|m - n\right| + \left(\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \ell\right)}}
\] |
sub-neg [=>]13.8 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\left|m - n\right| + \color{blue}{\left(\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) + \left(-\ell\right)\right)}}
\] |
distribute-neg-out [=>]13.8 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\left|m - n\right| + \color{blue}{\left(-\left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)\right)}}
\] |
sub-neg [<=]13.8 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\color{blue}{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)}}
\] |
+-commutative [=>]13.8 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\left|m - n\right| - \color{blue}{\left(\ell + {\left(\frac{m + n}{2} - M\right)}^{2}\right)}}
\] |
associate--l- [<=]13.8 | \[ \cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\color{blue}{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}}
\] |
Applied egg-rr14.0
Simplified13.9
[Start]14.0 | \[ e^{\mathsf{log1p}\left(\cos \left(\left(m + n\right) \cdot \left(K \cdot 0.5\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}\right)} - 1
\] |
|---|---|
expm1-def [=>]13.9 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \left(\left(m + n\right) \cdot \left(K \cdot 0.5\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}\right)\right)}
\] |
expm1-log1p [=>]13.9 | \[ \color{blue}{\cos \left(\left(m + n\right) \cdot \left(K \cdot 0.5\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}}
\] |
+-commutative [=>]13.9 | \[ \cos \left(\color{blue}{\left(n + m\right)} \cdot \left(K \cdot 0.5\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-commutative [=>]13.9 | \[ \cos \left(\color{blue}{\left(K \cdot 0.5\right) \cdot \left(n + m\right)} - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-commutative [=>]13.9 | \[ \cos \left(\color{blue}{\left(0.5 \cdot K\right)} \cdot \left(n + m\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
associate-*r* [<=]14.0 | \[ \cos \left(\color{blue}{0.5 \cdot \left(K \cdot \left(n + m\right)\right)} - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
fma-neg [=>]14.0 | \[ \cos \color{blue}{\left(\mathsf{fma}\left(0.5, K \cdot \left(n + m\right), -M\right)\right)} \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
distribute-rgt-in [=>]14.0 | \[ \cos \left(\mathsf{fma}\left(0.5, \color{blue}{n \cdot K + m \cdot K}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-lft-identity [<=]14.0 | \[ \cos \left(\mathsf{fma}\left(0.5, n \cdot K + \color{blue}{\left(1 \cdot m\right)} \cdot K, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
metadata-eval [<=]14.0 | \[ \cos \left(\mathsf{fma}\left(0.5, n \cdot K + \left(\color{blue}{\left(--1\right)} \cdot m\right) \cdot K, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
distribute-rgt-in [<=]14.0 | \[ \cos \left(\mathsf{fma}\left(0.5, \color{blue}{K \cdot \left(n + \left(--1\right) \cdot m\right)}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
cancel-sign-sub-inv [<=]14.0 | \[ \cos \left(\mathsf{fma}\left(0.5, K \cdot \color{blue}{\left(n - -1 \cdot m\right)}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
fma-neg [<=]14.0 | \[ \cos \color{blue}{\left(0.5 \cdot \left(K \cdot \left(n - -1 \cdot m\right)\right) - M\right)} \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
fma-neg [=>]14.0 | \[ \cos \color{blue}{\left(\mathsf{fma}\left(0.5, K \cdot \left(n - -1 \cdot m\right), -M\right)\right)} \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
cancel-sign-sub-inv [=>]14.0 | \[ \cos \left(\mathsf{fma}\left(0.5, K \cdot \color{blue}{\left(n + \left(--1\right) \cdot m\right)}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
distribute-lft-in [=>]14.0 | \[ \cos \left(\mathsf{fma}\left(0.5, \color{blue}{K \cdot n + K \cdot \left(\left(--1\right) \cdot m\right)}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
metadata-eval [=>]14.0 | \[ \cos \left(\mathsf{fma}\left(0.5, K \cdot n + K \cdot \left(\color{blue}{1} \cdot m\right), -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-lft-identity [=>]14.0 | \[ \cos \left(\mathsf{fma}\left(0.5, K \cdot n + K \cdot \color{blue}{m}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
distribute-lft-in [<=]14.0 | \[ \cos \left(\mathsf{fma}\left(0.5, \color{blue}{K \cdot \left(n + m\right)}, -M\right)\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
fma-neg [<=]14.0 | \[ \cos \color{blue}{\left(0.5 \cdot \left(K \cdot \left(n + m\right)\right) - M\right)} \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
associate-*r* [=>]13.9 | \[ \cos \left(\color{blue}{\left(0.5 \cdot K\right) \cdot \left(n + m\right)} - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-commutative [<=]13.9 | \[ \cos \left(\color{blue}{\left(K \cdot 0.5\right)} \cdot \left(n + m\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-commutative [<=]13.9 | \[ \cos \left(\color{blue}{\left(n + m\right) \cdot \left(K \cdot 0.5\right)} - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
+-commutative [<=]13.9 | \[ \cos \left(\color{blue}{\left(m + n\right)} \cdot \left(K \cdot 0.5\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
+-commutative [=>]13.9 | \[ \cos \left(\color{blue}{\left(n + m\right)} \cdot \left(K \cdot 0.5\right) - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
*-commutative [=>]13.9 | \[ \cos \left(\left(n + m\right) \cdot \color{blue}{\left(0.5 \cdot K\right)} - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\] |
associate--l- [=>]13.9 | \[ \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right) \cdot e^{\color{blue}{\left(m - n\right) - \left(\ell + {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}\right)}}
\] |
+-commutative [=>]13.9 | \[ \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right) \cdot e^{\left(m - n\right) - \left(\ell + {\left(\color{blue}{\left(n + m\right)} \cdot 0.5 - M\right)}^{2}\right)}
\] |
*-commutative [=>]13.9 | \[ \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right) \cdot e^{\left(m - n\right) - \left(\ell + {\left(\color{blue}{0.5 \cdot \left(n + m\right)} - M\right)}^{2}\right)}
\] |
Taylor expanded in M around inf 14.0
Simplified14.0
[Start]14.0 | \[ \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right) \cdot e^{\left(m - n\right) - \left(\ell + {M}^{2}\right)}
\] |
|---|---|
unpow2 [=>]14.0 | \[ \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right) \cdot e^{\left(m - n\right) - \left(\ell + \color{blue}{M \cdot M}\right)}
\] |
Taylor expanded in K around 0 0.8
Simplified0.8
[Start]0.8 | \[ \cos \left(-M\right) \cdot e^{\left(m - n\right) - \left(\ell + M \cdot M\right)}
\] |
|---|---|
cos-neg [=>]0.8 | \[ \color{blue}{\cos M} \cdot e^{\left(m - n\right) - \left(\ell + M \cdot M\right)}
\] |
Final simplification1.6
| Alternative 1 | |
|---|---|
| Error | 1.4 |
| Cost | 26624 |
| Alternative 2 | |
|---|---|
| Error | 1.6 |
| Cost | 13508 |
| Alternative 3 | |
|---|---|
| Error | 19.3 |
| Cost | 13380 |
| Alternative 4 | |
|---|---|
| Error | 9.8 |
| Cost | 13380 |
| Alternative 5 | |
|---|---|
| Error | 43.7 |
| Cost | 13056 |
herbie shell --seed 2022354
(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)))))))