NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
October 19, 2017, 06:07:36 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  
Progress is impossible without change; and those who cannot change their minds cannot change anything. ..."George Bernard Shaw(1865-1950, Irish dramatist, essayist and critic, Nobel Prize for Literature 1925)"
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 a vectorField2D dynamically selectable?  (Read 4574 times)
0 Members and 2 Guests 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: September 29, 2010, 03:11:44 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

how to make a vectorField2D dynamically selectable?

currently i can make it show if i go inside Ejs and change n = 11 to n =30.

but i can't remember and i can't find previous posting on this
can ask how to make a vectorField2D dynamically selectable?

want to allow students to vary the visual vectorField2D to see that it is just a representation like in the 2 attached picture.

thanks!
trying to make a better version of this http://webphysics.davidson.edu/physlet_resources/bu_semester1/c17_field.html http://webphysics.davidson.edu/physlet_resources/bu_semester1/index.html in Ejs

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!


* n11.PNG (33.35 KB, 605x641 - viewed 307 times.)

* n30.PNG (41.51 KB, 597x638 - viewed 270 times.)
« Last Edit: September 29, 2010, 03:16:06 pm by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: September 30, 2010, 04:48:37 pm » posted from:Taipei,T'ai-pei,Taiwan

Quote
how to make a vectorField2D dynamically selectable?
What do you mean? Do you mean show/hide vectorField2D?
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #2 on: September 30, 2010, 05:50:32 pm »

Not show/hide. I know that already hahaha. Visible=true

What I need to understand:
A slider n that controls number of field vectors array [n][n] to plot.
See the 2 pictures attached in first post.
« Last Edit: September 30, 2010, 05:55:42 pm by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #3 on: September 30, 2010, 10:35:15 pm » posted from:,,Taiwan

I have not done this before.
The following way might work. (But I am not sure).
EJS use the variable name to find out the dimension for that variable (to draw those vectors).

So you need to dynamically re-define/re-assign the array.
e.g. bx=new double[nx][ny]; by=new double[nx][ny]
And assign values (with loop) to those two arrays.

Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #4 on: October 01, 2010, 08:00:41 am » posted from:SINGAPORE,SINGAPORE,SINGAPORE

u r a geniune!
thx!

i got it to work!
cool!
the code looks like this

Code:
n=ns;
gx=new double[n][n]; gy=new double[n][n];
for(int i=0;i<n;i++){
 for(int j=0;j<n;j++){
gx[i][j]=0;
gy[i][j]= g;

 }
}
Logged
Pages: [1]   Go Up
  Print  
Progress is impossible without change; and those who cannot change their minds cannot change anything. ..."George Bernard Shaw(1865-1950, Irish dramatist, essayist and critic, Nobel Prize for Literature 1925)"
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
is it possible to make applet make a sound when i condition is met?
Questions related to EJS
lookang 8 10178 Last post December 22, 2008, 12:10:01 pm
by lookang
how to make a differentiation of a string?
Questions related to EJS
lookang 5 7759 Last post January 30, 2009, 02:29:12 am
by lookang
how to make the vectorField2D appears as zero when the value is zero?
Questions related to EJS
lookang 3 3601 Last post April 15, 2010, 08:10:10 pm
by ahmedelshfie
how make loop for array for y coordinates?
Questions related to EJS
lookang 14 12241 Last post May 14, 2010, 11:22:41 pm
by Fu-Kwun Hwang
how to make the angle always acute between two lines?
Questions related to EJS
lookang 2 3308 Last post June 29, 2010, 11:06:13 pm
by Fu-Kwun Hwang
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 5.071 seconds with 23 queries.since 2011/06/15