site banner

Friday Fun Thread for November 25, 2022

Be advised; this thread is not for serious in depth discussion of weighty topics (we have a link for that), this thread is not for anything Culture War related. This thread is for Fun. You got jokes? Share 'em. You got silly questions? Ask 'em.

7
Jump in the discussion.

No email address required.

I'm studying Physics but I want to appreciate programming and Computer Science more. I must admit that the two programming courses I've taken were quite boring and deluding, and I don't know if it is because they sucked or because I find programming boring in itself. My problem is that I do not really know what a programmer and computer scientist should be able to do, both in an academic and marketability sense[1], in other words how do I create a self-study curriculum to follow?

[1]like: What are jobs that programmers do? What are some beginner to advanced projects that I could implement on my laptop?

Depending on where you are in your major and if it overlaps well with your major you might consider minoring in CS. I majored in geophysics but minored in CS which forced me to take formal computer science courses up to data structures. All of these courses (at my school) were taught in C and this background (which I wouldn’t have ever gotten without it being hammered in) has been enormously valuable to my subsequent scientific work.

Programming is about making your problems into machine-legible ones. There are a few reasons this could come up.

First, automation. If you have a task which needs lots of repetition, consider automating it. Python is very handy for this.

Second, math. Computers are very good at reading tables, applying equations, and keeping all those in their memory.

Third, professional display of information. They are good at consistency in graphing, which adds a lot to any technical communication. Data visualization in general can be really useful. Learning how to use matplotlib will make you never want to open Excel again.

A lot of professional programming involves setting up systems like websites which will let others do repeatable tasks and store numbers without any skill of their own. If you are pursuing a physics career, don’t bother with this.

For these reasons, I used to suggest downloading Anaconda Python to start. You get a “read-execute-print loop” via Spyder, and you dodge most of the build-system stuff that plagues web or embedded development. The catch is python is too flexible, and I’ve seen way too many engineers who need a more solid foundation in data structures. I don’t have a great alternative. Recommending Learn You a Haskell is probably a bit much.

Learning how to use matplotlib Pandas will make you never want to open Excel again.

FTFY

See, I don't actually know pandas. So it must suck.

Jokes aside, there are all sorts of reasons why one cheerfully ditch Excel.

I mean matplotlib is a plotting package so pandas is the better comparison against Excel. Sorry for the pedantry. Anyways,

Pandas is THE tabular data manipulator of all tabular data manipulators. R enthusiasts would sing praises of dplyr but.. Idgaf what they think, and no one else does either. Seriously learn pandas you won't regret it.

But yes you won't see me disagree against Excel slander. I have been on the NumPy, Pandas and Matplotlib train for a while and never plan on getting off it. Getting shit done WEEKS in advance compared to Excel folk hits different for sure.

Althought I do have somewhat of a softspot for Excel for personal reasons, Its a good software to be used at home, not in industry.

My problem is that I do not really know what a programmer and computer scientist should be able to do

