9

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 ...


4

The problem is that Mathematica has a specific use for the ' character (namely Derivative). Changing ω' to ωp gives Integrate[1/(ω - 3 - I η) 1/(ωp - ω - 6.3 + I η), {ω, -Infinity, Infinity}] ConditionalExpression[0. + 0. I, Im[(0. + 1. I) η + 1. ωp] > 0 && Re[η] > 0] Or you can use the built in function Convolve as Convolve[1/(ω - 3 - I η), 1/...


4

I led you astray with a bogus answer that I didn't think through appropriately. I've removed the previous answer and put in place a more correct approach. Here's what I missed: the variance associated with the added noise needs to be estimated with the replicate measurements. If just the mean of the replicates is used, then all of the information about ...


4

I really hope that math concept convolution and Mathematica Convolve, DiscreteConvolve and ListConvolve are the same and not just using similar words. Well, you are supposed to be checking that the definition Mathematica uses is the same as the definition you are using. Not just in this case, but any time you use nontrivial functionality. In this ...


4

This is a bit slow but you could construct the fit yourself as a minimization of square residuals. This gives me: {A -> 18.9346, w -> 0.768869, xc -> 1583.96, ϕ -> -0.632702} dx = 0.01; resl = 0.15; vX = Table[i, {i, 1582, 1586, dx}]; L = Length[vX]; vX2 = PadRight[vX, 2 L - 1]; Length[vX2]; c = 2.99792458*10^5; f[x_, y0_, A_, w_, xc_, ϕ_] := ...


4

How about this? extractNeighborsNeumann[m_, r_] := { center -> Part[m, r + 1, r + 1], neighbors -> extractNeighbors[ m, DiamondMatrix[r] - CenterArray[1, {2 r + 1, 2 r + 1}] ] } extractNeighborsMoore[m_, r_] := { center -> Part[m, r + 1, r + 1], neighbors -> extractNeighbors[ m, BoxMatrix[r] - CenterArray[1, {2 r + 1,...


4

Let f,g be arithmetical functions. Then (f*g)(n), where * is Dirichlet Multiplication or Convolution is equal to: DirichletConvolve[f[j],g[j],j,n] and also: DivisorSum[n,f[#]g[n/#]&] So for example, DivisorSigma[0,n]=DirichletConvolve[1,1,j,n] I only recently tweeted about this to @WolframResearch https://twitter.com/ndroock1/status/...


3

Both your HannWindowand $\chi$ function are Indeterminate at $x=0$ so I created a function that uses the Limit at $x=0$ or I rearranged the function to eliminate the divide by zero. I don't know if it is necessary, but I seem to have had better success if I make the function cyclical by mirroring it about it's endpoint before doing the convolution. The ...


3

This is only a partial answer. (I cannot duplicate the results from the approximation found in this article. That's likely my fault.) The problem can be described as finding the pdf for the sum of $L$ independent and identically distributed Rayleigh random variables: $$Z_L=\sum_{i=1}^L X_i$$ where $X_i \sim \text{Rayleigh}(\sigma)$. All of the moments ...


3

Let's define Jacobsthal's numbers: Clear[jacob] jacob[n_Integer] := (2^n - (-1)^n)/3 Then, from the definition (which you demonstrated yourself in your first ListConvolve expression for one element): Clear[a094705] a094705[n_Integer] := First@ ListConvolve[ Table[jacob[i], {i, 0, n}], 3^Range[0, n] ] Table[a094705[x], {x, 0, 10}] (* Out: {0,...


2

No need to resort to numerical convolution for this classic problem. In 1D: Convolve[ PDF[NormalDistribution[m1, s1], x], PDF[NormalDistribution[m2, s2], y], x, y] and likewise in 2D.


2

Disclaimer: I am not up-to-speed on any current literature on this particular approximation. What I'm about to present has likely been done many years ago. The problem can be described as the need to find the probability density function (or a good approximation of it) for the sum of $L$ independent and identically distributed Rayleigh random variables ...


2

You may find the difference easier to understand if you write the convolution as an integral. The position of the pole relative to the real line depends on the sign of η. With η=0 the pole is on the real line, and the integral diverges (but you can take its principal value, which is zero). Assuming[{ω1, ω2, y, η} ∈ Reals && η > 0, Integrate[f[...


2

You are missing two scaling factors: (I) Factor in convolution theorem; (II) Factor in Kernel. Factor (I) To compute the factor in a linear transform (Fourier, convolution, etc.), it is helpful to first try the delta function. In the discrete case here, it is Kronecker delta. The default Fourier transform (FT) in Mathematica has a $1/\sqrt{n}$ factor ...


2

There are many ways to convolve (filter) data x with a kernel h: convolution, correlation, using the frequency domain method, and directly in the time domain. The only difference (other than numerical factors) is in the way edge conditions are handled with padding. Here is the setup: h = {1, -1, 2, -2, 3, -3}; x = {1, 2, 3, 4, 5, 6, -5, -4, -3, -2, -1}; ...


1

Without ListConvolve: myListConvolve[kernel_, list_][n_] := Dot[Reverse@kernel, Take[RotateLeft[list, n - 1], Length[kernel]]] example: myListConvolve[{x, y}, {a, b, c, d, e, f}] /@ Range[5] myListConvolve will be faster than your procedural program (maybe 20 or 30 x) but slower than ListConvolve. When working out your solution, do not hesitate to use ...


Only top voted, non community-wiki answers of a minimum length are eligible