Skip to main content
14 votes
Accepted

Does Mathematica reuse previous computations?

Here I implemented three different versions of Gaussian filtering (for periodic data). It took me a while to adjust the constants and still some of them might be wrong. Prepare the Gaussian kernel <...
Henrik Schumacher's user avatar
10 votes
Accepted

Can I use ListDeconvolve or any other functions to get the original kernel?

In this case, the following works just fine: LeastSquares[ Transpose@Through[{RotateLeft, Identity, RotateRight}[data1]], conv ] {0.333333, 0.333333, 0....
Henrik Schumacher's user avatar
9 votes
Accepted

Dilation on 3D Images?

Unfortunately, MXNet does not support 3D convolutions with dilations yet. This can be seen in the MXNet source for convolution.
Sebastian's user avatar
  • 3,479
9 votes
Accepted

How does `DirichletConvolve` relate to Dirichlet convolution?

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 ...
A.Z.'s user avatar
  • 580
8 votes
Accepted

Incorrect evaluation of a convolution

That does not explain why your solution does not work (I'm pretty sure it is because of your definition of stripe), but if you replace ...
anderstood's user avatar
  • 14.3k
8 votes
Accepted

Analog of MATLAB's conv2 in Mathematica?

Not sure if I've guessed definition of conv2 accurately, but the following does reproduce the output of MATLAB. (Tested in Octave. ) ...
xzczd's user avatar
  • 66.8k
8 votes

Why does ImageDeconvolve not restore this image?

The answer is that you are asking too much of deconvolution. The following code shows images blurred and refocused with different degrees of blurring. ...
mikado's user avatar
  • 16.8k
7 votes

Convolution of Gaussian and Lorentzian functions

It seems, that MMA can't do that integral analytically (working with Version 8.0). Also Convolvedidn't do the job. Do it numerically. By the way, don't use ...
Akku14's user avatar
  • 17.3k
7 votes
Accepted

NetEncoder for images of "Varying" dimension?

Automatic is not the same as "Varying". Example 1 This works: ...
Alexey Golyshev's user avatar
7 votes
Accepted

Rewrite the power sum in terms of convolution

Let's focus on the part that is giving you trouble: the term $\sum_{k=0}^{m-1}k^t(m-k)^t$, which is written in code as: Sum[k^t (m - k)^t, {k, 0, m - 1}] For ...
bill s's user avatar
  • 69.1k
7 votes

Does Mathematica reuse previous computations?

It's hard to know for sure, but one way to test for caching is to apply a single command to lots of data sets, or to apply the command separately to each set. For instance: ...
bill s's user avatar
  • 69.1k
7 votes

Switch Function Is Not Working Properly

...
Bob Hanlon's user avatar
  • 159k
7 votes
Accepted

Speeding a Manipulate illustrating convolution

As pointed by Nasser in comment above, Convolve is having difficulty in handling certain combination of f and ...
xzczd's user avatar
  • 66.8k
6 votes

Why is DiscreteConvolve incorrect?

This is a bug in DiscreteConvolve[]. The bug is caused by a missing condition (m>=0) in one term of the answer returned by <...
Devendra Kapadia's user avatar
6 votes
Accepted

Using Convolve and Manipulate

First, you need to define the convolution of the two functions. Then plot it: ...
bill s's user avatar
  • 69.1k
6 votes
Accepted

Density of two independent uniform random variables in Mathematica

...
MarcoB's user avatar
  • 67.3k
6 votes
Accepted

Symbolic Evaluation of Convolve Between DiracDeltas Where the Variable Appears In a Sqrt

To evaluate the convolution you need the transformation rule ( see wikipedia ) ...
Ulrich Neumann's user avatar
5 votes

Incorrect evaluation of a convolution

With x and d not numeric: If[EvenQ[Quotient[x, d]], 1, 0] (* 0 *) The essential ...
John Doty's user avatar
  • 13.7k
5 votes

Speedup ListCorrelation when using generalized correlation function

... 3 years later at least for 2D problems: ImageCorrelate[pData//Image, krData, CosineDistance]//ImageData
Robert Nowak's user avatar
5 votes
Accepted

Coefficients of Knuth's "Convolution Polynomials"

As Michael notes, deleting the stray brackets will make it work. A better method, however, would be to use SolveAlways[]: ...
5 votes

Can I use ListDeconvolve or any other functions to get the original kernel?

This is a bit roundabout but one can treat this as a polynomial algebra problem. First pad both ends of data and convolution result with zeros so that the convolution emulates polynomial ...
Daniel Lichtblau's user avatar
5 votes

Convolution and cross-correlation of two discrete signals

Define a Gaussian kernel. The width is specified by s kernel = #2 Exp[-(t - #1)^2/(2 s^2)] &; Define a function to compute ...
mikado's user avatar
  • 16.8k
5 votes

How do I implement convolution integrals symbolically (not numerically)?

On second thought, I don't think your approach to calculating the convolution is mathematically sound. The Wiki page, and the MathWorld page it references, both state that "the integral of a ...
MarcoB's user avatar
  • 67.3k
4 votes
Accepted

Multiple discrete RV convolutions performance

Probability generating functions might be the way to go. Here's the pgf (probability generating function) of a single random variable: ...
JimB's user avatar
  • 41.8k
4 votes
Accepted

single slit diffraction numerical simulation

I believe that the problem is the Nyquist limit. You are representing the slit as sampled array of zeros and ones. The bandwidth of the edge is infinite so at any sample interval you will be ...
mikado's user avatar
  • 16.8k
4 votes

The curious case of Convolve function

I don't know why Mathematica returns the incorrect result, but it may be helpful to have the correct result so as to find the origin of the bug. To find the correct result, one may generate the first ...
AccidentalFourierTransform's user avatar
4 votes
Accepted

ListConvolve returns only one value

You need to tell ListConvolve how to handle "end conditions". Since your sequences are about the same length, everything is an end condition. Hence: ...
bill s's user avatar
  • 69.1k
4 votes
Accepted

Convolution with modified indices

How about k = Table[Subscript[a, j] , {j, 5}]; l = Table[Subscript[b, 1 + Abs[j]] , {j, -4, 4}]; ListCorrelate[k, l] // Reverse // Column
Simon Woods's user avatar
4 votes

Infinite long sequence convolution error

When using 2 instead of b, Mathematica can use the fact that 2>0. So, you can get the simplification you want by adding the ...
Carl Woll's user avatar
  • 131k
4 votes

Can I use ListDeconvolve or any other functions to get the original kernel?

To approximate ker using ListDeconvolve, use data1 as the kernel. Increasing ...
Bob Hanlon's user avatar
  • 159k

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