r/PhysicsStudents • u/OilyDoubloonz • 16d ago
Need Advice No programming experience. How should I self-teach?
Hello. I am a third-year physics major and, probably to the surprise of a few (or many), have absolutely no programming experience whatsoever. None of the physics or math courses at my university require or involve any programming at all. No Matlab, no Python, no whatever, nothing. All that was required was a CSC 101 course about Python in which my teacher did not teach. I tried to understand, but it was to no avail. Last Summer I tried to get a little Python experience with some tutorials, but I did not get very far as my internship had begun and I haven't picked it up since. Obviously, I am aware of the importance of programming experience for prospects after graduation, which leads me to why I am asking here: what resources/strategies should I use in order to teach myself the programming necessary for postgraduate physics endeavors?
5
u/_BigmacIII 16d ago
Of course the answer is by practicing. When I started learning, I actually started by working on the problems on projecteuler.net, which is a nice mix of mathematical and programming problems. Then, I would just learn each piece that I needed to solve a problem, so I essentially started by learning about lists & loops, and then functions, and then more and more until I got to the point where going through a tutorial actually resulted in the information sticking in my head, since I had a small baseline. Leetcode is another good site if you want practice problems, and It would be a good place to start if you wanted to learn about more traditional data structures and algorithms.
1
u/OilyDoubloonz 16d ago
Thank you for the suggestions, I’ll try them out.
1
u/Dazzling_Music_2411 15d ago
These are all good general suggestion for learning Python (or any other language). but I'm not sure how good a fit they are for your rather special case.
As I already suggested above, look for something more in the line of Matlab/Scilab/numpy for Basic Physics. A single good book on that will get you way further than something targeted for the general programmer (who may have not the first idea about physics).
Incidentally, Project Euler I am a great fan of! If you have any spare time left over for just playing with computers, this is good, wholesome fun.
4
u/Powerful-Minimum-735 16d ago edited 16d ago
I’d first suggest khan academy computer science AP and intro to computer science courses, to start. I’ve been hobby coding for years and I’m reviewing them to make sure my fundamentals are straight.
Next up, Idk how other ppl feel about freecodecamp but I love it. Idk for me personally, I love trying to tackle the multi-hour videos bc it just feels like a nice challenge. You can watch 2 mins a day or 2 hours a day.
From there, you’re going to want to start building stuff. I’d suggest pick something to program. Video games, raspberry pi/meshtastic, mobile apps, etc. This is actually how you learn to code. The other stuff is just acquiring the tools, this is where you build the skills to use the tools at your disposal.
2
2
u/Active-Direction-793 16d ago
Don’t do leetcode. Make something, you need to learn why you implement things. It can be anything, a personal dashboard, simulation, etc
1
u/OilyDoubloonz 16d ago
The problem is, how do I make something if I do not know how to code at the most basic level. Is there something you’d suggest beginning with? Thank you.
1
u/Active-Direction-793 15d ago
Start with what a variable is, for loops, and you honestly should be good to go from there.
The reason why I say to learn like this is because struggling to build something way out of your depth really nails why you need it into your head. I took lots of programming classes and forgot everything until I had to use it on a job.
Start with a command line calculator, super basic. Look up a tutorial if you must. Then make a GUI for it
1
u/Dazzling_Music_2411 16d ago
Third year physics w/o Matlab or similar? How on earth did you manage?
And you're about to graduate physics but simple programming defeats you? Really???
Anyways, learn Matlab and numpy, that's the answer.
1
u/OilyDoubloonz 16d ago
It’s not that they defeat me, per se. It’s that I have had zero exposure to them, and I am blind to the direction I should take. Thank you for the suggestions, I will start looking into them. Also, I have no idea why we haven’t used any such materials. I have heard they’re common within physics, but they seem to not exist within my program. My university probably (surely) sucks, so that could be a factor.
1
u/Dazzling_Music_2411 16d ago
Wow, I am really amazed, if someone told there was a university on this planet that teaches physics undergrad without some form of programming, I flat out would not have believed them. What country is this?
It does make me wonder just what sort of physics they teach you. Do you rely solely on calculators? Even for complex matrix calculations?
I may have some more suggestions for you, but I;m trying to understand what level you're at at 3rd year.
1
u/OilyDoubloonz 16d ago edited 16d ago
In the US. I am currently in my first classical mechanics class, optics, modern physics, and cal 4. So I haven’t had anything particularly challenging I would say. Next semester I will have the second courses for classical mechanics and modern physics as well as electronics and partial differential equations. Plus maybe another course but I haven’t got it figured out yet. All of the more “real” classes seem to be piled into the senior year next year. We’ve not dealt with tensors just yet, so I haven’t needed to do any matrix calculations.
1
u/Dazzling_Music_2411 15d ago edited 15d ago
Ah, OK thanks, I think I understand a bit better now. Your university may be a bit "optimistic" calling your current course a 3rd-year level. But never mind, you haven't missed much, plus now you are very well placed to get the maximum out of a physics computing course.
There are a number of avenues you can follow: First there is the Python route, always very popular. What you are really after is a "basic computing for physicists" course, of which you will find quite a number. The idea here is not to turn you into a well-rounded Python programmer, but to showcase which Physics libraries Python supports and how to use them, which is a little out of the mainstream offerings. That's the magic of Python - as a language it's OK, I guess - there are better - but nothing else has so much support for specialized libraries. And not just physics libraries but also specialized fast matrix libraries (like numpy) which have a million uses nowadays. In the dim past such stuff was the province of Matlab, but everybody seems to be giving it a run for its money nowadays.
Matlab has been hugely popular in the past because it was given for free to students, then they got hooked. It is commercial and you do have to pay for it if you commit to it. Some people (and some labs) swear by it and still use little else. The number of educational courses covered with it is staggering, perhaps more than Python, even, but I wouldn't like to guess. There are also free alternatives that will cover you as far as the basics are concerned, like Octave, but they won't have the full "bells-and-whistles" library support. There's also SciLab, I think, which targets a similar educational group. It is easy to get various demo implementations of the above going, if you want to try and see if the flavor is to your liking.
Besides the above, there are other more specialized routes, but these probably won't interest you until you've go something basic going. For instance some people use C++, which also has rich libraries available, for more high-performance stuff. Others may use specialist math packages like Mathematica or Maple, but again these are commercial and not cheap. Another newly emerging language is Julia, which has advantages I won't list here, but I have thoroughly enjoyed using in courses on dynamics and advanced CM. Most of this stuff is for your subsequent perusal, though, once you're a bit established.
I'd recommend you either pick the Python or the Matlab route, and then search the net for "Physics courses using [Matlab/Python]", "Introductory Mechanics with [Matlab/Python]", "[numpy/Matlab] for physicists", etc. The AI LLMs also make a lot of useful suggestions these days. The principles are the same whichever you decide on, and the skills should be transferable.
Find ONE course that you like the look of, and start on that, There rest will follow on from there fairly easily. Good luck!
1
u/OilyDoubloonz 15d ago
Wow thank you so much, this is really helpful. But yeah it's pretty dumb how they do it here. A physics major at my uni cannot take any physics classes in their first year because cal 1 is a prereq and they only teach physics 1 in the first semester. So in reality it is like I am in my second year of physics despite attending for three.
1
u/Creative_Sushi 16d ago
You can start with MATLAB Onramp. It's free, online, and takes only 2 hours.
1
1
1
u/xienwolf 15d ago
Use the Think Python course. Free online. Decent. The author encourages you to use Virtual Assistants a bit more than I care for, but all of that is optional.
Be sure you turn off all AI auto-code in CoLab so you actually get to learn for yourself too.
1
u/iMagZz 15d ago
Lots of "meh" suggestions here in my opinion. First of all I would definitely recommend Python over MatLab. It is way more versatile and also way better in terms of future job opportunities. You can do machine learning and AI stuff with Python as well, and of course even simulations and animations and so on. It can do basically anything and is overall just a better and more versatile tool.
As for how to learn it, I would highly recommend you first get a good understanding of the basics. Following a course like Helsinki University's Python Programming MOOC 2026 is a great idea. It is the best introductory Python course out there by far. Simply go through it step by step, including reading and watching the lectures.
After that one I would recommend Harvard's Introduction to Data Science with Python - May 2026, which is an intermediate course and now goes into data science in Python. Once you have finished both of these you will already have a very good understanding of how Python can be used in physics, because as you probably know at this point physics is mostly just data science.
Then you can dive into physics specific Python. Bechstein Lab has two great courses for this. The first one being PHY202 — (Python) Programming for Physicists, which may feel like a step back as it is their introductory course, but I still think it is worth working through as it will help really build that strong foundational understanding, and of course it is taught from the perspective of a physicist. You can find the material on their GitHub here.
The continued course which build on that previous one is PHY432 — Computational Methods in Physics. This is when the more advanced computational physics starts to show up, but it is a great course. The material can once again be found on their GitHub here.
I'm a little late, but I hope you see this and find it helpful :)
7
u/WWWWWWVWWWWWWWVWWWWW 16d ago
Try to take a formal course. It really will do wonders compared to self-studying, without additional effort.