### Author Topic: Quiz: Do you know when two particles have the same horizontal speed?  (Read 13871 times)

#### Fu-Kwun Hwang

• Hero Member
• Posts: 3062
##### Quiz: Do you know when two particles have the same horizontal speed?
« on: July 13, 2008, 11:33:55 pm »
Registed user can get files related to this applet for offline access.
Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list

Click Play to start the simulation. Enter the time when you think those two particle have the same HORIZONTAL speed. (Enter into the text field and the answer will be shown).
You can change the initial velocity for both particle with your mouse (drag the RED arrow).
The horizontal velocity for the top one should be larger than the lower one.
The top one will move with constant velocity, while the second will need to move up the hill (with constant deceleration a=-g*sin?)
You can also drag the yellow box to change the height of the slope.
Two traces shows X(t) for both particles.  Try to find out the answer from those two curves.

*** Remember: You need to hit ENTER after you enter the value. (the box turn yellow if you did not hit ENTER)

I hope you got the correct answer!

Registed user can get files related to this applet for offline access.
Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list

#### lookang

• Hero Member
• Posts: 1774
• http://weelookang.blogspot.com
##### Re: Quiz: Do you know when two particles have the same horizontal speed?
« Reply #1 on: July 15, 2008, 09:51:35 am »
Feedback:
screen height can reduced a bit, currently can't see simulation n buttons in one view
The simulation is pretty cool, emphasis on the gradient concept of a X vs t graph gives the velocity.
I like it!

notice: t = 0 because when the field in yellow, user need to press enter key, so u need to inform them to remember to press enter? or has EJS 4.0 improved to take values in autodetect?

Question:
About the submit answer, can other people like me make assessment/ feedback strategies on our own simulation?

For Info:
I was doing something like this before
My Old Website:
http://66.7.205.91/~lookangc/indexold.html
My EJS Simulation on S.H.M.
http://66.7.205.91/~lookangc/_apps/_examples/weelookangspring05.app/weelookangspring05.html
Example Quiz: Click on that!
Very labor intensive for a good assessment and hints etc.
http://66.7.205.91/~lookangc/_apps/_examples/weelookangspring05.app/Q/weelookangshm01.htm

« Last Edit: July 15, 2008, 10:00:38 am by lookang »

#### Fu-Kwun Hwang

• Hero Member
• Posts: 3062
##### Re: Quiz: Do you know when two particles have the same horizontal speed?
« Reply #2 on: July 15, 2008, 10:31:02 am »
I checked out your web page. The way you did it, was implemented it with javascript code in html.
But What I did was implemented the answer in EJS, and the javascript code is used for sending data back to server and get user's record from the server. I tried to implemented it in a standard way. You can download the above EJS file and check out how I did it.

The following two methods were defined in the EJS, and the action for the text field input is checktime();
l_title is a String which will be displayed in the center of the simulation. The initial value is "";

public void checktime(){
if(!_isApplet() || server_control==0)
l_title=l_out1+dvalue(tmin)+l_out2+dvalue(Tmin)+ l_out3+ (100- (int)(Math.abs(Tmin-tmin)*100));
}
// _isApplet() is used to check if it were running as an applet. If it was not running as an applet (e.g. when you run it with EJS or click xxx.jar file directly to run it)
// server_control is another global variable defined, the initial value is 0.  Because user might have download the applet from our server and view the downloaded html file. The applet will be view locally (which was not connected to our server).
The above code to make sure user can run the simulation and find out the result when enter value into text field. But when it was running on our server, the String l_title will not be set (you can add whatever action you want).

public String ejs_commit(){
if(_isPaused() && t>0)checktime();
else l_title="";
return l_title;
}

The above function was defined so that it can be called directly from html with javascript. (You need to add mayscript="true" as part of applet tag. Check out the source code for this html and you will find the applet tag.

I add the button inside a form and add onclick function to call ejs_commit.
A javascript call was added (called when html is fully loaded) to set server_control to 1 so that l_title will be set to output when ejs_commit() was called.
Then I used AJAX to send result back to server and print out user's history records,too.

You can follow the above method on your server. There is a magic code you can add in this forum and the above javascript and forum will be added automatically. I can tell you via private message if you are interested. (Actually, you can find out how I did it, i.e. the secret code if you view my previous html source-- the one with the applet)

#### lookang

• Hero Member
• Posts: 1774
• http://weelookang.blogspot.com
##### Re: Quiz: Do you know when two particles have the same horizontal speed?
« Reply #3 on: July 22, 2008, 03:52:07 pm »