Saturday, February 24, 2007

Using maxima -- baby steps

The use of symbolic computing makes it easy to visualize and solve problems that were otherwise dry and would put you to sleep. To test the simplicity of a freely available tool called maxima, I tried to solve a common problem with it.

The problem is quite simple, remember high school physics? Well I don't :-). Consider a tuning fork, which oscillates and produces a sound (depending on it's frequency).

We start by entering the mathematical model of the fork

'm*diff(x(t), t, 2)=-k*x(t);

Maxima prints


We now request maxima to solve the equation for us by

desolve([%],[x(t)]);

Maxima asks

Is k * m positive, negative, or zero? We say positive

Maxima prints



We ask maxima to simplify the result for us

radcan(%);

Maxima outputs



That's it, we have our solution.

No comments:

Ranking and Unranking permutations

I've been a big fan of Skiena's Algorithm Design Manual , I recently found my first edition of the book (although I own the third ed...