What programming languages should you learn for Physics?

Поділитися
Вставка
  • Опубліковано 15 чер 2024
  • Consider supporting the channel: / @jonathonriddell
    Try Audible and get up to two free audiobooks: amzn.to/3Torkbc
    Hi everyone!
    In this video I describe my workflow for computational physics. I go into why I use the languages I do, and talk about the pros and cons of different languages.
    Mr . P Solver:
    / mrpsolver
    Recommended textbooks:
    Quantum mechanics:
    amzn.to/3Ar5dbn or amzn.to/3ckXkfL
    Statistical mechanics:
    amzn.to/3QYcere or amzn.to/3cmZb3u
    Quantum information:
    amzn.to/3Kpjt96 or amzn.to/3KpjAl2
    My publication list: scholar.google.com/citations?...
    Instagram: / stat.mech.in.action
    TikTok: www.tiktok.com/@stat.mech.in....
    Twitter: / jonathonriddell
    Discord: / discord
  • Наука та технологія

КОМЕНТАРІ • 38

  • @MrPSolver
    @MrPSolver 2 роки тому +37

    Thanks for the shoutout! ❤️. I'm actually planning on learning C++ some time in the near future, would love to see samples of your code on here!

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

      No you're falling for the devil. Trust in the lord and go for Julia.

    • @sriZzZzZ
      @sriZzZzZ 7 місяців тому

      @@adwaitnaravane5285 and yes u r really right

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

    Great idea for coding series

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

    Thank You dost.. much needed video

    • @richardbennett4365
      @richardbennett4365 7 місяців тому

      I doubt the presenter knows your language's word, "dost." But hey, that's okay. He gave your comment a Like, and if he doesn't know, then I will let him know here: friend; buddy; pal; dude.

  • @EpicMathTime
    @EpicMathTime 2 роки тому +12

    I think people should just get skills in one typical OO language and not get too hung up on the choice of initial language. Once you do that, hopping to another one as needed is basically trivial. Off the top of my head, ancient Fortran is good for computational science, I think, as is Python. I learned Python, but I now use C# exclusively.
    I'm no programmer or software engineer, so I don't have a deep technical knowledge on these languages, but as a casual user, they all pretty much feel the same to me.

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

      I definitely agree that you shouldn't sweat the initial choice, mine happened to be python due to a course I was taking.
      At the end of the day it's about solving the problem you are given in an efficient way. For a lot of problems the functionality available (or familiarity) will be more important than the speed.
      But once you jump into work that requires a lot of speed / has high computational complexity I think you should use a compiled language. Fortran is fine but I don't really know many people who use it anymore. C++ (for my field) seems to have a lot more support/ libraries to work off of.

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

      I really don't like C, Is C# hard to learn and use? Is C# like Fortran, does C# have an easy to use editor?

    • @victotronics
      @victotronics 17 днів тому

      You should not use "ancient Fortran". You should use Fortran2008 or later, which is object-oriented, supports parallelism, &c.

  • @swagatbordoloi9773
    @swagatbordoloi9773 Рік тому +7

    I'm a freshly enrolled PhD student in astrophysics, but I changed my specializations from CMP and hence have beginner level computational knowledge. Can you give a brief roadmap on how should I proceed to learn the required things as it would help me to make my learning journey a bit better? maybe atleast for the initial stage

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

      Do you have any numerical experience at all? Which languages? Which languages would you be working with during your PhD? I can answer better once you give me more details :). Also feel free to join the discord community, I answer quicker there and can go into more depth.
      For c++ I would say start on the tutorials of: cplusplus.com/ (assuming it's brand new)

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

      @@JonathonRiddell Thank you so much for looking at my comment. I had numerical physics classes of different series, algebra, matrices, etc. In programming, we were taught C in our undergrad computational physics classes, and i did learn different numerical methods like newton Rapson etc. But, I am learning Python on my own as I would mostly be working with this language. I inquired about the requirements, but I was given no specification and was told that anyone would work, with the only difference in syntax. But there is a large gap in my knowledge of the numerical methods as I still need to relearn those techniques.
      I have no prior real time experience data handling and stuff which I would be mostly working on. You can call I'm a astro enthusiast who is starting his astro journey from PhD. Looking forward to hear from you on this.
      Also. I would love to connect with you on discord. Username - Spydr98 . name- swagat, loved your video ❤

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

      I see! So to me it looks like you are quite the experienced computational physicist already :) you are just out of practice. For python and computational physics I would highly recommend the channel: ua-cam.com/users/MrPSolver
      It's dedicated to computational physics in python specifically. There are intro python videos there to get you started if need be and then you can code along in the other videos!

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

      For plotting I believe the channel I mentioned covers this, but matplotlib is easy and intuitive to work with. I'd recommend looking into AXES plotting and learn that way vs. The normal plt.plot route as you'll eventually want subplots and more fancy features :).

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

      @@JonathonRiddell yess. i'll look into it for sure

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

    Python is good for prototyping but for serious supercomputing, there is not much to be gained by not using Fortran. Of course, if speed is not an issue, C# and C++ might be OK - though wny torture yourself with the latter.

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

    I’ve used python for data analysis and plots as you mention. And I’ve learnt C and basic numerical methoda through formal courses. I have a bit of free time at hand right now before grad school and would like to improve my numerical abilities. What book or other resources would you recommend? I want to learn algorithms that are common to most computational physics.

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

      Before I give feedback, just curious about two things. Have you taken a class on numerical analysis or were they strictly numerical methods courses? And what area of physics will you focus on in graduate school?
      It seems like you have a solid foundation :) just want to make a recommendation that makes sense for you.

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

      @@JonathonRiddell It was about a semester worth of course on basic numerical methods with things like root finding, differentiation and integration methods, and methods to solve ode like RK4 etc. I’m leaning towards numerical relativity for grad school at the moment but I’m not totally sure. I like condensed matter physics as well.

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

      @@bibekgautam512 Hey! So, I don't have any experience in numerical relativity, but, I do have some suggestions here. One suggestion is to get a more formal intro to numerical analysis, this will expose you to more algorithms and allow you to understand what's going on at a deeper level. From that, I used (and enjoyed): A Graduate Introduction to Numerical Methods: From the Viewpoint of Backward Error Analysis By Rob Corless and Nicolas Fillion.
      For condensed matter specific algorithms, I'll instead recommend an review article that includes pseudo code, for solving a bunch of different types of problems in condensed matter systems (the author uses magnetic systems as an example but it's not limited to it: arxiv.org/pdf/1101.3281.pdf
      Either, or both, would be good ways to expand your knowledge. :) Hope that helps.

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

      @@JonathonRiddell That sounds like exactly what I was looking for. Thanks a lot! Looking forward to that video series starting next week as well!

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

      @@JonathonRiddell will check it out for sure... But before that I got to learn c++ in the frist place lol

  • @richardbennett4365
    @richardbennett4365 7 місяців тому +1

    You guys, @MrPSolver included could benefit from learning LAPACK and Fortran. But, Mr Riddell, if you know C++ and no Fortran, you might find Fortran odd, though its syntax or I should say its readability is not so different from python.

    • @JonathonRiddell
      @JonathonRiddell  7 місяців тому

      With eigen in c++ I'm not sure lapack is necessary anymore / the advantages of c++ really shine. You can also construct eigen with a lapack back end if you want :)

    • @richardbennett4365
      @richardbennett4365 7 місяців тому

      @@JonathonRiddell very good. I was just somewhat surprised you didn't mention Fortran or Haskell (kidding about the latter one; however, it is supposed to be excellent at number crunching. I did try learning it, but gave up; I could not get the hang of the syntax; it all seemed so bizarre.). Maybe younger physicists don't generally use Fortran. It is an older language, but it's a good one. The fact that it is still around and used so heavily attests to its resiliance.

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

    Julia is great for physics

  • @kim-hendrikmerk4163
    @kim-hendrikmerk4163 Рік тому

    Do you have to work with Fortran at all? As i heard that a lot of work is present in it.

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

      I personally don't, though some people still do. A lot of newer code seems to be written for c++, c or even Julia these days :). Sometimes python and Matlab too.

  • @brucebarnes8138
    @brucebarnes8138 10 місяців тому +2

    I started in Fortran back in the 70's. I tried to change to c and found it very confusing so I stayed with Fortran. I like Python a lot, but it is a little slow. I have not tried c++ is it easier to learn than c? I really like Python in linux. Is there a more modern language like python with more speed?

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

      Julia might be up your ally then! It's modern and designed to be easier. Still slower than c++/c.
      Depending on your needs modern c++ might be made a lot easier with libraries, for example eigen c++ makes linear algebra very easy (it's free and highly optimized).

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

      maybe just try to update your fortran, there is an amazing book from Milan Curcic about modern fortran. I know and use python, c, c++ and c#, but I still rely on fortran (standard 2023) for proper big number crunching :) as python is too slow and c++ syntax feels a bit more uncomfortable for maths problems.

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

    What about Julia programming language?

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

      Julia is quite a nice language with some packages like iTensor offering support now. I get the impression that it is in general quite fast, and much easier to develop efficient code on than c++. Depending on your use case it might be a better alternative to c++, but in the end, highly optimized c++ code is going to be faster.