?

Average Accuracy: 76.6% → 97.8%
Time: 30.8s
Precision: binary64

?

\[\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)} \]
\[\cos M \cdot e^{\left(-{\left(\mathsf{fma}\left(m + n, 0.5, -M\right)\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
(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
 (*
  (cos M)
  (exp (- (- (pow (fma (+ m n) 0.5 (- 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)))));
}
double code(double K, double m, double n, double M, double l) {
	return cos(M) * exp((-pow(fma((m + n), 0.5, -M), 2.0) - (l - 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 code(K, m, n, M, l)
	return Float64(cos(M) * exp(Float64(Float64(-(fma(Float64(m + n), 0.5, Float64(-M)) ^ 2.0)) - Float64(l - abs(Float64(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]
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(m + n), $MachinePrecision] * 0.5 + (-M)), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $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)}
\cos M \cdot e^{\left(-{\left(\mathsf{fma}\left(m + n, 0.5, -M\right)\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}

Error?

Derivation?

  1. Initial program 76.6%

    \[\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)} \]
  2. Simplified76.6%

    \[\leadsto \color{blue}{\cos \left(\mathsf{fma}\left(K \cdot \left(m + n\right), 0.5, -M\right)\right) \cdot e^{\left(-{\left(\mathsf{fma}\left(m + n, 0.5, -M\right)\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}} \]
    Proof
  3. Taylor expanded in m around 0 85.2%

    \[\leadsto \cos \left(\mathsf{fma}\left(\color{blue}{n \cdot K}, 0.5, -M\right)\right) \cdot e^{\left(-{\left(\mathsf{fma}\left(m + n, 0.5, -M\right)\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
  4. Taylor expanded in n around 0 97.8%

    \[\leadsto \color{blue}{\cos \left(-M\right)} \cdot e^{\left(-{\left(\mathsf{fma}\left(m + n, 0.5, -M\right)\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
  5. Simplified97.8%

    \[\leadsto \color{blue}{\cos M} \cdot e^{\left(-{\left(\mathsf{fma}\left(m + n, 0.5, -M\right)\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
    Proof

Reproduce?

herbie shell --seed 2023237 
(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)))))))