Why model in code?
There are many serious reasons to program a model into a computer, first and foremost that computers are very fast at calculating, and calculating very fast is useful in science.
This I believe needs no introduction and I'm instead going to focus on using the coding process as a learning tool.
When programming is used as a learning and discovery tool, the objective is not necessarily to create a "production-level" software system, but rather to further your understanding of a problem. There are a few reasons programming is a great aid in this regard.
1. Programming can help you understand the question
One approach to modelling orbits might be to study any number of authoritative resources. Naturally this approach is terribly lacking in action and fun, and although more responsible in theory, there are benefits to being casually reckless.
It's more fun to just start, and fun means it's easier to stick with the problem - especially in the early aimless stage where you're not even sure how to ask questions about the problem, let alone find useful answers.
Writing code has concrete outcomes, and often results in a sequence of small wins. This is what I mean by fun - it's fun to have your growing effort and understanding rewarded.
Too many pages
Programming anything can get you to the point where serious directed study is easier, because it's easier to solve specific concrete problems in front of you, however minor and practical, than amble about in the undirected study of incredibly thick physical and virtual books.
Programming from the hip isn't always the right hack for learning, but it's a useful way to help develop specific and detailed interests in a topic, after which it becomes easier to be motivated for proper study, which requires you to know how to ask better questions, and to know why those questions are important.
I... hope it goes without saying that this informal approach to a project is a learning tool and generally not ideal if you have serious professional work to do.
2. The struggle makes your mental model better
Second, the process of programming working models forces you to understand more about the conceptual and practical aspects of a problem. There's a strong feedback between concept and practice in programming. Trying to build a working model from an abstract understanding will shortly expose the flaws in your thinking.
While an instructor might give part marks for a written answer such as " ... Mars gets, uh, moved in a direction by forces that are in nature," the computer will not. You need to understand your model, down to the details, to render it usefully in a computer program.
Here's how I'd describe it: You start out with some understanding of a topic - roughly speaking a mental model. By trying to program it into the computer, you'll struggle against the inevitable wrongness of your understanding.
There will be details you need, or forgot, or don't need, and misunderstandings, all of which will be revealed to you in detailed and specific ways by the computer, and a computer cannot be reasoned with.
The Computer has no empathy, and knows not forgiveness
One of the most dangerous thoughts for a programmer is "I just have to do [x]." A quick little feature, change, fix. Making code useful, and making it correct, is a humbling process. You will be humbled by detail and this can be an asset for scientific purposes. But prepare yourself.
Struggling with your mental model through programming is a form of learning, and the wrongness, or simplicity, of the model is mostly unimportant in this use case.
"Is the model fit for use?" When the use is to learn, the answer is yes.
3. To learn the tools
Building a model also means you'll be inspired (forced) to learn something of the relevant practical tools: Math, programming languages, code libraries etc. Familiarity with these can expose you to related concepts, and open avenues for further study.
Of course you can just read about these tools, but having to use them sharpens the... imperative to push through the uncomfortable feeling of incompetence you'll struggle with in the beginning.
Consider a scientific code library. This is code written by someone else that provides a set of pre-built programming tools for a problem. While you might start with a very specific need - say for a mathematical function - looking through the rest of the library will give you a sense of other important tools and approaches in the problem space. You'll find rabbit holes.
Learning the tools of the problem space will also help you communicate more effectively in the language of the problem. This is part of the reason just about any resume or CV needs to be heavy on specific practical skills and experience. Being able to speak the same language as collaborators is hugely important.
Finally, as in any domain, comfort with your tools will leave you more mental cycles for reasoning about your subject.
Now that we're suitably armed with a reason to write a model in code, I'll program up a basic version of the conceptual orbital model in the next post.