8
u/a5myth Oct 14 '19
You know how we have two main types of graphic programs, raster (pixel) and vector (lines with addresses and directions, etc), would it be possible to create a graphics program that uses fourier series calculations instead?
3
u/vaiv101 Oct 14 '19
hmm .. can be tried, but I can not say for sure if it is possible or already done by someone
3
u/5Beans6 Oct 15 '19
Probably would be really slow and impractical for anything useful
2
u/justingolden21 Oct 15 '19
Definitely. Vectors are waaaaay less math. There's no point other than educational in representing data like this. Don't get me wrong Fourier transforms are useful for lots of real world stuff, just not this
6
u/augle Oct 14 '19
Pretty cool. Where can I find more info on this, or can you briefly explain how that was done?
13
u/vaiv101 Oct 14 '19
For now, you can have a look at this video for reference, i am going to upload the coad on github soon..
6
u/Ketta Oct 14 '19
Your typo made me think of a coding toad and that is awesome.
1
1
u/vaiv101 Oct 15 '19
The code for the above video is here, https://github.com/VaibhavSingh24/python-fourier-transform-images
4
Oct 14 '19
is it possible to inverse the circle order? Big one spinning around?
10
u/glacierre2 Oct 14 '19
Yes it is, but instead of a pleasant "clock-like"video you would get a shaky bunch of circles.
0
Oct 14 '19 edited Oct 14 '19
Thats not how the fourier series works, so no (afaik) edit:im wrong
10
u/wewbull Oct 14 '19
Fourier series are a sum of frequencies. Addition is transitive, so yes /u/32BitLongSucks, the order could be anything. It's just that having the highest frequency at the centre would make the whole thing spin very fast.
1
Oct 14 '19
so the order isn't amplitude it's frequency, makes sense! Mixing the elements could create some fun effects, but putting the highest frequency first seems like guaranteed chaos - could be fun, probably isn't.
-6
u/vaiv101 Oct 14 '19
Nope, this is not possible, for a better explanation of this, you can read about Fourier transformation
6
Oct 14 '19
i figured the fourier series is just a sum so the order of the elements shouldn't be important
-5
u/vaiv101 Oct 14 '19
I believe you have some doubts, have a look at this video https://youtu.be/r6sGWTCMz2k
4
u/Meowkit Oct 14 '19
I believe you don’t understand what you are linking to.
Summation is commutative, adding the circles can be done in any order, thus the circles could be displayed/linked in any order.
429
u/w8cycle Oct 14 '19
Looks like a "furrier" transformation 😉
14
60
58
u/nielsrolf Oct 14 '19
You need help understanding the complex Fourier Transform? Ask OP. Need some support with Python? OP knows. Improve your data visualization skills? OP is your guy. Take a screen video? Hm that's hard
0
74
u/__unavailable__ Oct 14 '19
That's a surprisingly intuitive way of depicting fourier series.
9
u/Helicon_Amateur Oct 14 '19
Can you elaborate?
89
Oct 14 '19
"Hey, what's a fourier transform?"
Option 1: Present a bunch of equations
Option 2: The Fourier transform (FT) decomposes a function of time (a signal) into its constituent frequencies. This is similar to the way a musical chord can be expressed in terms of the volumes and frequencies of its constituent notes. The term Fourier transform refers to both the frequency domain representation and the mathematical operation that associates the frequency domain representation to a function of time. The Fourier transform of a function of time is itself a complex-valued function of frequency, whose magnitude (modulus) represents the amount of that frequency present in the original function, and whose argument is the phase offset of the basic sinusoid in that frequency. The Fourier transform is not limited to functions of time, but the domain of the original function is commonly referred to as the time domain. There is also an inverse Fourier transform that mathematically synthesizes the original function from its frequency domain representation.
Option 3: Here's a spirograph drawing a dog
3
u/PM_ME_VINTAGE_30S Oct 14 '19
I'll take option 2 for $500. No but seriously, I'm saving this. I'm in diff EQ and I think I'll be learning this formally in about a month. 👍Ofc I'm an electrical engineering major and I intend to specialize in DSP so Fourier transforms will be life.
0
Oct 14 '19
[deleted]
24
u/ForgottenWatchtower Oct 14 '19
Nothing is stopping you. Plenty of info freely available on the web. 3b1b is a great YT channel to refresh/learn many mathematical fundamentals, including Fourier transforms.
8
u/waxen_earbuds Oct 14 '19
If you want to understand it at the level of the person you are replying to, you are better off studying applied math.
16
2
Oct 14 '19
You should look into DSP. It's not just an engineering problem - Carl Friedrich Gauss apparently made bank on the stock market using signal processing techniques.
1
Oct 15 '19
It's called technical analysis. There's a python binding for the TA-lib. But it's a good way to go broke because everyone else is also doing TA on stocks and they'll beat you to it.
6
u/potatochemist Oct 14 '19
Essentially, if you add up the right combination of sine waves with different heights and speeds, you can recreate any function/graph/picture.
3
u/Helicon_Amateur Oct 14 '19
Okay. Now I get it and feel really stupid for not thinking of it that way. I understand what an FFT does but didn't relate it to this picture.
So each frame of this drawing should then consist of a peice of a signal, say there is this really long signal in the time domain - then stepping over a finite chunk of that signal would produce this graph, is that correct?
4
u/potatochemist Oct 14 '19
The "signal" is the shape of the dog. However instead of volume over time (like a microphone), it's x-y pairs over time where each pair is a point somewhere on the dog.
They then take the FFT of this to get the size and speed (magnitude and frequency) of the sin waves shown by the circles.
Here's a gif of the same thing with a time signal (like volume).
Here's a really good video if you want to get a bit deeper.
3
5
u/AnythingApplied Oct 14 '19
One thing to be careful of is that this fourier transform isn't just based on the shape, but more specifically the shape and speed of drawing. If the pencil is drawing at a constant distance per unit time vs constant angle from the origin vs any other speed arrangement, you'll get a different fourier series.
0
Oct 14 '19
[deleted]
4
Oct 14 '19
Could you prove that intuitively for a layman?
12
u/waxen_earbuds Oct 15 '19 edited Oct 15 '19
Consider the following approximate, ad hoc statement of Fourier’s theorem: any periodic signal may be represented as an infinite sum of simple harmonics. Well, okay, that’s great and all, but how does this apply here? The key is that op’s dog here is a closed path through the complex plane. In other words, given some amount of time that it would take to trace that path, given some parametrization, you have a notion of fundamental frequency. The component of the “dog signal” (DS) that is captured by that fundamental is encoded in magnitude (the radius) and phase (the starting angle) of the first line segment. As we discussed, the speed is encoded by the frequency that you define. This is a symmetry of a path representation of a complex signal, so you could think of there as being infinitely many possible “fundamental frequencies”. That center line segment traces a circle, which you could think of as a very crude approximation of the DS. Recalling the visual intuition for 2D vector/complex addition, if we added a complex number to this first fundamental signal, it would effectively extend the path in whatever direction our second segment was pointing by whatever its magnitude is. The second such segment would proceed at twice the speed of the fundamental, third thrice, ad infinitum, with each step providing a bit more clarity. We do this in harmonics of the fundamental frequency, since only integer multiples of the fundamental can be periodic with respect to the base signal. But thanks to Mr. Fourier, we know that is all we need. Just infinitely many.
In mathematical terms, you can think of the first circle as being some horizontal component Acos(wt+φ) and a vertical component Asin(wt+φ) for some amplitude A, phase offset φ, and fundamental frequency w=2pi/T, where T is the amount of time it takes to traverse the path. Should you choose to represent this as a complex number, using Euler’s identity, we have Aexp(i(wt + φ)). Since we have established that the amplitude and phase are unique for each constituent integer multiple of the fundamental frequency, we can represent this in general for the k’th such frequency as A_k exp(i(kwt + φ_k)). To sum this all the way to the number of circles at our disposal, we can represent our complex signal z parametrized by time as
$ z(t) \approx \sum_{k=1}N A_k e{i(k\omega t + \phi_k)} $
This is the statement of the discrete, complex Fourier series for a zero-offset path. There is much more to be said here, but I will refer you to Wikipedia or 3b1b for further elaboration.
Hope that helps!
3
u/DatBoi_BP Oct 15 '19
They more generally mean Fourier Transform. Anyway, the x–axis is real, y–axis is imaginary. Fourier Transform takes the "signal" (in this case, the set of points discretely outlining this animal) and essentially decomposes it into a bunch of amplitudes and phase angles (complex numbers' magnitudes and arguments, respectively) for a set of frequencies that depends on the sampling rate. These directly correspond to the circles we see—radius = amplitude; initial direction of line = phase angle; rate of change of line direction = frequency. Center the next circle on the end of the line of the current circle, and once you get to the last circle line, plot that point as it changes over time. That recreates the image
24
1
u/vaiv101 Oct 15 '19
The code for the above video is here, https://github.com/VaibhavSingh24/python-fourier-transform-images
If you want a proper explanation, I can make a video over it. Please tell me if I should
1
1
4
u/log_2 Oct 14 '19
This doesn't look right. There are moments when the biggest circle speeds up. All circles should be rotating at a constant speed, because changing speed changes frequency and each circle is meant to represent one constant frequency.
2
u/kkingsbe Oct 15 '19
I'm pretty sure it just runs faster with certain calculations, which means that the "frame rate" is slowing, but they are all moving at the same speed relative to each other. I ran this same issue with a rocket simulation that I am writing in C++
1
u/Thisnametakenffs Oct 14 '19
They are all spinning at the same constant rate. It only appears to move fast because in order to draw a long line many circles must spin together in the same direction.
2
2
1
1
1
1
1
1
1
1
1
1
1
1
u/Ulriklm Oct 15 '19
Wow this is awesome!! How do I learn python from the bottom, can anyone recommend a book. I've programmed a bit in Java.
1
0
0
0
0
0
Oct 14 '19
[deleted]
42
u/MisterBlggs gitlab.com/MisterBiggs Oct 14 '19
Or even Google "how to export matplotlib as video". In the end the video is still easy enough to understand so I guess the post served it's purpose🤷♂️
50
u/GetOnMyLevelL Oct 14 '19
Yes or taking a picture instead of printscreen
49
u/locoluis Oct 14 '19
Or making a Python program that outputs this as a video…
42
u/raybrignsx Oct 14 '19
Or beaming this animation straight into my mind.
78
0
u/billsil Oct 15 '19
GIFs are better. They're smoother and the quality is quite good when you have a limited color palate, which seems to be anything that's not real life.
4
u/ivosaurus pip'ing it up Oct 15 '19
A proper video codec is infinitely better than any gif.
1
u/billsil Oct 15 '19
Depends what you’re trying to do with it. If you’re putting it in a PowerPoint, I’ll take the GIF. For YouTube, yes.
1
u/ivosaurus pip'ing it up Oct 21 '19
If you're using PowerPoint from a version less than a decade old, it can handle mp4 natively.
1
u/billsil Oct 21 '19
It’s more trying to get an acceptable quality and making it loop indefinitely that I like. There might be a setting for mp4. I also don’t want to hit the play button during a presentation.
Additionally, you can overlay them because there is a transparency layer unlike a video frame.
0
-20
u/ship0f Oct 14 '19
It's because people who do this kind of stuff are mathematicians or physicist. Not IT peolpe.
12
u/scarfarce Oct 14 '19
But doing a screen recording is not rocket science.
Oh wait now I get it. It's not rocket science, so rocket scientists can't actually do it ;)
-21
u/Upvoteme12345 Oct 14 '19
What could you possibly be losing from the small difference between a screen recording and phone recording that’s a few seconds long
12
u/masteryod Oct 14 '19
What could you possibly be losing
Quality
-8
u/Upvoteme12345 Oct 15 '19 edited Oct 15 '19
It’s a reddit post for r/python lmfao the quality really isn’t that serious. You can clearly see what’s happening. Relax.
2
u/--o Oct 15 '19
It’s a reddit post for r/python lmfao people suggesting screen recording is easy aren't monsters. You don't need to go on a crusade about the virtues of filming screens. Relax.
1
u/javier123454321 Oct 15 '19
If you dont have a screen recording software and you just got this awesomely useless program to run, I totally get the impulse to just record it the way you know how and put it out.
-1
29
u/Todask Oct 14 '19
Is this code published?