0
$\begingroup$

How to define the function $$f_m(s)=\begin{cases} s^m, \quad s\in[0,n]\\ 0, \quad otherwise \end{cases}$$

And to get its value of discrete self-convolution in $s=n$ by means of Convolve function ? My try:

Let be function f[m_, s_, n_] defined as follows:

f[m_, s_, n_] := 0
f[m_, s_, n_] := s^m /; 0 <= s <= n
s = n; Sum[f[2, s - k, n]*f[2, k, n], {k, -Infinity, +Infinity}]

and result is always zero, which is not supposed to be

$\endgroup$
2
  • $\begingroup$ I don't understand your definitions; the first one pretty much makes the function identically zero everywhere. What did you mean by it? Are there conditions on the values of $m$, $s$, $n$? $\endgroup$ – MarcoB Mar 7 '19 at 19:44
  • $\begingroup$ Thats the point, i need to present the expression $\sum_{k=0}^{n}k^m(n-k)^m$ in terms of convolution of power function defined on finite interval [0,n] $\endgroup$ – PKK Mar 7 '19 at 19:48
1
$\begingroup$

It appears to be straightforward if you use Piecewise to define f:

f[s_, n_, m_] := Piecewise[{{s^m, 0 < s < n}, {0, True}}]
Convolve[f[s, 3, 2], f[s, 3, 2], s , t]

This returns a plausible Piecewise expression.

$\endgroup$
3
  • $\begingroup$ I think you are doing a continuous convolution, while the question specified a discrete convolution. $\endgroup$ – mikado Mar 7 '19 at 20:04
  • $\begingroup$ Yes, exactly, im sorry that haven't noticed that it should be discrete convolution $\endgroup$ – PKK Mar 7 '19 at 20:12
  • $\begingroup$ by the way, now the entry s = n = 4; Sum[f[2, s - k, n]*f[2, k, n], {k, -Infinity, +Infinity}] gives correct result 34, but still let's try to make it more beautiful using native method Convole :) $\endgroup$ – PKK Mar 7 '19 at 20:15
2
$\begingroup$

The right function to use is DiscreteConvolve[]; in addition, use UnitStep[] to impose your finite conditions:

DiscreteConvolve[UnitStep[k] k^m, UnitStep[k] k^m, k, s]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.