Author Topic: Ejs Open Source Newton's Cradle Java Applet by Fu-Kwun & lookang  (Read 25060 times)

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1774
  • http://weelookang.blogspot.com
    • lookang web
Ejs Open Source Newton's Cradle Java Applet by Fu-Kwun & lookang, this version has best collision detection by Fu-Kwun.

this is a derived work based on Fu-Kwun Hwang's original Real Newton's Cradle here http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1976.msg7387#msg7387

this remixed was a necessary as it has better collision detection than my older remix here Ejs Open source Newton's Cradle java Applet by Paco customized by lookang http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=824.0

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • Please feel free to post your ideas about how to use the simulation for better teaching and learning.
  • Post questions to be asked to help students to think, to explore.
  • Upload worksheets as attached files to share with more users.
Let's work together. We can help more users understand physics conceptually and enjoy the fun of learning physics!


reference: http://en.wikipedia.org/wiki/Newton%27s_cradle
Newton's cradle
Newton's cradle, named after Sir Isaac Newton, is a device that demonstrates conservation of momentum and energy via a series of swinging spheres.

Construction
A typical Newton's cradle consists of a series of identically sized metal balls suspended in a metal frame so that they are just NOT touching each other at rest. Each ball is attached to the frame by two wires of equal length angled away from each other. This restricts the pendulums' movements to the same plane.

Action
If the first one ball on the left is pulled away and is let to fall, it strikes the second ball in the series and the the first ball comes to an almost dead stop. The ball on the opposite side of the series acquires the momentum of the first ball almost instantly and swings in an arc that one would expect of the first ball.

The intermediate balls appear almost stationary. What actually happens is that the first impact transfer momentum and kinetic energy from the first ball to the second. The second ball having the momentum and kinetic of the first ball now hits almost perfectly elastic with the third ball, transferring it's momentum and kinetic energy to the third ball in the series. This transfer of momentum and kinetic energy continues until the (n-1) and n ball, where finally the last ball n moves off with the momentum and kinetic energy of the first ball. Toward the end of oscillation, the intermediate balls are jiggling a bit.

Further intrigue is provided by starting more than one ball in motion. With two balls, exactly two balls on the opposite side swing out and back. While this is satisfyingly symmetrical, why could not one opposite ball swing out twice as fast, or four balls at half speed? Having the same number of balls swing on each side conserves both energy and momentum.

Further Physics
Newton's cradle is a clear visual example of the conservation of both momentum (mass x velocity) and kinetic energy (0.5 x mass x velocity^2) in a mechanical system. When the cradle only has two balls, these two principles are sufficient to specify its behaviour; i.e. there is no way of conserving momentum and energy when the first ball strikes the second other than for the first to stop and the second to move off at the same speed as the first.
For example, if the balls each have a mass of 1 and the first ball strikes the other two stationary balls with a velocity of 1, the initial momentum of the system is 1 x 1 = 1 and the kinetic energy is 0.5 x 1 x 1^2 = 0.5. If the first balls stops and the third ball moves off with a velocity of 1 (which is what actually happens), the momentum remains 1 and the kinetic energy remains 0.5.
However, if the first ball were to bounce backwards with a velocity of -1/3 and the second and third balls were to move forward each at a velocity of 2/3, the momentum would be 1 x (-1/3 + 2/3 + 2/3) = 1 and the kinetic energy 0.5 x 1 x ((-1/3)^2 + (2/3)^2 + (2/3)^2) = 0.5; i.e. this would also preserve both momentum and kinetic energy; however, it is not what happens.
The reason is because the collisions are actually with free individual balls and not with 2 connected-joint balls.
What actually happens is that the first impact transfer momentum and kinetic energy from the first ball to the second. The second ball having the momentum and kinetic of the first ball now hits almost perfectly elastic with the third ball, transferring it's momentum and kinetic energy to the third ball in the series. This transfer of momentum and kinetic energy continues until the (n-1) and n ball, where finally the last ball n moves off with the momentum and kinetic energy of the first ball. Toward the end of oscillation, the intermediate balls are jiggling a bit.

