Solve Schrödinger Equation in Seconds with Python & GPU

  Рет қаралды 42,716

Mr. P Solver

Mr. P Solver

Жыл бұрын

CHECK OUT MY NEW UDEMY COURSE, NOW 90% OFF WITH THIS CODE:
www.udemy.com/course/python-s...
Code:
github.com/lukepolson/youtube...
Old Video:
• 2D Schrodinger Equatio...
Get Your Billy T-Shirt: my-store-d2b84c.creator-sprin...
Discord: / discord
Instagram: / mrpsolver

Пікірлер: 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
@rico879able
@rico879able 3 ай бұрын
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.
@martinzapata7289
@martinzapata7289 Жыл бұрын
Yooo, I’ve been following the channel for a while and the content only gets better. Good shit.
@LoserKing696
@LoserKing696 Жыл бұрын
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.
@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.
@lhomme_flaneur
@lhomme_flaneur Жыл бұрын
ayo, keep posting these scientific computing videos, they are getting greater and greater btw :)
@Tim-Kaa
@Tim-Kaa Жыл бұрын
Thank you, I watched the whole Schrodinger's series, amazing work.
@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.
@TheFreeSpiritKID
@TheFreeSpiritKID Жыл бұрын
What a wonderful thing to watch after a few beers. And beautiful plots. Thx 🙂
@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!
@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 🙂
@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
@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!!
@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.
@victorgabrielmoreleduarte5999
@victorgabrielmoreleduarte5999 Жыл бұрын
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.
@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 11 ай бұрын
I think Lorena barba has a 7stepstonavierstokes class you can follow for that
@kevinchen8325
@kevinchen8325 Жыл бұрын
oh yeah, this is why i subscribed!
@mikekertser5384
@mikekertser5384 Жыл бұрын
Thank you. I enjoy your videos very much! :)
@AJ-et3vf
@AJ-et3vf 10 ай бұрын
Great video! Thank you!
@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?
@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
@kevinsweeney2809
@kevinsweeney2809 Жыл бұрын
Thank you, your channel is amazing!!!!
@firasnizam
@firasnizam Жыл бұрын
Amazing, I like implementing physics math to graph
@AriKath
@AriKath Жыл бұрын
This is such great content
@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
@njyde
@njyde Жыл бұрын
Can you refer me to some relevant litterature for solving the SHE in 2D/3D numerically? Great video!
@J_CtheEngineer
@J_CtheEngineer Жыл бұрын
Mechanical Engineer here, I’m just here for the pretty plots!
@Tharushi_SM
@Tharushi_SM Ай бұрын
Thank you so much for this,
@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 2 ай бұрын
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.
@user-we6mf5bn4m
@user-we6mf5bn4m Жыл бұрын
you rock man!
@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!
@Roxas99Yami
@Roxas99Yami Жыл бұрын
cool videos as usual :)
@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
@lLuckM3412
@lLuckM3412 2 ай бұрын
Very cool intro
@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!
@6ygfddgghhbvdx
@6ygfddgghhbvdx Жыл бұрын
The wave function is generally complex numbers, can you explain where in your code this is reflected.
@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?
@ApteraEV2024
@ApteraEV2024 9 ай бұрын
24:00 a lot of Quantum Mechanical textbooks???😅😅😅❤
@Levy957
@Levy957 Жыл бұрын
Amazing!!!
@asaboor
@asaboor Жыл бұрын
What are computer specs you ran this code on?
@bimasharahaman3870
@bimasharahaman3870 Жыл бұрын
Sir , If there is any numerical process to plot hydrogen wave function in 3d or 2d.. .... Sir , waiting for you reply
@BuciuEmilian
@BuciuEmilian Жыл бұрын
Does anybody know how can I setup VS Code so that I can rotate the figures like he does at 27:28?
@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.
@PaawanS
@PaawanS Жыл бұрын
This can't be done using the mps backend, right?
@materiasacra
@materiasacra 5 ай бұрын
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 2 ай бұрын
yeah. maybe a non-uniform mesh of some kind
@peterchindove7146
@peterchindove7146 Жыл бұрын
What of (delta-y)^2?
@shanshanbond7040
@shanshanbond7040 Жыл бұрын
please make videos on casadi
@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.
@ibonitog
@ibonitog Жыл бұрын
How does Pytorch compare, performance wise, to CuPy?
@mumujibirb
@mumujibirb Жыл бұрын
unfortunately, i still have not been able to get cuda to run.
@T3WI
@T3WI Жыл бұрын
I'm good thanks
@chromax1619
@chromax1619 Жыл бұрын
AAAAAAAAAAAAAAAAA
@nirajangupta7406
@nirajangupta7406 Жыл бұрын
sir, please start a series on numerical general relativity and quantum field theory using python. please! please! please!
@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
@HelloWorlds__JTS
@HelloWorlds__JTS Жыл бұрын
Phenomenal!
10x Faster Than NumPy (GPU Magnet Simulation)
43:15
Mr. P Solver
Рет қаралды 14 М.
Eigenstates of ANY 1D Potential in PYTHON
19:41
Mr. P Solver
Рет қаралды 35 М.
Little girl's dream of a giant teddy bear is about to come true #shorts
00:32
Inside Out Babies (Inside Out Animation)
00:21
FASH
Рет қаралды 22 МЛН
Jumping off balcony pulls her tooth! 🫣🦷
01:00
Justin Flom
Рет қаралды 26 МЛН
Викторина от МАМЫ 🆘 | WICSUR #shorts
00:58
Бискас
Рет қаралды 4,5 МЛН
The Hydrogen Atom, Part 1 of 3: Intro to Quantum Physics
18:35
Richard Behiel
Рет қаралды 233 М.
17 - How to write an Eulerian fluid simulator with 200 lines of code.
12:05
Ten Minute Physics
Рет қаралды 289 М.
Procedural Planets that Look Really Real | DevLog
5:12
Dan++
Рет қаралды 1,3 М.
SOLVING the SCHRODINGER EQUATION | Quantum Physics by Parth G
13:04
Coding Adventure: Simulating Fluids
47:52
Sebastian Lague
Рет қаралды 1,7 МЛН
The moment we stopped understanding AI [AlexNet]
17:38
Welch Labs
Рет қаралды 835 М.
Magnus Carlsen vs Daniil Dubov || FIDE World Rapid Team Chess Championship (2024)
14:55
Elon Musk update on 2nd human who got Neuralink implant
9:12
Lex Clips
Рет қаралды 11 М.
ASMR Programming - Spinning Cube - No Talking
20:45
Servet Gulnaroglu
Рет қаралды 3,8 МЛН
iPhone socket cleaning #Fixit
0:30
Tamar DB (mt)
Рет қаралды 18 МЛН
Опасность фирменной зарядки Apple
0:57
SuperCrastan
Рет қаралды 11 МЛН
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 484 М.
low battery 🪫
0:10
dednahype
Рет қаралды 1,6 МЛН
İĞNE İLE TELEFON TEMİZLEMEK!🤯
0:17
Safak Novruz
Рет қаралды 1,8 МЛН