
(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 (* (cos M) (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.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(m_1) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * 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]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 83.8%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Final simplification97.0%
(FPCore (K m n M l) :precision binary64 (if (or (<= m -29.0) (not (<= m 54.0))) (* (cos M) (exp (* (pow m 2.0) -0.25))) (* (cos M) (exp (- (pow M 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -29.0) || !(m <= 54.0)) {
tmp = cos(M) * exp((pow(m, 2.0) * -0.25));
} else {
tmp = cos(M) * exp(-pow(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) :: tmp
if ((m <= (-29.0d0)) .or. (.not. (m <= 54.0d0))) then
tmp = cos(m_1) * exp(((m ** 2.0d0) * (-0.25d0)))
else
tmp = cos(m_1) * exp(-(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 tmp;
if ((m <= -29.0) || !(m <= 54.0)) {
tmp = Math.cos(M) * Math.exp((Math.pow(m, 2.0) * -0.25));
} else {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (m <= -29.0) or not (m <= 54.0): tmp = math.cos(M) * math.exp((math.pow(m, 2.0) * -0.25)) else: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((m <= -29.0) || !(m <= 54.0)) tmp = Float64(cos(M) * exp(Float64((m ^ 2.0) * -0.25))); else tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((m <= -29.0) || ~((m <= 54.0))) tmp = cos(M) * exp(((m ^ 2.0) * -0.25)); else tmp = cos(M) * exp(-(M ^ 2.0)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[m, -29.0], N[Not[LessEqual[m, 54.0]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -29 \lor \neg \left(m \leq 54\right):\\
\;\;\;\;\cos M \cdot e^{{m}^{2} \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\end{array}
\end{array}
if m < -29 or 54 < m Initial program 79.7%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in m around inf 97.1%
*-commutative97.1%
Simplified97.1%
if -29 < m < 54Initial program 88.1%
Taylor expanded in K around 0 95.3%
cos-neg95.3%
Simplified95.3%
Taylor expanded in M around inf 67.9%
mul-1-neg67.9%
Simplified67.9%
Final simplification83.1%
(FPCore (K m n M l)
:precision binary64
(if (<= m -29.0)
(* (cos M) (exp (* (pow m 2.0) -0.25)))
(if (<= m 6.2e-253)
(* (cos M) (exp (- (pow M 2.0))))
(* (cos M) (exp (* -0.25 (pow n 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -29.0) {
tmp = cos(M) * exp((pow(m, 2.0) * -0.25));
} else if (m <= 6.2e-253) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * 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 (m <= (-29.0d0)) then
tmp = cos(m_1) * exp(((m ** 2.0d0) * (-0.25d0)))
else if (m <= 6.2d-253) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = cos(m_1) * 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 (m <= -29.0) {
tmp = Math.cos(M) * Math.exp((Math.pow(m, 2.0) * -0.25));
} else if (m <= 6.2e-253) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -29.0: tmp = math.cos(M) * math.exp((math.pow(m, 2.0) * -0.25)) elif m <= 6.2e-253: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -29.0) tmp = Float64(cos(M) * exp(Float64((m ^ 2.0) * -0.25))); elseif (m <= 6.2e-253) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -29.0) tmp = cos(M) * exp(((m ^ 2.0) * -0.25)); elseif (m <= 6.2e-253) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -29.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 6.2e-253], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -29:\\
\;\;\;\;\cos M \cdot e^{{m}^{2} \cdot -0.25}\\
\mathbf{elif}\;m \leq 6.2 \cdot 10^{-253}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -29Initial program 78.5%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in m around inf 95.5%
*-commutative95.5%
Simplified95.5%
if -29 < m < 6.19999999999999991e-253Initial program 88.1%
Taylor expanded in K around 0 95.3%
cos-neg95.3%
Simplified95.3%
Taylor expanded in M around inf 65.6%
mul-1-neg65.6%
Simplified65.6%
if 6.19999999999999991e-253 < m Initial program 83.6%
Taylor expanded in K around 0 97.4%
cos-neg97.4%
Simplified97.4%
Taylor expanded in n around inf 53.0%
*-commutative53.0%
Simplified53.0%
Final simplification67.9%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -29500000.0) (not (<= M 8e-48))) (* (cos M) (exp (- (pow M 2.0)))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -29500000.0) || !(M <= 8e-48)) {
tmp = cos(M) * exp(-pow(M, 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 ((m_1 <= (-29500000.0d0)) .or. (.not. (m_1 <= 8d-48))) then
tmp = cos(m_1) * exp(-(m_1 ** 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 ((M <= -29500000.0) || !(M <= 8e-48)) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -29500000.0) or not (M <= 8e-48): tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -29500000.0) || !(M <= 8e-48)) tmp = Float64(cos(M) * exp(Float64(-(M ^ 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 ((M <= -29500000.0) || ~((M <= 8e-48))) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -29500000.0], N[Not[LessEqual[M, 8e-48]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -29500000 \lor \neg \left(M \leq 8 \cdot 10^{-48}\right):\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if M < -2.95e7 or 7.9999999999999998e-48 < M Initial program 85.5%
Taylor expanded in K around 0 97.8%
cos-neg97.8%
Simplified97.8%
Taylor expanded in M around inf 95.0%
mul-1-neg95.0%
Simplified95.0%
if -2.95e7 < M < 7.9999999999999998e-48Initial program 81.7%
Taylor expanded in l around inf 43.7%
mul-1-neg43.7%
Simplified43.7%
Taylor expanded in K around 0 47.2%
cos-neg47.2%
*-commutative47.2%
Simplified47.2%
Final simplification73.0%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(-l);
}
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) * exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(-l);
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(-l)
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(-l))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(-l); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{-\ell}
\end{array}
Initial program 83.8%
Taylor expanded in l around inf 30.5%
mul-1-neg30.5%
Simplified30.5%
Taylor expanded in K around 0 31.2%
cos-neg31.2%
*-commutative31.2%
Simplified31.2%
Final simplification31.2%
(FPCore (K m n M l) :precision binary64 (* (+ 1.0 (* l (+ (* l (+ 0.5 (* l -0.16666666666666666))) -1.0))) (cos (- (* n (* 0.5 K)) M))))
double code(double K, double m, double n, double M, double l) {
return (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))) * cos(((n * (0.5 * K)) - 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 = (1.0d0 + (l * ((l * (0.5d0 + (l * (-0.16666666666666666d0)))) + (-1.0d0)))) * cos(((n * (0.5d0 * k)) - m_1))
end function
public static double code(double K, double m, double n, double M, double l) {
return (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))) * Math.cos(((n * (0.5 * K)) - M));
}
def code(K, m, n, M, l): return (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))) * math.cos(((n * (0.5 * K)) - M))
function code(K, m, n, M, l) return Float64(Float64(1.0 + Float64(l * Float64(Float64(l * Float64(0.5 + Float64(l * -0.16666666666666666))) + -1.0))) * cos(Float64(Float64(n * Float64(0.5 * K)) - M))) end
function tmp = code(K, m, n, M, l) tmp = (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))) * cos(((n * (0.5 * K)) - M)); end
code[K_, m_, n_, M_, l_] := N[(N[(1.0 + N[(l * N[(N[(l * N[(0.5 + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(n * N[(0.5 * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + \ell \cdot \left(\ell \cdot \left(0.5 + \ell \cdot -0.16666666666666666\right) + -1\right)\right) \cdot \cos \left(n \cdot \left(0.5 \cdot K\right) - M\right)
\end{array}
Initial program 83.8%
Taylor expanded in l around inf 30.5%
mul-1-neg30.5%
Simplified30.5%
Taylor expanded in m around 0 30.2%
*-commutative30.2%
*-commutative30.2%
*-commutative30.2%
associate-*l*30.2%
*-commutative30.2%
Simplified30.2%
Taylor expanded in l around 0 10.2%
Final simplification10.2%
(FPCore (K m n M l) :precision binary64 (* (cos (- (* n (* 0.5 K)) M)) (+ 1.0 (* l (+ (* l 0.5) -1.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(((n * (0.5 * K)) - 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(((n * (0.5d0 * k)) - 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(((n * (0.5 * K)) - M)) * (1.0 + (l * ((l * 0.5) + -1.0)));
}
def code(K, m, n, M, l): return math.cos(((n * (0.5 * K)) - M)) * (1.0 + (l * ((l * 0.5) + -1.0)))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(n * Float64(0.5 * K)) - M)) * Float64(1.0 + Float64(l * Float64(Float64(l * 0.5) + -1.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(((n * (0.5 * K)) - M)) * (1.0 + (l * ((l * 0.5) + -1.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(n * N[(0.5 * K), $MachinePrecision]), $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(n \cdot \left(0.5 \cdot K\right) - M\right) \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.5 + -1\right)\right)
\end{array}
Initial program 83.8%
Taylor expanded in l around inf 30.5%
mul-1-neg30.5%
Simplified30.5%
Taylor expanded in m around 0 30.2%
*-commutative30.2%
*-commutative30.2%
*-commutative30.2%
associate-*l*30.2%
*-commutative30.2%
Simplified30.2%
Taylor expanded in l around 0 9.8%
Final simplification9.8%
(FPCore (K m n M l) :precision binary64 (cos (- (* m (* 0.5 K)) M)))
double code(double K, double m, double n, double M, double l) {
return cos(((m * (0.5 * K)) - 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 * (0.5d0 * k)) - m_1))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(((m * (0.5 * K)) - M));
}
def code(K, m, n, M, l): return math.cos(((m * (0.5 * K)) - M))
function code(K, m, n, M, l) return cos(Float64(Float64(m * Float64(0.5 * K)) - M)) end
function tmp = code(K, m, n, M, l) tmp = cos(((m * (0.5 * K)) - M)); end
code[K_, m_, n_, M_, l_] := N[Cos[N[(N[(m * N[(0.5 * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\cos \left(m \cdot \left(0.5 \cdot K\right) - M\right)
\end{array}
Initial program 83.8%
Taylor expanded in l around inf 30.5%
mul-1-neg30.5%
Simplified30.5%
Taylor expanded in l around 0 8.2%
*-commutative8.2%
Simplified8.2%
Taylor expanded in n around 0 8.2%
associate-*r*8.2%
Simplified8.2%
Final simplification8.2%
(FPCore (K m n M l) :precision binary64 (cos (* m (* 0.5 K))))
double code(double K, double m, double n, double M, double l) {
return cos((m * (0.5 * K)));
}
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 * (0.5d0 * k)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((m * (0.5 * K)));
}
def code(K, m, n, M, l): return math.cos((m * (0.5 * K)))
function code(K, m, n, M, l) return cos(Float64(m * Float64(0.5 * K))) end
function tmp = code(K, m, n, M, l) tmp = cos((m * (0.5 * K))); end
code[K_, m_, n_, M_, l_] := N[Cos[N[(m * N[(0.5 * K), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\cos \left(m \cdot \left(0.5 \cdot K\right)\right)
\end{array}
Initial program 83.8%
Taylor expanded in l around inf 30.5%
mul-1-neg30.5%
Simplified30.5%
Taylor expanded in l around 0 8.2%
*-commutative8.2%
Simplified8.2%
Taylor expanded in m around inf 8.2%
associate-*r*8.2%
Simplified8.2%
Final simplification8.2%
(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 83.8%
Taylor expanded in l around inf 30.5%
mul-1-neg30.5%
Simplified30.5%
Taylor expanded in l around 0 8.2%
*-commutative8.2%
Simplified8.2%
Taylor expanded in K around 0 8.1%
Taylor expanded in M around -inf 8.1%
neg-mul-18.1%
cos-neg8.1%
Simplified8.1%
(FPCore (K m n M l) :precision binary64 1.0)
double code(double K, double m, double n, double M, double l) {
return 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 = 1.0d0
end function
public static double code(double K, double m, double n, double M, double l) {
return 1.0;
}
def code(K, m, n, M, l): return 1.0
function code(K, m, n, M, l) return 1.0 end
function tmp = code(K, m, n, M, l) tmp = 1.0; end
code[K_, m_, n_, M_, l_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 83.8%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Taylor expanded in M around inf 58.1%
mul-1-neg58.1%
Simplified58.1%
Taylor expanded in M around 0 8.1%
herbie shell --seed 2024135
(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)))))))