Obviously, some subset of 'make anything that existing computers do' for one. Develop a game, create a nice UI for something, simulate (at any level of detail - from 'very simple model' to 'the quantum-mechanical interactions of some chemical') some physical process, cause some physical process in a manufacturing process or robot, compute some property of a mathematical system (wondering of some weird arithmetic statement is true? Check it for the first 10^15 positive integers - at 1B/second, that'll only take a week or two!). There's also lots of complex problems required to implement programming - 'datastructures and algorithms' is quite math-ish and complicated, but every technical field has depth to it - implementing distributed systems is hard, writing very fast specialized algorithms that depend on the details of hardware features is complex, designing programming languages and compilers is hard, graphics is hard, 3D rendering is hard, ML is hard, all of these have a ton of intellectually complex depth to them.

That's weighted for 'interestingness', of course, 'make a boring web app' has a lot more job openings than 'distributed systems'

Not everyone can do most of these, ofc. But people specialize, although not necessarily for a whole career! A good programmer should be able to learn the very basic basics of any subarea of one of those within a few weeks, and dive deep into some technical part of any of that and do something interesting and tough in a few months - a year. If any of that sounds interesting, (once you can, like, write a program that 'takes a list and sorts' it), just try it! Write a game, even if it starts as simple as 'square moves around a 2d area and shoots circles at other squares' - make simulator + 3D renderer of some physics thing, even if the first version is "compute the trapezoid method approximation of an integral and graph it" - figure out what 'type theory' is, scrape all the text on 'themotte' and make a https://hn.algolia.com tier search for it, up to you.

Project Euler is basically abstract math problems that also require programming to solve, that might be fun once you know a bit.

Since you are a physics student I will make you a suggestion that should be close to home. Lofty demonstrations of algorithmic beauty won't faze someone who doesn't naturally find programming and CS interesting.

Ever thought solving long equations were a bitch (lol)? Play around with SymPy. It's a python package for symbolic manipulation. Check out the link to the video above, it's by a physics student showing you how to use SymPy to solve common physics equations and some of them are extremely difficult if not impossible to solve by hand. The sheer usefulness of it speaks for itself. You can solve the equation, plot it, solve a 1000 different variations of it, generate LaTeX renderings of it, "lambdify" it and put it into production, and so much more with TRIVIAL amounts of effort.

And don't get spooked by syntax/idioms you don't understand quite yet. As an Electrical Engineer who had to hand solve his fair share of Maxwells Equations, Take Fourier/Laplace transforms and solve some retardedly long control systems problems, letting the computer do all the hard work so that you can focus on the larger task at hand is a blessing of the likes a student might not even appreciate yet. Ain't nobody got time to hand solve shit, we have computers for a reason. Programming is not harder than Physics, do not be scared.

In an ideal world you should probably be a decent enough python programmer or programmer in general before using specialized packages because otherwise, you will stumble against the language itself. But in your case let's hope the reverse works out. You might find SymPy so useful that you venture out into other programming use cases.


For those wondering, why not just recommend MATLAB since it comes "built-in" with symbolic manipulation and a whole host of other things a physicist might find useful? Well... FUCK MATLAB that's why.


And what do programmers do? Come on man, you are typing this out on a fucking website, which didn't appear out of thin air. Just look around you.

Well... FUCK MATLAB that's why.

I've been trying to get this point across to some of my coworkers. A few don't get it.

I had a PhD advisor who used to make me prototype things I wanted to do with python (which I am very good at) in Matlab so he could understand what I was doing. One of the most frustrating months of my life (and part of the reason I quit!).

Also fuck matlab

What have you been saying exactly?

We aren't real software devs. We are engineers who need to process a lot of simulated and measured data. Half of us use python and half use matlab.

I try to say that python is in every way more capable than matlab and not locked behind a paid license. If you had to extend a script to include automation or something, python is ready for you. It is also free so if you had to put your scripts on one of the off network Linux machines in the lab, python would work just fine.

Using python in Spyder has all the benefits of matlab, for people who love that UI. Which I actually really do. But now I have a free portable version of my code that isn't locked behind a matlab license. Why are we paying them and locking our code out of the lab computers when the free and more capable alternative exists? It isn't like we are using LabView or some other matlab specific tool.

But these people are used to matlab and so half the time when I get someone else's code it is matlab. And so half the time I get to code in matlab. And the other teams use python almost exclusively, so it is just us leaning hard on matlab for no reason.

I won't even bother complaining about matlab's actual flaws here. Indexing from 1. Running out of memory when dealing with moderately large data sets, requiring lots of needless clearing of variables or matlab specific workarounds to their memory limitation bullshit that has nothing to do with hardware limitations. Hiding basic functionality behind paid toolboxes that each need a different license. Etc. Etc.

Also I never figured out if Matlab even has a real debugger. Being able to just %debug is so ridiculously useful

You can set break points in functions and scripts. Just click to the left of a line of code by the line numbers. Run it and it will enter debugging mode. Variables usually hidden in functions will be displayed on the open variables plane.That works fine for debugging in my non-professional-software-dev experience.

The indexing from one thing aways pissed me off so much (what’s worse is that is trying to keep this straight when using Matlab to do signals processing since it’s obvious that Matlab Fourier transform functions are wrapped C or some other real language)

Sounds like gridlock to me. Matlab is well entrenched in engineering enough that you are going to have a tremendously difficult time convincing anyone to get off it unless some other tool does that same thing SIGNIFICANTLY better accounting for the preference for Matlab.

Your best course of action, even though it may be an underhanded move is if you can convince the higher-ups that there are significant cost savings by not paying for the license.

And unless you are using Simulink or doing some heavy control system modeling, I think that is going to be an easy case to make. The python scientific suite (NumPy, SciPy, SymPy, Matplotlib) APIs are all designed for people coming from Matlab. So adoption costs should be fairly minimal.

If you really want to be a sociopath, I would choose a project that would be impossible to do in Matlab but a cakewalk in python; think some combination of deep learning that interfaces with multiple web apps.

And what do programmers do? Come on man, you are typing this out on a fucking website, which didn't appear out of thin air. Just look around you.

I had this question when I was picking my university. "Looking around you" doesn't work if you want to know what programmers do on a day to day basis. I'd want to know what my average day at work would look like.

A lot of students suffer from a form of analysis paralysis about what a jobs day to day activities actually are. You can tell them straight in their face and show them exactly what's getting done, but that revelation doesn't materialize in their head.

I think with programmers it's the least opaque, they program! There are many large open-source projects out there, their daily job would amount to maintaining and expanding a similar codebase (with a lot of bureaucracy thrown in). I would have answered OP differently if he was picking his university, not having already done two programming courses.

I'm a programmer and my current job is only nominally programming, but in fact just badgering the people who give me tasks to explain what they actually mean because they can't write task descriptions for their lives, then asking a dozen people how the hell a given system ever even worked, then finding out what minimally invasive change gets the desired results without breaking anything, which usually only involves a single-digit lines of code or a few hundred of largely copy-pasted lines ported from different projects. Actual programming ability is the least relevant part of my job. It's also what they specifically requested and what I specifically offered during the hiring process. I have no idea why software companies hire the way they do.

I suppose they really want you to have the skill of programming during that 1% of time you're going to actually use it?

That's probably the notion, yeah, and I guess it makes sense. Still feelsbadman.jpg on most days though.

I see programming as ultimately a means to an end.

With the above in mind, you’re likely to find it easier to stay motivated if you’re working on a project in a domain that you’re personally invested. Instead of worrying about a curriculum, I’d suggest learning only what you need to get your project working - you can always fill in any knowledge gaps later.

However, if you want to do some fiddling about with brain teasers I’d suggest tackling the upcoming Advent of Code..