Skip to main content
3 of 6
incremental edit
A.Z.
  • 580
  • 2
  • 8

Consider the following code

f[n_, p_] := n^p
g[n_, p_] := n*p
    
DirichletConvolve[f[n, p], g[n, p], n, 4]

First, we define two functions f and g. Then we compute their Dirichlet convolution.

The third argument in the Dirichlet convolution tells us that n is the function argument for which we want to do the convolution. p on the other hand is a parameter that happens to exist in the functions but is not related to the convolution. Changing the last line to

DirichletConvolve[f[n, p], g[n, p], p, 4]

means that we are using p as the variable for the convolution, whereas n now is some parameter.

Finally, the 4 says that we want to evaluate the resulting function at 4. If you want to evaluate this function at the general position m you use

DirichletConvolve[f[n, p], g[n, p], n, m]

Mathematical Way

Let me write this in a mathematical way: We have two functions

$$ f \colon \mathbb{N} \times \mathbb{N} \longrightarrow \mathbb{N} \\ (n,p) \longmapsto n^p $$

and

$$ g \colon \mathbb{N} \times \mathbb{N} \longrightarrow \mathbb{N} \\ (n,p) \longmapsto n\cdot p $$

Now DirichletConvolve[f[n, p], g[n, p], n, m] evaluates

TO BE DONE

Example from the Documentation

If the functions f and g do not have any parameters, this looks like:

f[n_] := n (* or any other function depending only on n *)
g[n_] := n

DirichletConvolve[f[n], g[n], n, m]

This example is equivalent to the one from the documentation

DirichletConvolve[n, n, n, m]

We convolve the identity map with itself and evaluate it at m.

A.Z.
  • 580
  • 2
  • 8