The other day I found myself faced with six equations that needed to be solved algebraically. Just so you know, I am a big fan of paper for most of these cases - but this was out of control. I was making silly mistakes and causing all sorts of problems. What to do? My first though was to use some symbolic plugins for python. I tried sympy and it is nice. However, it was not giving correct solutions for solving 3 equations - I don't know if this is a bug or what.
The point of this post is not just to tell you about this software, really it is to tell me about it. I probably won't use this for a while, and so I will forget what I did. First, some useful resources:
- Introduction to Maxima. This intro by Richard Rand is very thorough. Basically, it has everything you need.
- How to export your equation in LaTeX. This is something I found that seemed quite useful.
So, if you want to get a good start, look at the intro link above. But I will summarize a couple of quick things. First, entering expressions. One thing I did not like about sympy was that expressions were entered as 2x + y = 0 instead of 2x = -y. In Maxima, just enter the equation. Here are some rules:
- Use normal order of operations stuff
- Don't forget * for multiplication. If you do 2x, you will get an error. 2*x is ok.
- You can use variables that are longer than 1 character, but it can't start with a number - x2 is ok, but not the variable 2x.
- When you enter a statement, you must end with a ";"
- The output of every entry is labeled something like - %o19. This is nice because you can refer to this output in later entries.
Let me show a simple example. I will use two of the kinematic equations to create a third kinematic equations - algebraically. Let me start with:
Now, to enter these two equations into Maxima:
Notice that you use normal (non-python) format for entering expressions - by non-python I mean that the "^" means raised to the power instead of "**". The output is formatted in a way to look a little nicer.
Now, I want to solve the second equation for t:
Here, I referred to the original equation by its output line number (%o3 in this case where that is an "o", not a zero). Next, I just want to substitute this expression for t into the first equation.
The command in line %i6 may look weird. But this is saying take the equation %o2 (which is the first equation) and substitute t = ... (which is equation %o5). Now I want to take this equation and solve for v2 - so that it is in its usual form.
I don't know why it gave the expression twice. Update: As pointed out in the comments below, this is because there are two answers, a positive and a negative. End update If you just wanted 1 answer, you could type %o7; - I don't know why Maxima's arrays don't use the normal use of  being the first element.
Finally, if you want to get this as v2^2:
That is good enough to get some useful stuff done. Also, hello to future me. I am probably going to find this post 3 months from now when I forget how to do something in Maxima.
maxima is quite handy - and wxmaxima puts a cleaner look onto the program.
%o7 doesn't give the expression twice; it gives two separate solutions - negative and positive.
You got the expression twice in %o7 because you have to find the sqrt and negative sqrt of the equation (just like in the quadratic formula).
@wurmfood and @Lassi,
Wow - you are right. I didn't even see that. Thanks for pointing it out.
thanks for the post. i gotta remember all these physicsy tools you post about.
I've started using an app called Evernote (Evernote.com) for those bits of information that you will want at some undetermined point in the future.
Free app that will give you 20GB of storage per month. (No, I don't work for them.) Just like the app.
Definitely worth checking out.
Geez, I am so old that this computer algebra system looks like a real pain. I just retired from teaching math and physics for 35 years. The learning curve for students with these systems was pretty steep. We needed time in class to learn to use the systems. For high-school kids CAS was not a time-saver.
My good friend the low-pressure physics person loved Mathematica because he dealt with a lot of partial differential equations. (Low pressure was the field, not the attitude).
Different tools at different levels.
Thank you for pointing this out, Maxima is excellent.
By the way, here is a link to the 'Maxima book' - when you need further information.
I don't know why Maxima's arrays don't use the normal use of  being the first element.
If by "normal" you mean "C-like" then the reason might be because mathematics doesn't work like C. Plenty of other languages work like mathematics.
Yes, Maxima is quite wonderful! I've been using it for about 3 years now!
"It's free and free and runs on Mac OS X and Windows."
While true, it's very incomplete. It also runs on Linux and BSD and Solaris and whatever else. (In fact, it's available in ubuntu's repositories so it's readily available for installation on Linux/Ubuntu.)
additionally, it's free, but it's also Free (as in freedom), being licensed under the GPL. This is important because then it's not just a black box that you have to Just Trust like maple, matlab, mathematica, etc. You can go in and figure out how it works, audit the code, perform static code analysis to make sure it's safe to embed in a web page, etc. (or have someone knowledgeable/trusted do it, and anyone you send a copy to must be granted the same license as you got it under.)
I'm a linux user, so the refrains of "We support *both* operating systems, Windows *and* Mac!" starts to get tiring after a while. ;)