All Types of Fourier Transforms in PYTHON

Поділитися
Вставка
  • Опубліковано 4 жов 2024
  • Check out my course on UDEMY: learn the skills you need for coding in STEM:
    www.udemy.com/...
    In this video I delve into the libraries of sympy and scipy to take a look at Fourier analysis in python. I look specifically at 1. Fourier Transforms, 2. Fourier Series, and 3. The Discrete Fourier Transform. Some of these transforms involve integrals that can be evaluated analytically (i.e. integrals can be solved symbolically using sympy) while other transforms involve integrals don't have analytic solutions: numerical solutions can be obtained for such integrals using scipy.
    Fourier Transforms show up in fields such as quantum mechanics when one wishes to convert a wavefunction in a position basis to a momentum basis. If the analytical form of the wavefunction is known, this transition is seamless using scipy or sympy. Fourier series can often show up in the study of partial differential equations. Finally, the discrete Fourier transform is a useful tool in data analysis to obtain a spectral density estimator for a given time series, for example.
    Link to code
    github.com/luk...
    Discord Server
    / discord
    2:46 1 .Fourier Transforms (Function Domain Unbounded)
    8:35 2. Fourier Series (Function Domain Bounded)
    15:05 3. Discrete Fourier Transform (Function Discretely Measured)

