Solve Schrödinger Equation in Seconds with Python & GPU

  Рет қаралды 45,196

Mr. P Solver

Mr. P Solver

Күн бұрын

Пікірлер: 74
@baldpolnareff7224
@baldpolnareff7224 Жыл бұрын
This series on refactoring NumPy code to PyTorch is one of the best ideas ever, please never stop! Also, plotly is a wonderful plotting library
@Holeinone-v7n
@Holeinone-v7n 7 ай бұрын
best idea ever...agree
@bobnull
@bobnull Жыл бұрын
No way. I started working on this kind of thing after watching your last video. I'm gonna put this in my queue and watch when I can really focus.
@jobsmine
@jobsmine Жыл бұрын
Yesssss this is what I’m doing. One my classes final exam required deriving the greens function to the classical formals. I chose the diffusion 2D and solved it from scratch and I presented on Thursday.
@panagosu
@panagosu Жыл бұрын
Awesome vid dude. I am currently coding a simulator for the Shallow Water Equations using finite volumes, so I would love to see you tackle some CFD in python. Really curious about its performance.
@martinzapata7289
@martinzapata7289 Жыл бұрын
Yooo, I’ve been following the channel for a while and the content only gets better. Good shit.
@lhomme_flaneur
@lhomme_flaneur Жыл бұрын
ayo, keep posting these scientific computing videos, they are getting greater and greater btw :)
@astropgn
@astropgn Жыл бұрын
For years I've been wanting to plot the hydrogen atom orbitals and their potentials and I was never able to. Thank you so much, this video is awesome! I will definitely try it!
@richardbennett4365
@richardbennett4365 Жыл бұрын
What happened to him after 23:10? He was his normal teaching-by-ydlling, crancked-up on speed personality, but after this point he became Mr Sedate, calmed-down man. Too funny.
@MrPSolver
@MrPSolver Жыл бұрын
LOL recording crashed when I ran the GPU code, had to re-record the last 1/3rd if the video in the morning
@richardbennett4365
@richardbennett4365 Жыл бұрын
@@MrPSolver It's okay. I have my doctorate like you do, or will, so I understand your passion about your subject. I enjoy your videos. I majored in mathematics and physics in undergrad and went on to apply that quantitative background to the fields of biophysics, biochemistry ,and pharmacology. Keep making videos, and I hope to get mine up soon. I just hope I get some followers/subscribers and help people along the way. When I have my first few videos up, I'll let you know.
@Tim-Kaa
@Tim-Kaa Жыл бұрын
Thank you, I watched the whole Schrodinger's series, amazing work.
@HitAndMissLab
@HitAndMissLab Жыл бұрын
Its really phenomenal to get first hand insight into the way how a scientist thinks. Your knowledge of maths is impressive. Immediately subscribed 🙂
@AJ5
@AJ5 Жыл бұрын
I subscribed for this content, not the memes! Love the memes too, but this is invaluable and I appreciate you taking the time to put it together!!
@RalphDratman
@RalphDratman Жыл бұрын
So great to have a physicist teaching Python and computer topics. Thank you!
@fabiopimentel6981
@fabiopimentel6981 Жыл бұрын
This moment of the day is called happiness
@Ricocossa1
@Ricocossa1 Жыл бұрын
Very cool! I'm a physicist equipped with a nvidia gpu, and this looks like a fun project to pass time! You mentioned your research. What do you work on?
@ericmiller6281
@ericmiller6281 Жыл бұрын
Great set of videos. Can you please elaborate on how you handled the boundary conditions? It was not obvious from looking at the code while watching the video. Many thanks.
@TheFreeSpiritKID
@TheFreeSpiritKID Жыл бұрын
What a wonderful thing to watch after a few beers. And beautiful plots. Thx 🙂
@kevinchen8325
@kevinchen8325 Жыл бұрын
oh yeah, this is why i subscribed!
@joshuastewart7309
@joshuastewart7309 Жыл бұрын
Around the 19 minute mark you mention the reason to use such a large amount of spacing is because of Dirichlet boundaries (saying the wave function goes to zero). Shouldn't this be a Neumann boundary? Could you give some detail on that boundary condition.
@MrPSolver
@MrPSolver Жыл бұрын
From my understanding, if you look at the top left and bottom right entries of the diagonal matrix "D", you miss one the "1"s that come on either side of the main diagonal. So it's effectively equal to zero, meaning that when you compute the second derivative at those locations, it's equivalent to the wave function being equal to zero there.
@joshuastewart7309
@joshuastewart7309 Жыл бұрын
@@MrPSolver Are you saying the first and second derivative would be zero because the upper left and lower right are missing parts of the "stencil"? How are you getting to the conclusion that's equivalent to the wave function being equal to zero there? That sounds like a Neumann boundary to me because it involves a derivative normal to the boundary.
@MrPSolver
@MrPSolver Жыл бұрын
@@joshuastewart7309 The first and second derivatives aren't necessarily zero there. It's the fact that when you compute the second derivative at the edges, you're not including points that exist beyond the boundary (because the matrix D is cut-off at these points). That's mathematically equivalent to including points beyond the boundary, but having them be equal to 0
@shivasluzz
@shivasluzz Жыл бұрын
Thanks for your wonderful videos! A video about solving Navier stokes equation for a simple 2D incompressible flow will be great.
@esojle
@esojle Жыл бұрын
I think Lorena barba has a 7stepstonavierstokes class you can follow for that
@Miguel_Noether
@Miguel_Noether Жыл бұрын
what is the precision of the numerical results when working with the GPU? If you work with higher precision do the calculation become as slow as doing it with a CPU?
@J_CtheEngineer
@J_CtheEngineer Жыл бұрын
Mechanical Engineer here, I’m just here for the pretty plots!
@GustavoPinho89
@GustavoPinho89 Жыл бұрын
Hey, Billy. Could you do a video about the "new" scipy.sparse methods since they say in the documentation that such methods as kron, eye and diags are "deprecated". I really find the old way much simpler, but there aren't many tutorials going around. Cheers from Brazil
@skilz8098
@skilz8098 Жыл бұрын
This is quite an amazing video and presentation. Mad props on the time, work, and effort put into this video. To create a Python Script in solving the Schrodinger Equation is by no means an easy task. Job well done! As a side note: Now if one is truly after a higher precision while maintaining high efficiency and performance then I'd suggest doing something similar in either C or C++ as opposed to Python. Don't get me wrong, Python is a great and powerful language and it is a bit quicker in writing the source code since it is an interpreted language, however compared to C or C++ it is orders of magnitude computationally slower compared to compiled languages. Also, if one does decide to do something similar in C/C++ then I'd also suggest to using either DX12 if on Windows or the Vulkan Graphics API, even modern OpenGL wouldn't be a bad suggestion, however, Vulkan and DX12 are way more flexible with less driver overhead compared to older versions of DirectX, and OpenGL. The major difference here is that there would be more boilerplate code to setup, there is no hand-holding since there is always a greater amount of responsibility that comes with having more flexibility and direct control over the hardware.
@98danielray
@98danielray 7 ай бұрын
all of these libraries are precompiled C/fortran code. youre not losing multiple orders of magnitude from this, especially in hotspots. these wrappers have performance comparable to their lower level counterparts.
@vgmduarte
@vgmduarte Жыл бұрын
Very nice video! Interesting to see the analytical solutions of the Hydrogen atom popping out of a strictly numerical approach. It really helps you understand the problem even better, I think. I noticed you've been using vscode for a while now. Could you elaborate a bit on why you prefer to use it instead of native jupyter lab? Thanks a lot for the good work.
@BuciuEmilian
@BuciuEmilian Жыл бұрын
Does anybody know how can I setup VS Code so that I can rotate the figures like he does at 27:28?
@yds6268
@yds6268 Жыл бұрын
Very nice! I'll have to check out your code. I wish I could solve Schrodinger equation in 3D fast, especially for scattering problems
@martinzapata7289
@martinzapata7289 Жыл бұрын
Depending on how complicated your problems are, you might want to consider a diferent approach. You can make many symplifying assumptions with central potentials, etc
@voidwalker0x286
@voidwalker0x286 Жыл бұрын
How good of a GPU is required to do stuff like this? I doubt it but would an integrated GPU be able to do the job?
@ignatiolu863
@ignatiolu863 Жыл бұрын
How fast can the operation be f = A^{-1} b if f and b are vectors and A is a sparse matrix (say the same size as the Hydrogen eigen-matrix). And as always, thank you for your content!
@firasnizam
@firasnizam Жыл бұрын
Amazing, I like implementing physics math to graph
@drdca8263
@drdca8263 Жыл бұрын
So is D \oplus D here, the same as (I \otimes D) + (D \otimes I) (Where I is the NxN identity matrix) ? Edit: ah, 8:44 answers this in the affirmative.
@kevinsweeney2809
@kevinsweeney2809 Жыл бұрын
Thank you, your channel is amazing!!!!
@szilardfineascovasa6144
@szilardfineascovasa6144 Жыл бұрын
Where's Billy?!
@samirdevechi8589
@samirdevechi8589 Жыл бұрын
Billy misunderstood PyTorch as the process of 'torching' a pie, and has accidentally set his home on fire :(
@szilardfineascovasa6144
@szilardfineascovasa6144 Жыл бұрын
@@samirdevechi8589 Hahaha! Wishing Billy a quick recovery, he could've grilled himself. (I have no doubt he would've been delicious, but I very much prefer his presence in...raw mode. 😆)
@MrPSolver
@MrPSolver Жыл бұрын
Still recovering after defending his thesis.
@szilardfineascovasa6144
@szilardfineascovasa6144 Жыл бұрын
@@MrPSolver That was a hard weight to bear, as heavy as a medium-sized pile of average-sized rocks, pour feathered soul!
@materiasacra
@materiasacra 9 ай бұрын
It seems that the comparatively low accuracy is due to 'wasting' a large number of mesh points in areas where the wave function is near zero. This is a consequence of your treatment of the boundary conditions: having a hard wall 'very far' away. This is the aspect where improvement is likely to have the most 'bang for the buck'. I'm not sufficiently proficient in Python and its libraries to guess what the most practical approach would be. A fine mesh inside a coarse mesh? Take into account a estimate of the asymptotic behavior of the wavefunction?
@98danielray
@98danielray 7 ай бұрын
yeah. maybe a non-uniform mesh of some kind
@PrajjalakChattopadhyay
@PrajjalakChattopadhyay Жыл бұрын
My laptop doesn't have a dedicated GPU, but I have access to our institute's HPC cluster which has Nvidia Tesla V100 GPUs. I would like to try this code there.
@AJ-et3vf
@AJ-et3vf Жыл бұрын
Great video! Thank you!
@ApteraEV2024
@ApteraEV2024 Жыл бұрын
24:00 a lot of Quantum Mechanical textbooks???😅😅😅❤
@bimasharahaman3870
@bimasharahaman3870 Жыл бұрын
Sir , If there is any numerical process to plot hydrogen wave function in 3d or 2d.. .... Sir , waiting for you reply
@6ygfddgghhbvdx
@6ygfddgghhbvdx Жыл бұрын
The wave function is generally complex numbers, can you explain where in your code this is reflected.
@njyde
@njyde Жыл бұрын
Can you refer me to some relevant litterature for solving the SHE in 2D/3D numerically? Great video!
@mikekertser5384
@mikekertser5384 Жыл бұрын
Thank you. I enjoy your videos very much! :)
@laarouasaid
@laarouasaid Жыл бұрын
you rock man!
@asaboor
@asaboor Жыл бұрын
What are computer specs you ran this code on?
@peterchindove7146
@peterchindove7146 Жыл бұрын
What of (delta-y)^2?
@AriKath
@AriKath Жыл бұрын
This is such great content
@Tharushi_SM
@Tharushi_SM 5 ай бұрын
Thank you so much for this,
@PV10008
@PV10008 Жыл бұрын
This can't be done using the mps backend, right?
@ibonitog
@ibonitog Жыл бұрын
How does Pytorch compare, performance wise, to CuPy?
@lLuckM3412
@lLuckM3412 7 ай бұрын
Very cool intro
@HelloWorlds__JTS
@HelloWorlds__JTS Жыл бұрын
Phenomenal!
@shanshanbond7040
@shanshanbond7040 Жыл бұрын
please make videos on casadi
@mumujibirb
@mumujibirb Жыл бұрын
unfortunately, i still have not been able to get cuda to run.
@Roxas99Yami
@Roxas99Yami Жыл бұрын
cool videos as usual :)
@Levy957
@Levy957 Жыл бұрын
Amazing!!!
@T3WI
@T3WI Жыл бұрын
I'm good thanks
@nirajangupta7406
@nirajangupta7406 Жыл бұрын
sir, please start a series on numerical general relativity and quantum field theory using python. please! please! please!
@chromax1619
@chromax1619 Жыл бұрын
AAAAAAAAAAAAAAAAA
@usuario-si9rr
@usuario-si9rr Жыл бұрын
Does this explain why butts are so beautiful?
@theperfectionist1607
@theperfectionist1607 Жыл бұрын
Windows scrub
@wdobni
@wdobni Жыл бұрын
what's the point? why solve for 3D in Schrodinger? its been done many times before over the past 80 years and you can look up the data if you want the results.....i guess its a good exercise in coding practice for the time in the future when you think up some useful application for your top level skills rather than rediscovering ideas that were discovered early in the previous century
10x Faster Than NumPy (GPU Magnet Simulation)
43:15
Mr. P Solver
Рет қаралды 15 М.
Smart Sigma Kid #funny #sigma
00:33
CRAZY GREAPA
Рет қаралды 37 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 16 МЛН
The Greatest Mathematician Who Ever Lived
16:06
Newsthink
Рет қаралды 496 М.
Eigenstates of ANY 1D Potential in PYTHON
19:41
Mr. P Solver
Рет қаралды 37 М.
Grad School Be Like...
3:35
Mr. P Solver
Рет қаралды 112 М.
2D Schrodinger Equation Numerical Solution in PYTHON
24:04
Mr. P Solver
Рет қаралды 27 М.
GPU-Accelerated Ideal Gas Law Simulation
22:41
Mr. P Solver
Рет қаралды 16 М.
Trolling Hackers with a Honeypot and how you can too
20:08
Gnar Coding
Рет қаралды 6 М.
Deriving Schrodinger's Equation using A-Level mathematics... sort of
21:00
Physics with Keith
Рет қаралды 18 М.
ChatGPT Vs. Stack Overflow Be Like...
3:26
Mr. P Solver
Рет қаралды 81 М.
What is the i really doing in Schrödinger's equation?
25:06
Welch Labs
Рет қаралды 298 М.
Smart Sigma Kid #funny #sigma
00:33
CRAZY GREAPA
Рет қаралды 37 МЛН