Does damping change the frequency of an oscillator?
Most computers programs try to find numbers or curves that solve problems. A Computer Algebra System like Maxima is specialised in finding the formula that provides the solution instead:
Most of the times a formula can speak for itself. It can for example describe
the mechanism that causes a phenomenon or it can tell in which way a problem
can be optimized.
But it can obviously be used to generate numbers instead. Maxima might be better suited for doing this than many programs that claim to have been written for numerical work:
Note that computers use binary numbers and therefore cannot express an exact 0.1 as a floating-point number. The error the computer will introduce to approximate 1/10 as floating number is extremely small:
But sometimes simple tasks like finding the root of a polygon are extremely suspectible to small errors. Other times one step in solving an equation incorporates something like:
Never trust a program that automatically decides the following:
There are many such programs around.
Description of a complicated circuit
There are many good tutorials on Maxima. This document was just created instead to show it in action. We therefore grab a ridiculously complicated problem and see what the program can do:
The schematic of the circuit
Maxima can solve equation systems automatically:
It even introduces additional variables like %r1 to show there is more than
But it can of course shorten equation systems by introducing one equation into another like we will do with the equations we have previously named g4 and g1:
One could do this on step on paper, too. But when doing a long list of calculations the paper-approach is too prone to errors for this to be practical. So let us evaluate g2 and g3 with the knowledge we have from the last step:
Combining the last two results we get a one-line description of the problem:
Perhaps things look nicer if we combine the right- and the left hand side of this equation:
Solving the differential equation
The naïve approach
Maxima will try to find a formula that solves differential equations if they are
in the "one time-dependent variable per equation" form - which the
differential equation is in by now.
Since a differential equation describes all potential shapes a curve can assume but doesn't describe the actual height nor which of these possibilities are actually used in reality the result looks quite monstrous in this case:
If we answer the question differently the form the answer is presented in does change:
This time the question maxima has asked doesn't actually change the shape of the curve that solves the differential equation, though. It just determines if the program combines the exp() functions that solve the problem to sinusses.
A starting value
Maxima maintains a database of known facts. We can use this database to tell the program about the starting values of the curve it is about to generate. The first of these values is easy to acquire: We want to start with a discharged capacitor:
The second condition could be calculated using our initial equation system and knowledge about the current through the inductor. Or we can tell maxim we want to know a condition that makes the sinus go away:
Let's assign 'diff(U_C(t),t) the right-hand-side of the first element in this equation list for the case that t=0.
We also can inform maxima about enough facts about the problem it does need to ask the same question again:
Now that the solution does no more need to be this general it does look much cleaner:
The actual result
From the last equation one can easily see that the resonance frequency is in fact dependent on the damping:
Visualization of the result
Real circuit element values
We wnt to variate R, but the actual values of L and C don't really matter so we can set them for example to 1:
It is always good to keep real numbers separate from the actual formula so one can switch between displaying tha formula and the result:
To make the command for plotting shorter we should assign the right-hand-value of the solution of the differential equation with the applied element values in a macro, though:
Maxima will keep all variables it doesn't currently know the value of as symbols. So looking if defining the functions work is easy:
The following animation now demonstrates how little damping actually affects the frequency:
/* The parameter we want to assign to the slider and all values it can assume */
/* The thing we actually want to draw */
Normally animated 2D plots are easier to read than 3D ones. But just to show that we can produce an especially shiny one, we do this, too:
This example has been created by the HTML export-feature of a post-15.04 wxMaxima.