КОМЕНТАРІ • 75

  • @lucaspaes3821
    @lucaspaes3821 3 роки тому +47

    One of the best channels on youtube right now, congrats great content dude.

  • @Seriosso
    @Seriosso 2 роки тому +11

    Man! Where the hell have you been hiding from my recommendation list all this time? I have been looking for someone that would do EXACTLY your content for like ages! Thank you for all the time and effort to remove the fog from my eyes!

  • @RhoChalmers
    @RhoChalmers 2 роки тому +1

    Thank you. Have shared this video in our college Discord because our professor doesn't really explain things that well.

  • @frednalyanya4015
    @frednalyanya4015 8 місяців тому +1

    I wish I found out about this channel two years ago! It is not late though. Great work boss!

  • @wilsoncarofilis7595
    @wilsoncarofilis7595 2 роки тому +1

    Thanks for this video, I was struggling with my assignment, almost give up but here found a way to solve it! Very appreciated bro!

  • @frankkoslowski6917
    @frankkoslowski6917 Рік тому +3

    Not sure if the persistent integration issues with the upper integral limit `T' has to do with the many improvements to SymPy 1.11.1.
    However, after lengthy consideration, here is the code that actually returns `x_FT` quickly and correctly without kernel crashes:
    x_FT = sp.integrate(1/T * x*sp.exp(-2*sp.pi *sp.I *fn*t), (t, 0, sp.oo)).simplify() 🤓 Love your lectures. 😍

  • @krupamaypanda8177
    @krupamaypanda8177 5 місяців тому

    He he he, love this channel even more! Some contents from this video were really helpful (been looking for these explanations from months, but found it here). Your channel is one of the reasons why I love scientific computing in python...Thanks a looooot

  • @abcd-gp6is
    @abcd-gp6is 3 роки тому +1

    I have Fourier transform this sem, thank you for understanding my heart 😉💜
    I'm gonna comment again after watching and doing it....

  • @JeanDAVID
    @JeanDAVID Рік тому +1

    Nov 2022 : to correct exception when reading image 24:49
    im_array = io.imread('flower.png')
    img = color.rgb2gray(color.rgba2rgb(im_array))

  • @jx4864
    @jx4864 2 роки тому +1

    That rap is sick, man, keep on it.

  • @aqueeqazam
    @aqueeqazam 3 роки тому

    You are unbelievable programmer.

  • @tactusxii
    @tactusxii 10 місяців тому

    @24:29 nyquist frequency: 1/(2*dt), I thought is was supposed to be (1/2)*dt ?

  • @rostamr4096
    @rostamr4096 8 місяців тому

    Thank you for these detail and very helpful videos

  • @Nobuhara
    @Nobuhara 3 роки тому +2

    Are you planning on making a video about ipywidgets? After watching most of them I'm seriously considering getting [sympy + ipywidgets + numpy + numba + jupyter] as a free Mathematica-like environment.
    Also, please, keep posting videos! They are very good and in time you will be in the 1M+ subs range!

  • @amithkumars562
    @amithkumars562 3 роки тому +1

    highly underrated!!

  • @minma02262
    @minma02262 3 роки тому

    Definitely liking this for the rap in the beginning.

  • @user-dv8id8vd7g
    @user-dv8id8vd7g Рік тому +2

    Hi Mr Solver, thanks for your great effort to put this boring theory into interesting and visual python coding.
    I tried out your codes everthing works except #2 Fourier Series (continuous time, discrete frequency). Your suggested solution is much appreciated

    • @reapicus557
      @reapicus557 10 місяців тому +1

      After messing around with things a little bit I have found that the following works:
      a = smp.symbols('a', real = False)
      x_FT = smp.integrate((1/T) * x *smp.exp(-a*t), (t,0,T)).subs([(a, 2*smp.pi*smp.I*fn)]).simplify()
      This makes a symbolic answer that looks different than the video, but reproduces the same numeric results, so it should be fine! :^)

    • @user-dv8id8vd7g
      @user-dv8id8vd7g 10 місяців тому

      @@reapicus557 Thank you, your solution works!

  • @scoot_tv
    @scoot_tv 2 роки тому +1

    It'd be awesome if you could cover Gabor analysis or other time-frequency analysis methods.

  • @DrJessicaGrogan
    @DrJessicaGrogan Рік тому

    I subscribed before the singing, happy I subscribed. LOL awesome vid

  • @chiragsharma5624
    @chiragsharma5624 3 місяці тому +1

    try solving mit intigration bee problem in python

  • @ilredeldeserto
    @ilredeldeserto 2 роки тому

    my thanks for this video, you saved me and my exam too! lol

  • @rezhar3640
    @rezhar3640 Рік тому +1

    How about fractional fourier transform? Can you explain it?

  • @ravenecho2410
    @ravenecho2410 Рік тому

    u bait me with the memes... and now im in image Fourier, pretty cool

  • @toobabb3613
    @toobabb3613 2 роки тому

    Hey Thankyou so much. Its too helpful. Stay blessed!

  • @nehakhanra9853
    @nehakhanra9853 Рік тому +2

    Awesome lecture ever. Hello sir, can you make a tutorial on Fourier series of a triangular waveform?🙏🙏

  • @neilbohar8212
    @neilbohar8212 3 роки тому

    Plz share inverse fourrier transform system video too

  • @brisingreye5209
    @brisingreye5209 6 місяців тому

    nice video! I ran into two problems:
    1) I can not seem to load an image that is located in another folder. How can I tell the program to search for it?
    2) When I do add it to the folder python expects it to be, i get the following error:
    ''ValueError: the input array must have size 3 along `channel_axis`, got (571, 564, 4)''
    How can you resolve this problem?

  • @rubenvicente4677
    @rubenvicente4677 8 місяців тому

    it is imposible to flow now if you do not have the version of your module (pip freeze) :(

  • @SarthakGamer
    @SarthakGamer 3 роки тому

    Another amazing video

  • @reapicus557
    @reapicus557 10 місяців тому

    If anyone is having trouble getting a symbolic result in the Part 2 section without a kernel crash, then try adding the following 'a' symbol:
    a = smp.symbols('a', real = False)
    x_FT = smp.integrate((1/T) * x *smp.exp(-a*t), (t,0,T)).subs([(a, 2*smp.pi*smp.I*fn)]).simplify()
    This gave me something that looks different from the video's symbolic form, but it reproduces the numeric plot, so I'm happy with it!

  • @vaibhavgarg1982
    @vaibhavgarg1982 2 роки тому

    Hey, Discovered your channel and have been hooked since. Just a small request. Would you mind zooming in just a little bit. The text is hard to read even at the highest res of 1080p.
    Thanks.

  • @baghdadiabdellatif1581
    @baghdadiabdellatif1581 10 місяців тому

    Great work 👌👏👍

  • @mro5858
    @mro5858 3 роки тому

    Very nice videos! Thank you so much.

  • @lucapalese475
    @lucapalese475 Рік тому

    DFT formulas are a bit messed up. Useful vid :)

  • @MM-vw1ck
    @MM-vw1ck 3 роки тому

    3 weeks too late for me, but thank you for this vid

  • @Karim3ds
    @Karim3ds 2 роки тому

    hi, thank you so much for your informative videos, is it possible to do a video for solving the image MTF using py, thanks alot

  • @rrr33ppp000
    @rrr33ppp000 3 роки тому +1

    Great work as always! Have you ever checked Steve Brunton's channel? He has some nice videos on this topic and many other data-driven techniques. Highly recommended

  • @Mayank-mf7xr
    @Mayank-mf7xr Рік тому

    Great content.

  • @frankkoslowski6917
    @frankkoslowski6917 2 роки тому

    Great Lecture!
    Although as the frequency goes up, the sampling rate ought to be sufficiently INCREASED for good analog audio to be retrieved from a file with data recorded at, let's say 320bps,
    so as to avoid aliasing as alluded to in cell 39. Should it not?

    • @Zorzek
      @Zorzek 2 роки тому +2

      Yes, he probably meant to say that "dt" should be small enough (and not sampling rate), which inversely means that sampling rate should be high enough. Just an honest mistake on his part.

    • @frankkoslowski6917
      @frankkoslowski6917 Рік тому

      @@Zorzek Speaking of honest mistakes, I took the liberty to re-write one of the formulas in 2.Fourier Series (`Continuous time, Discrete Frequency`):
      $$\displaystyle\color{blue}{\hat x(f_n) = \frac{1}{T}\int_0^T x(t)e^{-2\pi i (f_n)(t)} dt}$$
      because this is what we are actually doing in the code that expresses it.

  • @羊要吃草
    @羊要吃草 10 місяців тому

    Thank you!

  • @HH-mw4sq
    @HH-mw4sq 2 роки тому

    I keep getting the following error:
    "x_FT_integrand_real = lambda t: np.real(x(t, k)*np.exp(-2.0*np.pi*1j*f*t))
    TypeError: 'Mul' object is not callable"
    Why is this occurring, and how to get around it?

  • @gaspi91
    @gaspi91 2 місяці тому

    Great video, honesty could listen for few hours about 2D transformation. Is not that easy to find good sources about this topic.

  • @rostamr4096
    @rostamr4096 8 місяців тому

    What is the editero you are using?

  • @ferrusmannus6784
    @ferrusmannus6784 Рік тому

    D ear Mr. P Solver, can you tell us how to make spectral derivative in Python?

  • @tilkesh
    @tilkesh Рік тому

    Thank you.

  • @bean_mhm
    @bean_mhm Рік тому

    Great video

  • @kkantse9351
    @kkantse9351 3 роки тому

    Great and hansome!

  • @Jinn-e8h
    @Jinn-e8h 8 місяців тому

    ur a true god

  • @eschool8812
    @eschool8812 8 місяців тому

    Hi, I have a discrete voltage and current signal in time domain, what will be the formula to calculate the power using both voltage and current waveform in FFT method, it will be sum of the Individual powers in frequency domain or if you can put some insights or share your mail I can send you a email stating the exact problem. Thanks for the video.

  • @toobabb3613
    @toobabb3613 2 роки тому

    I want to fourier transform position wavefuntion to momentum for infinite square well and plot it. I am following this video where you transformed time to frequency. But in my case p (momentum) equals (iota)*(planck constant)*(partial by partial x). I am not sure hoew to define this. If you have sample of position to momentum fourier transform o anything to help, kindly tell me. Regards

  • @حيدرالعبيدي-ج4د
    @حيدرالعبيدي-ج4د 3 роки тому

    How can study Fe(Phen) using monte carlo simulation in python program-ising model 2D .. please

  • @taybabusra1695
    @taybabusra1695 3 роки тому

    Make video on epicycle
    And converting any image to epicycle drawing

  • @iitian1201
    @iitian1201 3 роки тому

    Please simulate random walk probably by python 🙏🙏🙏🙏

  • @PhysicsKeeda_99
    @PhysicsKeeda_99 2 роки тому

    hey its great can you please help me in the code for how to fourier transform a signal which i have already plotted in python itself

  • @brianlivian3149
    @brianlivian3149 2 роки тому

    Great video thanks

  • @kusy
    @kusy 3 роки тому

    5:58 If I use smp.exp instead of np.exp in def x, then the quad will fail.

  • @sittiparkkaewka7647
    @sittiparkkaewka7647 3 роки тому

    WOW. Nice Video!! 💙

  • @eyal4
    @eyal4 3 роки тому

    thank you very much !

  • @sunilkumar-xp7jz
    @sunilkumar-xp7jz 17 днів тому

    Awesome, 👍👍

  • @RutikKeer
    @RutikKeer 8 місяців тому

    which software is this..?

  • @ryanjosephtatel1330
    @ryanjosephtatel1330 2 роки тому

    This is where repp'n and math collide

  • @leonardosaads
    @leonardosaads 2 роки тому

    Where is dtft?

  • @cherryslab3034
    @cherryslab3034 3 роки тому +1

    Noise

  • @kelixoderamirez
    @kelixoderamirez 2 роки тому

    permission to learn sir

  • @حيدرالعبيدي-ج4د
    @حيدرالعبيدي-ج4د 3 роки тому

    Hello..I am a PhD student in physics from Iraq..I hope you can help me find codes in the Python program to study the Fe(II)particle (ising model 2D)to determine the spin crossover of the electrons and find the energy..with many thanks to you.

  • @AJ-et3vf
    @AJ-et3vf 3 роки тому

    ❤️❤️❤️❤️❤️

  • @KrishnaGupta-pn8ee
    @KrishnaGupta-pn8ee Рік тому

    Video quality is worst.. Can't see what's types

  • @et4493
    @et4493 2 роки тому

    What about amplitude and phase? And what about an entire spectrum of frequencies, instead of a basic ass sin function? This is so generic and superficial might as well just read the instructions on the np sp manuals SMH

  • @frankkoslowski6917
    @frankkoslowski6917 Рік тому

    I don't know what kind of magic you used to get a symbolic answer for:
    x_FT = sp.integrate(1/T * x*sp.exp(-2*sp.pi *sp.I *fn*t), (t, 0, T)).simplify()
    because the Kernel in Jupyter simply dies. 😓
    Here are the errors that were eventually generated in PyCharm using an alternate installation of Python:
    File "C:\Users
    b_se\AppData\Local\Programs\Python\Python38\lib\site-packages\sympy\integrals\integrals.py", line 1084, in _eval_integral
    h = heurisch_wrapper(g, x, hints=[])
    File "C:\Users
    b_se\AppData\Local\Programs\Python\Python38\lib\site-packages\sympy\integrals\heurisch.py", line 158, in heurisch_wrapper
    slns += solve([d], dict=True, exclude=(x,))
    File "C:\Users
    b_se\AppData\Local\Programs\Python\Python38\lib\site-packages\sympy\solvers\solvers.py", line 1114, in solve
    solution = _solve_system(f, symbols, **flags)

  • @frankkoslowski6917
    @frankkoslowski6917 2 роки тому

    Doesn't look much like a simplification to me. Which ever way, one always gets this:
    $\frac{1 - e^{- T k - 2 i \pi n}}{T k + 2 i \pi n}$