# NTNUJAVA: Virtual Physics Laboratory: Enjoy the fun of Physics

• Lesson 1: simple harmonic motion in 1D by:hwangat 2009/03/16 12:21This is a tutorial for simple harmonic motion(SHM) in 1D.
The equation for the SHM is Fx=-k*x;
EJS did not know how to solve the above equation. But it can solve first order differential equation.
The above is a particle move in x direction with velocity v, and it's velocity will change with time due to the above force (give acceleration ax).
So
d(vx)/dt= -k*x/m; // this equation tell EJS how the velocity should change with time.

dx/dt=vx; // this equation tell EJS how the x-coordinate change with time.

Movie is a snap shot of image at different time step. Simulation calculate the variable value at different time step and show it on the screen with GUI elements.
With the above two equations: EJS know how x/vx will change with time. So it will update it's new value and draw view elements according to your design.

The following is the simulation and the swf movie. Please download EJS xml source and modify the model to change it into a 2D SHM motion.

Hints: Change the resizable property for the arrow so that you can change it's size with your mouse when the simulation is in pause state.

Tutorial SWF file
[flash=923,620]http://www.phy.ntnu.edu.tw/ntnujava/swf/shmx.swf[/flash]

See 4 replies click

1. Re: Lesson 1: simple harmonic motion in 1D by:rubizoobiat 2010/02/17 15:32I just saw the Tutorial and it was very informative,
so if you have some more tutorials than please
share it with us so that we can also get to know

2. Re: Lesson 1: simple harmonic motion in 1D by:hwangat 2010/02/17 16:07Please check out EJS tutorial (How to create simulation with EJS) to find other tutorials.

There are many swf tutorials in Chinese can be found at http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=656.0

It is fine if you do not understand Chinese characters, but you can get the ideals how it works.

If you are really interested in EJS, try to use it. And you are welcomed to post any questions related to it.
Post what you want to do and attach the xml file. And I will try to help you solve it (create the simulation you want).

3. Re: Lesson 1: simple harmonic motion in 1D by:corartumat 2012/01/12 03:46Well explained tutorial. :) I've been looking for this for a while. Thanks. :)

4. Re: Lesson 1: simple harmonic motion in 1D by:aminbahgatat 2015/10/04 00:52i new member here thanks for the lesson ;)