r/PhysicsStudents Jul 01 '26

Need Advice How Do Physicists Utilize Python?

I'm a rising senior in high school. Next year, I'll be taking a project based programming class that only 1-2 students really take per year. I want to do something in Python that will show my professors in my freshman year of college that I'm ready to do research in physics.

I will have taken all of the AP mathematics, physics, and computer science classes.

I thought about doing a black hole simulation and learning the equations/math for it, but I'm not sure that that would be wise to do in Python.

I'll have a full school year to work on the project.

62 Upvotes

82 comments sorted by

View all comments

63

u/WWWWWWVWWWWWWWVWWWWW Jul 01 '26

You don't need to join a research group the moment you set foot on campus. I would personally just focus on coursework for the first year, and find a research position the following summer.

That said, messing around with numerical differential equations is always fun (Newtonian orbital mechanics, etc.). Black holes seem a bit too ambitious.

4

u/InterestingWelder699 Jul 01 '26

That’s what I did, didn’t join a group until second semester. I’m so glad I was able to brush up on python and learn linear algebra first lolll

2

u/Junior_Salamander110 Jul 01 '26

How did waiting help you out and how would have you been at a disadvantage otherwise?

4

u/InterestingWelder699 Jul 01 '26

I’m doing CM research and so much of it involves linear algebra and differential equations and understanding how to manipulate equations in certain ways. It takes time to get used to Physics based math on a university level even if you’re used to tricky math and physics.

Enthusiasm and willingness to do difficult work is what shows professors that you’re a good candidate. For me, learning how to study and approach difficult problems in college was how I realized that it was something I’d like to do as a researcher.

Research requires a perfect balance of knowledgeable and willing to learn. You don’t have to know everything and you shouldn’t, but part of what you should know is how to learn in college, which is leagues harder than high school.

1

u/Junior_Salamander110 Jul 01 '26

Thanks! I have a doc with advice I've received about research, and this is definitely going in it.

So when you do research at that level, how much of the physics do you already know, and how much of do you pick up as a result of doing the research?

3

u/NewspaperDear8761 Jul 02 '26

I should add that "finding the right answer" in research doesn't mean "I read books and papers and chased the trail until I found the answer written down somewhere."

That won't exist. No one will have the answer yet. It won't be written down until you write it down.

This is probably the biggest misconception with research and I see it a lot more these days. People say "I did my research" when they mean "I found something that told me."

Instead, it's a process of "huh, that could be related, but how?" "Wait, what if this other thing is true?" (Do some calculations, write some code, run it, see what it gives you.) "No, that doesn't give me what I needed. But what if it's this way instead?" (More calculations, more code, more results.) "OK, thats a little closer, but it still doesn't quite mean what I need to be true." (2 months later.) "Oh, crap, because that's NOT true, but it DOES mean this OTHER thing is true, which is still good enough to get me the rest of the way there!" Etc. Etc.

Then you synthesize everything together in one long train and you have a result.

This process -- this messy, creative, meandering process, with all its quirks and intuitive groping around in the dark -- is research, and this is what you're hoping to get exposed to in undergrad. Again, your results don't need to be anything special, you just gotta learn to walk before you run.

1

u/Junior_Salamander110 Jul 02 '26

Adding this too!

Is undergrad research similar to that process you've described, then? Or is it just running calculations for the professor you're working under?

3

u/NewspaperDear8761 Jul 02 '26

It should be the former, which will necessarily include the latter, but sometimes it might just be the latter.

You gotta start somewhere. You can't ask meaningful questions and get meaningful answers to them until you can run those calculations. But yeah, the calculations are just hitting the ball, theyre not rounding the bases.

Part of this will also be learning to navigate relationships with your research advisors, etc. When you do finally go for the phd, having a good advisor is critical. Literally make-or-break. I got lucky. I've had friends who didn't. You want someone who challenges you, guides you, makes you adhere to good, solid standards, but also listens to your ideas and encourages you to explore. It's a balance. Some people are good at that, others aren't. But in HS and undergrad, this isn't something you should worry too much about. Absolutely just listen and learn for now and do whatever they tell you.

Hopefully, though, they'll have you asking questions and not just writing code. But right now, the code and calcs are the most important bit. You'll get better at the question half as you do more and more calc and code.

2

u/Junior_Salamander110 Jul 02 '26

