NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
October 20, 2017, 12:34:49 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Acting locally and thinking globally. ...Wisdom
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: how to make the left right button to vary x? for all modes  (Read 8005 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
on: June 02, 2009, 07:11:41 pm » posted from:Singapore,,Singapore

hi prof

currently, the left n right button works for mode singapore

code
action:
x=x+0.25714; right
and
x=x-0.25714; left

i need some tips on a generalized code for the other modes

attached in my attempt

i don't understand how to read some of your codes
Code:
if(mode.equals("0.02 mm version 1")){
 dycst=1.;
 n2s=51;
 dx2=49*dxm/50;
 nmode=5;
 L=50*dxm+size;
// l_unit="0.02mm";
 unit=0.02;
}else if(mode.equals("0.1 mm version 1")){
 dycst=0.;
 n2s=51;
 dx2=49*dxm/50;
 nmode=5;
 L=50*dxm+size;
// l_unit="0.1mm";
 unit=0.1;
}else if(mode.equals("0.05 mm version 1 singapore schools")){
 dx2=39*dxm/40*2; //
 n2s=21; // number of intervals on the lower scale
 dycst=1.; //
 nmode=2; //
 L=40*dxm+size;
// l_unit="0.05mm";
 unit=0.05;
}else if(mode.equals("0.1 mm version 2")){
 dx2=39*dxm/40*2;
 n2s=21;
 dycst=0.;
 nmode=2;
 L=40*dxm+size;
// l_unit="0.1mm";
 unit=0.1;
}else if(mode.equals("0.05 mm version 2")){
 dx2=19*dxm/20;
 n2s=21;
 dycst=1.;
 nmode=2;
 L=20*dxm+size;
// l_unit="0.05mm";
 unit=0.05;
}else if(mode.equals("0.1 mm version 3")){
 dx2=19*dxm/20;
 n2s=21;
 dycst=0.;
 nmode=2;
 L=20*dxm+size;
// l_unit="0.1mm";
 unit=0.1;
}
l_unit=unit+"mm";
x6[4]=x6[5]=x2+L;


i will try to figure out asap.



Embed a running copy of this simulation

Embed a running copy link(show simulation in a popuped window)
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!


*** There are 1 more attached files. You need to login to acces it!
« Last Edit: June 02, 2009, 07:13:20 pm by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: June 02, 2009, 07:25:13 pm » posted from:Taipei,T\'ai-pei,Taiwan

1.  dycst=0; no minor ticks. dycst=1; draw minus ticks.
  The length of the ticks are evated by dycst*minor_ticke_length.
2. 0.02mm case without minor ticks will be the same as 0.1mm case. That is why all the rest parameters are the same.
3. n2s is the number of ticks on the scale.
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #2 on: June 02, 2009, 10:35:43 pm » posted from:Singapore,,Singapore

i think i figure out a way! critical thinking from thinking whole day LOL.
thanks!

will report finding asap
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #3 on: June 03, 2009, 09:08:15 am » posted from:Taipei,T\'ai-pei,Taiwan

The code you wrote was:
x=x-0.25718;// take 257.16 divide 50 mm divide 20

which is equal to x=x-dxm/20.;  for your case (20 smaller division). Wink
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #4 on: June 03, 2009, 11:11:15 am » posted from:,,Singapore

i am making a super applet from remixing yours, thanks for code
x=x-dxm/20.; // for your case (20 smaller division).

just the right tip i need to make sense. Thanks!
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #5 on: June 03, 2009, 07:56:58 pm » posted from:Singapore,,Singapore

in the left button
i added code on action

if(x<=0){
x=0;
}
else {
x=x-increment;
}

initialization
i added
  increment = dxm/(1/unit);

it work beautifully, and i even added scaffolds to suggest the relationship

 if ( error == 0 ) {
 l_x="d="+l_x;
}
 else if ( vs*unit+(-error*unit) >= 1 ){
 l_x="d=" + dvalue((int)(x/dxm-1),unit)+ "+" +dvalue(vs*unit,unit)+ "+(" + dvalue(-error*unit,(unit))+ ") = " + l_x;
// l_x="d=" + dvalue((int)(x/dxm-1),unit)+ "+" +dvalue(vs*unit,unit)+ "+(" + dvalue(-error*unit,(unit)) + ")+ "=" ;
}
else if ( vs*unit+(-error*unit) <= 0 ){
 l_x="d=" + dvalue((int)(x/dxm+1),unit)+ "+" +dvalue(vs*unit,unit)+ "+(" + dvalue(-error*unit,(unit))+ ") = " + l_x;
}
 else {
  l_x="d="+l_x;
  }

it is a work of art and definitely a great java for sense making!

thanks!
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=684.msg2452#msg2452
to see this great applet!
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #6 on: June 03, 2009, 08:57:04 pm » posted from:Taipei,T\'ai-pei,Taiwan

Good works! I believe you did feel great when you find out how to solve it by yourself.
Logged
Pages: [1]   Go Up
  Print  
Acting locally and thinking globally. ...Wisdom
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
java applet showing modes in optical fiber
Wave
indian_boy 5 33375 Last post February 20, 2009, 06:31:15 pm
by concord
Ask about control button
Question related to Physics or physics related simulation
ahmedelshfie 1 3809 Last post January 28, 2010, 09:04:10 pm
by Fu-Kwun Hwang
Left Brain – Right brain and the Spinning Girl
illusion
Fu-Kwun Hwang 0 6603 Last post January 04, 2011, 07:54:08 am
by Fu-Kwun Hwang
can make ejs web java applet on click some button and full screen is shown?
Questions related to EJS
lookang 4 6058 Last post August 10, 2011, 02:49:37 pm
by lookang
Skydiver - can vary descent speed by adjusting orientation
Collaborative Community of EJS
LeeTl 0 2723 Last post April 18, 2013, 04:10:52 pm
by LeeTl
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.07 seconds with 23 queries.since 2011/06/15