Applications
The most common application is that of a desktop executive toy. A less common use is as an educational aid, where a tutor explains what is happening or challenges students to do so.
« Last Edit: July 26, 2011, 08:20:04 pm by lookang »

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1774
  • http://weelookang.blogspot.com
    • lookang web
Re: Ejs Open Source Newton's Cradle Java Applet by Fu-Kwun & lookang
« Reply #1 on: May 17, 2011, 03:32:50 am »
changes:

some of my earlier contribution in 2008
My contributions are
1. changes made to sync top rectangle to appear directly above the string and mass for changing number of mass, n
2. input panel on the left
3. create a custom function drag() so that can read the codes clearly in a bigger view
4. added m"[j]"
5. add graph of ketotal, petotal tetotal
6. add angular momentum
7. added sound in collision
8. added dw[j]/dt = -g/l*Math.sin(alpha[j])-k*l*omega[j] for air resistance simulation
9. redesign the look and feel of the sliders bar etc
13May2011
added better controls
fix bug of KE = 0.5*m*l^2*omega^2
fix error by changing method back to BISECTION
made view more zoom in for increase in size
17May 2011, took about 3 hours to combine the features in both simulations
based on Fu-Kwun Hwang's original Real Newton's Cradle here http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1976.msg7387#msg7387
used codes from Ejs Open source Newton's Cradle java Applet by Paco customized by lookang http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=824.0
drag from paco added
added 3D
rework the simulation to suit better results from real collision
changes solver to velocity verlet as the others kept giving errors
added sound // sound effect added despite the energy conservation
Toolkit.getDefaultToolkit().beep(); // taken from http://www.compadre.org/OSP/items/detail.cfm?ID=8385&Attached=1
//Ceiling Bounce Model written by Wolfgang Christian
18May2011
made ballMoved the key to change mass m[ballMoved] instead of the older code m[id]
change the codes to layout the balls from left to right instead of the older right to left format
26 july 2011
made the xmin and xmax follow the number of balls, n for centralized view
26july 2011
make dt smaller for slower and smoothly run
checkbox for sound

« Last Edit: July 26, 2011, 08:58:45 pm by lookang »

ahmedelshfie

  • Hero Member
  • Posts: 930
Re: Ejs Open Source Newton's Cradle Java Applet by Fu-Kwun & lookang
« Reply #2 on: May 17, 2011, 06:17:21 pm »
Nice, i like the idea good work, i notice have a bug in 3d i not sure in my computer have it may only in my PC is
when i tried to change postion the 3d applet appear look like black screen and also disappear too fast and back again too fast.

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1774
  • http://weelookang.blogspot.com
    • lookang web
Re: Ejs Open Source Newton's Cradle Java Applet by Fu-Kwun & lookang
« Reply #3 on: May 17, 2011, 11:09:16 pm »
Hi ahmed,
i suspect that Ejs 4.3.3.1 latest version is causing this bug in the compiled simulations.

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1774
  • http://weelookang.blogspot.com
    • lookang web
Re: Ejs Open Source Newton's Cradle Java Applet by Fu-Kwun & lookang
« Reply #4 on: May 18, 2011, 11:01:47 pm »
18May2011
made ballMoved the key to change mass m[ballMoved] instead of the older code m[id]
change the codes to layout the balls from left to right instead of the older right to left format

enjoy!

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1774
  • http://weelookang.blogspot.com
    • lookang web
Re: Ejs Open Source Newton's Cradle Java Applet by Fu-Kwun & lookang
« Reply #5 on: July 26, 2011, 04:26:17 pm »
submitted to http://www.compadre.org/osp/index.cfm for their consideration into the digital library

