NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => Collaborative Community of EJS => Topic started by: lookang on December 17, 2008, 04:37:00 pm



Title: Ejs Open source Newton's Cradle java Applet by Paco customized by lookang
Post by: lookang on December 17, 2008, 04:37:00 pm
http://home.phy.ntnu.edu.tw/~lookang/EJS_4.1_090115/NewtonsCradlewee_Simulation.html
Open source Newton's Cradle Applet by found in EJS 4.1 user/murcia/fem/mechanics
Ejs Open source Newton's Cradle java Applet by Paco customized by lookang

http://www.egglescliffe.org.uk/physics/physicists/newton/nlaws/collision.html
Collision  Analysis
Assumptions:
  * Spheres are perfectly smooth
  * Collisions are head on.
  * Energy is purely translational and not rotational or vibrational

[ejsapplet]

alternative 2 versions here
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1976.0 by Fu-Kwun Hwang !! ;D


Title: Re: Newton's Cradle Applet by found in EJS 4.1 user/murcia/fem/mechanics
Post by: Fu-Kwun Hwang on December 17, 2008, 09:04:33 pm
Paco is a Professor at Universidad de Murcia in Spain.

The following is the offical address (http://www.um.es/)
Universidad de Murcia. Avda. Teniente Flomesta, nº 5 - 30003 - Murcia · Teléfono


Title: Re: Newton's Cradle Applet by found in EJS 4.1 user/murcia/fem/mechanics
Post by: lookang on December 18, 2008, 07:33:48 am
Yes! think the xml originally made by prof. paco, the tags and descriptions did not clearly state so i can't attribute future derived works.

i can only guess from the folder names.

thanks!

EJS 4.1 has a lot of improvements over EJS 3.47, everyone should get the latest version to try ;)

a cool Newton's Cradle applet that i always wanted to know how to make it a learning tool.

murcia is the name of the person? or is it Prof paco ? University of Murcia fem@um.es ?


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


My learning journey for interactive balls mass, the codes i was looking for,
note: element is assigned variable name "ballMoved"

Code:
// Compute new angle and freeze the ball
alpha[ballMoved] = Math.atan2(x[ballMoved]-xTop[ballMoved],yTop-y[ballMoved]);
omega[ballMoved] = 0;

// Limit the motion
double maxAngle = Math.PI/2;
if (alpha[ballMoved]> maxAngle) alpha[ballMoved] =  maxAngle;
if (alpha[ballMoved]<-maxAngle) alpha[ballMoved] = -maxAngle;

// Check for one ball moving the others
for (int i=ballMoved+1; i  if (alpha[ballMoved]>alpha[i]) { alpha[i] = alpha[ballMoved]; omega[i] = 0; }
}
for (int i=0; i  if (alpha[ballMoved]}

// Force constant rod length
for (int i=0; i  x[i] = xTop[i] + l*Math.sin(alpha[i]);
  y[i] = yTop - l*Math.cos(alpha[i]);
}
please note the codes has missing ++ symbols, due to forum's modified php?
so if you want to copy the codes go into the source xml files


source code
download the *.jar for using the applet on standalone without internet connection.


Title: Re: Ejs Open source Newton's Cradle java Applet by Paco customized by lookang
Post by: aidooon on October 10, 2010, 04:53:39 am
hello ppl. .
i am working on a simulation for this newton's cradle. .
i want to make the simulation myself
but i like to get use of this cute simulation in here. .
so may u please put here a full physical study for newton's cradle. . so that i can start working on the simulation. .
thanx alot . .


Title: Re: Ejs Open source Newton's Cradle java Applet by Paco customized by lookang
Post by: lookang on October 10, 2010, 06:56:19 am
The physical model is
. Var. = t      Increment   = dt
alpha=   omega
omega=   -g/l*Math.sin(alpha)-k*l*omega

All ejs models in this forum are open sourced.
Try to use ejs to read the codes.

Good luck!


Title: Re: Ejs Open source Newton's Cradle java Applet by Paco customized by lookang
Post by: ahmedelshfie on October 10, 2010, 07:00:15 am
A good applet, i didn't see this applet before.
I have a comment about one thing the sound of applet seem fast more than movement.
May wrong in my browser  ???
  


Title: Re: Ejs Open source Newton's Cradle java Applet by Paco customized by lookang
Post by: lookang on October 10, 2010, 07:51:45 am
The code for the sound play and off is not good enough to handle multiple hits in very close time.
I don't know how to make it better.

But you are right ahmed, the problem is the code not powerful for the sound.


Title: Re: Ejs Open source Newton's Cradle java Applet by Paco customized by lookang
Post by: lookang on October 11, 2010, 10:35:46 pm
hello ppl. .
i am working on a simulation for this newton's cradle. .
i want to make the simulation myself
but i like to get use of this cute simulation in here. .
so may u please put here a full physical study for newton's cradle. . so that i can start working on the simulation. .
thanx alot . .
http://www.phy.ntnu.edu.tw/ntnujava/ntnujavazip.php?ejsuserjar=3114
Download the jar
Unzipped it
Inside the folders there should be the java file.
Can find?

I think you should be able to figure out the equations from the open sourced xml or java, do your own homework  ;)

In a Newton's Cradle , hard steel spheres hang at rest side by side. If one or more of the spheres is displaced and released , near elastic collisions ensue. http://www.egglescliffe.org.uk/physics/physicists/newton/nlaws/collision.html

Collision  Analysis
Assumptions:
    * Spheres are perfectly smooth
    * Collisions are head on.
    * Energy is purely translational and not rotational or vibrational
    * Collisions are perfectly elastic


alternative 2 versions here
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1976.0 by Fu-Kwun Hwang


Title: Re: Ejs Open source Newton's Cradle java Applet by Paco customized by lookang
Post by: lookang on October 12, 2010, 10:06:18 pm
trying to make sound in array format.

but the sound still don't sound very realistic due to lack of intensity of hits proportional to sound loudness.

currently it just play the wav file


Title: Re: Ejs Open source Newton's Cradle java Applet by Paco customized by lookang
Post by: lookang on May 13, 2011, 10:27:54 pm
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

enjoy!


Title: Re: Ejs Open source Newton's Cradle java Applet by Paco customized by lookang
Post by: lookang on May 15, 2011, 11:18:40 pm
added 3D
work in progress!


Title: Re: Ejs Open source Newton's Cradle java Applet by Paco customized by lookang
Post by: lookang on May 17, 2011, 02:53:45 am
this simulation version has been replaced by Ejs Open Source Newton's Cradle Java Applet by Fu-Kwun & lookang http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2195.0
enjoy!

my blog to make my Ejs simulations more searchable on the internet for open educational resource OER :)
http://weelookang.blogspot.com/2011/05/ejs-open-source-newtons-cradle-java.html