# Mathamatica vs Sympy and Astropy to solve basic astronomy problems: solving linear equations and unit conversion

I realize this may be slightly off topic, but I also believe this is probably the best way to get an answer to my question:

What is the best combination of software packages / programming languages to solve basic astronomy questions, such as applying Kepler's laws, calculating radial velocities (i.e. basic linear algebra) etc in a scalable way?

Essentially what I need is

• Equation solver (Mathematica or Astropy combined with Sympy?)
• Unit conversion (Mathematica and Astropy)

I'd like to hear some opinions what combination of tools people are using to perform basic astronomy calculations such as the above example, where unit-conversion and solving linear equations appear to be the most common tasks.

As an example problem: How would I solve for a variable in kepler's third law after assigning values to all other variables?

a^3/P^2 = G * (Ms + Mp) / 4 * pi^2

It seems simple in Mathematica doing Solve[a^3/P^2 == (G (Ms + Mp))/(4 \[Pi]^2), P]]. Is there any equivalent in python that can solve and at the same time handle units?

• ...in a scalable way... In what way "scalable" ? Dec 28, 2020 at 17:22
• I like Matlab but most people here just use Python. Dec 28, 2020 at 20:10
• The issue of "scalability" is key here. What you don't want to do is get the computer to do symbolic algebra each time. You rearrange the formula once P=sqrt(4*a^3*pi^2/(G*(Ms+Mp)) and then get the computer to evaluate it. Python is a good choice to do the evaluations. I also don't get "handle units" that is part of the programmer's task. This is non-linear, but solving linear equations is the same: You do the the symbolic re-arrangement once (or get mathematica/wolfram alpha to do it), you then get the computer to do the evaluation for different values. Dec 29, 2020 at 20:26
• Yes that’s certainly a possibility way. But in my case I’m working through an astronomy book and I have many difference problems to solve, need to mix formulas together and convert units etc. Mathematica works great, but I would prefer a similarly flexible solution in python. So far I couldn’t find one. Dec 29, 2020 at 22:21
• Can I humbly suggest that you do the algebra by hand. Your maths, and hence your astronomy will be much better if you sweat a little to get the answers. Dec 29, 2020 at 22:54