Interactive Sine Wave

Here is an implementation of a trigonometric function, plotted as a 2D graph. Interactive controls are available to alter the graph dynamically. The sine wave plotted incorporates parameters commonly used in physics. You can directly control the amplitude (A), phase (phi), and the angular frequency (k).

Try it now! Click on the slider bars in the Flash example above to change the sine waves properties.

There are also some basic graph options that can be set via check boxes, these can be toggled on/off. Finally, there is a useful function that is a good thing to have in any application, and that is a reset button. This simply resets the graph back to the state when first loaded. This example is coded using ActionScript 2.0.

Extending this example to graph any function is fairly straight forward and could handle some quite complex equations with multiple parameters. The range of each axis would have to be carefully rendered though to make sure the graph ‘zoom’ was correctly set, otherwise the graph may not display correctly.

This entry was posted in ActionScript, Flash, Mathematics and tagged , , , , , , , , , , , . Bookmark the permalink.

7 Responses to Interactive Sine Wave

  1. Donald May says:

    As an 8th grade Physical Science teacher I needed something to show my students about changing frequency and wavelength. Your interactive graphic fit the bill. Thanks
    Donald L May
    East Paulding Middle School
    Dallas GA 30157

  2. David says:

    Thanks Donald, it is nice to know you found our interactive sine graph useful. This example is typical of the sort of application we create for our clients. Any feedback from yourself or some of your students would be welcome, as would any suggestions for future applications.

    Also, we plan to release a much more comprehensive version of this particular example sometime in the future, so watch this space!

  3. Steven says:

    Why does your graph start going towards the negative direction of the y-axis?. When you reset it, the dilation factor is “positive one” from the x-axis, however when your graph resets, the “Amplitude” value is 1, but yet your graph turns out to be a negative sin graph (relection in the x-axis)

  4. David says:

    Dilation factor?

    It’s a Sine wave, what more can I tell you! Amplitude is reversed yes, just needs updating. 😉

  5. Peter says:

    I discovered your interactive graph when trying to find a program to show my student how the sine varies with the angle. I found the perfect one, even with more parameters A, k and phi. Thanks David.

  6. David says:

    Hi Peter,

    Glad you found it useful. If you are interested I have implemented an updated version which works properly now. :)

    There is also a Cosine version too. You can find them here at our sister site:

  7. Allan says:

    This is great! I’m wondering if you could post the ActionScript used to create this type of curve or at least just the formula(code wise) to achieve this.

Leave a Reply

Your email address will not be published.