But what is a convolution?

3Blue1Brown · 3.8M views · 2022 · 23:01

Open on YouTube

Information theory & signal processingMath & theory (other)Recreational & visual mathexplainer

Why Mathematics Stack Exchange recommends it

Mathematics Stack Exchange users link it when asking or answering what convolution intuitively means and why the FFT speeds it up.

Recommended by 3 people across 3 different months, 2022 to 2023.

Why Stack Overflow recommends it

Stack Overflow users link it when they need to explain convolutions and kernels for array, image and signal-processing questions, since it gives a clear visual intuition.

Recommended by 2 people across 2 different months, 2022 to 2024.

What it is

A 23-minute 3Blue1Brown explainer on discrete convolutions, showing how the same operation appears in probability (dice sums), moving averages, image processing and polynomial multiplication. It then connects convolutions to the fast Fourier transform as a way to compute them faster than the direct O(N^2) method.

What people said

Strong rec Jelle Westra · 2023-01 · Stack Overflow · on “How to make surrounding average and basic calculations based on numpy neighboring cells”

I think what you're looking for is what is known as a convolution. In a convolution on a matrix, a kernel (smaller matrix) is swept across the matrix. I can try to explain this but I rather suggest you watch this excellent video [this video] by 3blue1brown on the topic which gives you a good visual understanding of convolutions. For example for giving a 70% weight for the 8 surrounding cells and 30% for 12 around those, you could use a kernel like this: import numpy as np from scipy.signal import convolve2d np.random.seed(3141) A = np.random.uniform(size=(10,10)) k = np.array([ [.3, .3, .3, .3, .3], [.3, .7, .7, .7, .3], [.3, .7, .0, .7, .3], [.3, .7, .7, .7, .3], [.3, .3, .3, .3, .3] ]) # normal

Recommends MeltedStatementRecognizing · 2022-12 · Mathematics Stack Exchange · on “Using FFT to calculate Convolutions -- Why it would be faster”

In this video( [this video] ) it states you can use polynomial multiplication to find the convolution. The box method is metaphorical to convolution for multiplying the coefficients of the polynomial. So what can be done is you can take the two input lists and pretend they are the coefficients of polynomials. Then you can input arbitrary x-values into those polynomials and multiply the output to get a product. Then once you have enough points( $N$ of them), you can solve for the coefficients. The big-O notation for this is $N^2$ , because you have $N$ required outputs and $N$ terms in each product. The video states that Fast Fourier Transform(FFT) can be used do this faster. You can take the x-va

Recommends MeltedStatementRecognizing · 2022-12 · Mathematics Stack Exchange · on “Intuition behind polynomial multiplication”

Polynomials are functions. But what are functions? Functions are where, if you input one number, you get a different number. Consider your example, $(x^3 + 2x^2 +1)(4x^2 + 2)$ . Here, we can use the distributive property, which is used for sums of numbers. But remember, polynomials are made of power functions, so polynomials are sums of numbers. $$(x^3 + 2x^2 + 1)(4x^2) + (x^3 + 2x^2 + 1)(2)$$ Then, since multiplication is communitive, we can do $$((x^3)(4x^2) + (2x^2)(4x^2) + 1(4x^2)) + ((x^3)(2) + (2x^2)(2) + 1(2))$$ Which is what polynomial multiplication is. You make a very interesting connection between polynomial multiplication and convolutions. In fact, some Python libraries use polyn

Recommends D Ford · 2023-01 · Mathematics Stack Exchange · on “Why is convolution in the time domain equal to multiplication in the frequency domain? (intuitively, not mathematically)”

This isn’t a complete answer to your question, but in the discrete case, this video gives some really nice intuition for what convolution is (and what it has to do with time vs frequency etc) [this video]

Recommends Mushu Nrek · 2023-02 · Mathematics Stack Exchange · on “What is the practical reason in defining a convolution by different indeces”

I don't know whether that helps, but there is a beautiful video of 3b1b taking a deep dive on exactly this question. You can find it (here)[ [this video] ].

Recommends Marco Bonelli · 2023-10 · Stack Overflow · on “Gaussian blur in C using SDL”

Watch this video by 3blue1brown at minute 8:30 and you might understand better what you need to do: [this video] - that kernel definitely needs to be normalized though.

Cites Cris · 2022-11 · Stack Overflow · on “Python rising/falling edge oscilloscope-like trigger”

So I was just watching the latest 3Blue1Brown video on convolution [this video] when I realized a new way of doing this: def rising_edge(data, thresh): sign = data >= thresh pos = np.where(np.convolve(sign, [1, -1]) == 1) return pos So, get all the positions where the data is larger or equal to the threshold, do a convolution over it with [1, -1] , and then just find where the convolution returns a 1 for a rising edge. Want a falling edge? Look for -1 instead. Pretty neat, if I do say so myself. And it's about 5-10% faster.

Cites stefan123t · 2023-01 · Mathematics Stack Exchange · on “Can these kolams/rangoli be drawn mathematically in any programming language?”

There is a research paper from Kiwamu Yanagisawa and Shijiro Nagata: "Fundamental Study on Design System of Kolam Pattern" e.g. here [LINK] YANAGISAWA, Kiwamu & NAGATA, Shojiro. (2007). Fundamental Study on Design System of Kolam Pattern. "Kolam" is a kind of string/knot pattern seen primarily in Tamilnadu state of South India, which has a very attractive system of pattern formation, that is to say, countless complicated Kolam patterns can be drawn following extremely simple elements and drawing rules. In this paper, the fundamental characteristic of Kolam patterns' designing system is considered by converting these patterns into numbers and linear diagrams. Further discussions on the drawin

Cites Alfie Stoppani · 2023-03 · Mathematics Stack Exchange · on “How do I find the probability distributions for multiple dice rolls for dice with a differing number of sides?”

I have been learning how to play Dungeons and Dragons recently, and have bought my first set of dice. The standard DnD dice are: 1d4 1d6 1d8 1d10 1d10 × 10 [10, 20, 30... 90, 100] 1d12 1d20 I was thinking about inventive ways to determine successes or failures as a DM, and I came up with the Super Roll ! A super roll is rolling all seven of the standard dice, and being asked to roll above a particular number. I think this limit should be constant when asked to make a super roll, but I need to determine what this limit should be. I therefore want to calculate the probability distribution so I can pick a limit with an appropriate chance of succeeding at a super roll. I could simulate this with

Cites jAdex · 2024-04 · Stack Overflow · on “Combining Tex and MObject in Manim”

Is there a way to combine MObjects and Tex Objects in one place with the same height/font size? I tried VGroup and setting manually the width, but that doesn't work due to different shapes of single letter (bounding box) Specifically, I am trying to do something like the attached image: [LINK] or this one: [LINK] The full video where I got these screenshots can be found here: [this video]