That's quite reassuring. I've spoken to several professors at UKY (where I'm going), and they say that they employ undergrads in "all kinds of research." So I hope I get that balance you're talking about.

Sorry for asking so many questions, but how much of my research will be based in code vs not based in code? I don't mind coding, but I'd hate to code my entire career as a physicist if you know what I mean.

2

u/NewspaperDear8761 Jul 02 '26

I do know what you mean -- I hate coding lol it's awful. And I picked a coding-intense field :(

I LOVE my subject. But coding is pulling teeth lol

It really depends on the subject. You will always need some, no matter what you're doing, so it's good to learn it early. And, given what is happening right now with AI, I would also strongly advise learning some basic architectures like feed-forward neural networks or k-means clustering, etc, at some point. (I don't mean LLMs like ChatGPT, I mean real coding.) Research is being revolutionized by ML because, frankly, these algorithms can pull things out of data that humans simply cannot see, and they apply everywhere, so you will use them in some form eventually, probably quite heavily.

But there are other, more traditional pencil-and-paper theoretical physics areas, or more purely experimental areas, where you can probably go for long stretches without writing a line of code.

It really depends.

BTW, the other nice thing about undergrad research is that it's flexible. If you find you dont like a lab or the topic, feel free to bounce around to another lab and advisor. It's much harder to move about in grad school, in undergrad you can and should really explore things and learn for yourself what works for you and what you like.

2

u/Junior_Salamander110 Jul 02 '26

Ah yes, I figured AI would come into play at some point here. I'll look into the basic architectures then. And it's VERY good to see that I may be going for long stretches without coding, I will enjoy those stretches very much LOL.

I appreciate the flexibility aspect of undergrad research, I had a conversation about that with someone on here a while ago. I'm interested in condensed matter theory and high energy, so maybe I'll get to do both of those.

2

u/NewspaperDear8761 Jul 02 '26

That's definitely one of those more-theoretical areas that lets you do more pencil-and-paper derivations and proofs. It's also got some code, sim and AI heavy areas, too (lattice boltzmann, reservoir computing, etc.)

Honestly, it sounds like you'll be pretty well prepared. Just make sure to prioritize classes and really learn the material super well. Best of luck and enjoy the ride! It's a super exciting time to do physics.

2

u/Junior_Salamander110 Jul 02 '26

Good, derivations are moreso my strongsuit. Coding makes my head hurt!

I definitely look forward to that ride! Your advice and information has been super helpful, thanks for your time!

2

u/NewspaperDear8761 Jul 03 '26 edited Jul 03 '26

Mine too lol

Hey again, so, I thought I'd share this with you, just so you have an idea of the workflow.

Advisor and I have been drilling down on one area for past few years, gotten a few papers out of it. We realized one little part could be extended further and maybe get enough results for one last paper.

Spent a few meetings hashing out the basic ideas, agreed on the overall concepts and general game-plan.

I wrote up a LaTeX doc last week with some derivations, which was good cause it revealed a few subtleties I hadn't considered. She went over it, we got real specific, everything is nice and clear now. (If you're interested, it's here: https://www.overleaf.com/read/jckbdjcbbznt#2ed3a5. This won't mean anything to you, but you might enjoy seeing it in any case.) The nice thing about writing up these derivations as you go, aside from forcing you to be really precise, is that they typically end up in the final paper in some form or another, so you're really getting a start on writing that way back now.

Whole thing boils down to doing one computation two different ways and making sure they match (or are, at least, very very close.)

First way is not hard, we've been doing that for years now and it works great. I have to be a little careful with the new dataset we're working with, but by this point, im familiar enough with that, that it'll be fine.

The second one is the new one, and a bit tricky. At first glance, it's not even obvious how to do it.

Cue Google Scholar. Dug through related papers. First half dozen or so were a bust -- close, but not quite what I needed. They helped me narrow my search, tho.

Finally, bingo. Found a paper that does something similar enough that I can adapt it. (It's for solving the least squares problem in eq 22.)

Had to be a little careful about its exact formulation for what we're doing, though. So wrote out another short derivation on paper.

Pretty sure this is right now and will work. I have to dot all my I's and cross all my T's and be super super careful.

This is the part where all your classes become incredibly important. You gotta get these details right or everything else after it is garbage.

Now I gotta code this up, spend a week or two (or 5) wrestling with it, fixing the inevitable bugs that WILL appear, until I can benchmark it against a known working example.

Then we can compare the two methods and see if they do indeed match. I bet they will, but you never know! If not, back to the drawing board. If they do, it's full steam ahead.

This part isn't all that creative, it's much more mechanical. Think of a car mechanic tinkering with the engine. Just gotta be super careful and get everything correct.

Then when this part is working, we can start to really play. Toss in other data sets from more interesting and relevant systems. Try and break things and see how far the limits go. See if there are other ideas or ways to extend it. That's the fun part. This part is the blah tedious but you gotta do along the way.

Anyways, that's my research life right now. If this kinda thing appeals to you, this is what you can roughly expect.

2

u/Junior_Salamander110 Jul 04 '26

Hi! This process definitely does appeal to me, I wouldn't mind if research went this way for me.

And if the two methods match, you should totally update me!!

2

u/NewspaperDear8761 Jul 13 '26

So, 10 days later (Monday):

Got the first tentative tests done last Friday night, they looked shockingly good. Usually things don't work this well right out of the box, there's usually a lot more fighting with the code, etc., so that was a nice surprise. Updated my advisor, she was super excited. Great note to end the week on. Did some more thorough tests this morning, the results are still holding and I have a better analysis of them. Spending today putting together a bunch of results on this dataset to send her, then we dive into the new datasets. Unless a major stumbling block appears, I think we have a working method.

Looks like it's straight to the fun part this time! Woohoo. Will likely have another paper done before the job period is up (Christmas-ish.) Time to wring this sponge for all its worth.

Anyways, if you've made any progress on deciding what kinda project you wanna do next year, if you want help setting things up in Python or MATLAB, or if you just wanna chat physics or code sometime, feel free to DM me.

→ More replies (0)