Studiolino

2009-01-13

An oscillator

This formula describes an simple oscillator and serves as a vehicle for expanding my knowledge about Sage:
The first step is to make it a bit more intresting. I add two oscillators and choose some arbitrary constants:
Now I know the position of the oscillating particle, then I calculate the first derivative to get the particle's velocity:
The next logical step is to do a graph of the functions:

The green lines indicate the two parts of the oscillator; the red line is the compound function; and the blue is the velocity.

The last step is to make a graph of position versus velocity and that graph looks really neat:

The change of color indicates the pasage of time. The sequence starts as red, and turn into yellow; green; blue and purple.

The whole thing is pretty simple to do even though a few Python constructs are needed.

Labels: , ,