Newton's Cradle Model
reference: http://en.wikipedia.org/wiki/Newton%27s_cradle
Newton's cradle, named after Sir Isaac Newton, is a device that demonstrates conservation of momentum and energy via a series of swinging spheres.

Construction in 3D
A typical Newton's cradle consists of a series of identically sized metal balls suspended in a metal frame so that they are just NOT touching each other at rest. Each ball is attached to the frame by two wires of equal length angled away from each other. This restricts the pendulums' movements to the same plane.
Mathematical Model:
the simplified equations of motion is ODE for a single mass(pendulum) are:
d (cta)/dt = omega
d(omega)/dt = -g*sin(cta)/L

Design features:
currently, the simulation allows of exploration of n max = 7 masses with each mass m[ii] that can be vary from the slider control from 1 to 5 kg.
additional variables are:
gravitational constant downward g = 9.81 m/s^2
Length of pendulums, L
k coefficicent of air resistance model by equation F = k*omega

The usabilty control:
To move the balls, move the cursor over to the mass, click and hold the left mouse and drag the mouse to lift the masses. note that all masses are selectable and movable to a new height along the each path of the pendulums swing.

Design Views:
there are 2 types views available selectable by the check-boxes 2D and 3D,
2D world view
3D world view
hint:
may be useful to observe the transfer of linear momentum from ball to ball by pressing the step button to aid understanding of momentum transfer during collisions
may be useful to observe the scientific representations of kinetic energies KE[ii], gravitational potential energies PE[ii] and total mechanical energies TE[ii]
graph of scientific representations of kinetic energies KE total, gravitational potential energies PE total and total mechanical energies TE total
Exercises:
select n =2 for a simple 2 ball system for the experiment.

Pull and release one ball. Note the results and explain mathematically in terms of conservation of engergy and momentum.
m1 u1 + m1 u1 = m1 v1+ m2 v2
1/2 m1 u1^2 + 1/2 m2 u2^2 = 1/2 m1 v1^2 + 1/2 m2 v2^2
record your observations and discuss if the two equations above can account for the observations

select n = 3 , 4, 5, 6, 7 and repeat the experiment above.
Do the results meet your expectations?
hint: can you conclude that the just before and just after collisions
momentum in = momentum out
kinetic energies in = kinetic energies out.
the clue lies in the conservation of momentum and kinetic energies just before and after collisions.


Discuss what are the differences between this computer model and real life apparatus.
hint: the newton's cradle motion will continue in this back and fro motion until all energies are lost to damping due to air resistance, friction, sound and vibrations.

In this simulation the default is all balls have the same mass. What would occur if this was not the case?


Advanced Learner:
Please submit your remix model that model features that are not available in the existing virtual lab and share your model with the world through NTNUJAVA Virtual Physics Laboratory http://www.phy.ntnu.edu.tw/ntnujava/index.php?board=28.0. Impacting the world with your model now.
Credits:

The Newton's Cradle Model was created by Fu-Kwun Hwang, customized by Loo Kang WEE, using the Easy Java Simulations (EJS) version 4.3.3.2 authoring and modeling tool. An applet version of this model is available on the NTNU website < http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2195.0 >.

You can examine and modify this compiled EJS model if you run the model (double click on the model's jar file), right-click within a plot, and select "Open EJS Model" from the pop-up menu. You must, of course, have EJS installed on your computer. Information about EJS is available at: and in the OSP comPADRE collection .
« Last Edit: July 26, 2011, 04:27:53 pm by lookang »

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1774
  • http://weelookang.blogspot.com
    • lookang web
Re: Ejs Open Source Newton's Cradle Java Applet by Fu-Kwun & lookang
« Reply #6 on: July 26, 2011, 08:57:42 pm »
accepted!
http://www.compadre.org/osp/items/detail.cfm?ID=11348&S=7

wolfgang also gave some pointers to

26july 2011
make dt smaller for slower and smoothly run
checkbox for sound

done!

enjoy!