NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
March 26, 2017, 10:28:53 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  
There is a better way to do it; find it. ..."Thomas Edison(1847-1931, American inventor, 1093 patients)"
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: Summation of vectors  (Read 51533 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3079



WWW
«
Embed this message
on: June 25, 2005, 10:45:35 am »

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
If java program did not show up, please download and install latest Java RUN TIME

This applet shows how to add several vectors together.
You can change the number of vecotrs with slider bar.



You are welcomed to check out related applet: How to do summation of three vectors


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
If java program did not show up, please download and install latest Java RUN TIME
Logged
sreejat
Newbie
*
Offline Offline

Posts: 3

«
Embed this message
Reply #1 on: January 05, 2006, 09:15:35 pm »

Plz send me the xml file of this to:
sreejat@it.iitb.ac.in
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3079



WWW
«
Embed this message
Reply #2 on: January 06, 2006, 09:47:08 am »

You should have received xml file in your email account.
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #3 on: May 02, 2008, 11:02:12 am »

working on a similar applet

for learning:

Add two vectors to determine a resultant by a graphical method
taken from http://www.seab.gov.sg/SEAB/oLevel/syllabus/2009_GCE_O_Level_Syllabuses/5058_2009.pdf

work in progress.....


and then for
add and subtract coplanar vectors.
taken from http://www.seab.gov.sg/SEAB/aLevel/syllabus/2008_GCE_A_Level_Syllabuses/8866_2008.pdf

« Last Edit: May 02, 2008, 11:04:09 am by lookang » Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #4 on: May 07, 2008, 08:42:22 am »

another work in progress, but i think u will like it.

enjoy Grin
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #5 on: May 07, 2008, 11:02:07 am »

question:

how did u make the resultant to be drawn using the array?


i can't figure out the variable assigned to the resultant?

i tried PX[2] and PY[2] thinking that is how u loop the adding but the display shows zero.

Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3079



WWW
«
Embed this message
Reply #6 on: May 07, 2008, 12:14:16 pm »

for example:

define n=30; R=100.; and declear xp[n],yp[n] at Variable Panel
Then I can add the following code at Initialize Panel to draw a circle.
Code:
double dc=Math.PI/n,c;
for(int i=0;i<n;i++){
 c=i*dc;
 xp[i]=R*Math.cos(c);
 yp[i]=R*Math.sin(c);
}
Assign xp,yp as x,y property for polygon, and set the number of point to n
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #7 on: May 07, 2008, 03:42:34 pm »

ok, thanks for the reply.....

i solved the problem by reassigning my own variables.


i am thinking of making a 4 check boxes,

which only one can be choosen at any time.

0. none
1. style 1
2. style 2
3. style 3

http://www.colorado.edu/physics/phet/simulations/vectormath/vectorMath.swf
any simple solution like a drag and drop menu or checkbox?

or do i need to write a object code for it? any sample link on the forum ?

thanks!!
« Last Edit: May 07, 2008, 03:44:29 pm by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3079



WWW
«
Embed this message
Reply #8 on: May 07, 2008, 10:58:59 pm »

1. You can select multiple checkboxs (square one), But you only select one from radio buttons. (circle one)
2. Why you need a menu or check box to be able to drag and drop? Do you really mean that you want to be able to drag and drop those vectors. You just create ArrorSet in the view and it can be dragged one at a time.

 You can also create ArrowSet which is invisible. And when you click on it, make one of the arrow move with the mouse position (You can get mouse coordinate x,y from property of DrawingPanel). Then you have a drag and drop effect.

I believe I can give you better suggestion if you write download in detail what you really want to do.

Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #9 on: May 12, 2008, 10:58:46 am »

look at my xml


the buttons seems to be working the way i want, when checked show the components


but i followed the logic in http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=544.0

by using the
Action On
showComponent2=showComponent3=None=false;

but it doesnt work like yours on http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=544.0

chance to look at my code
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3079



WWW
«
Embed this message
Reply #10 on: May 12, 2008, 10:49:52 pm »

I did check out your file. But I am really confused because you have variable named the same as function name (e.g.  showComponent).

I do not know what the purpose for those functions. Please explain in detail what you want to do and the way you try to implement. 
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #11 on: May 13, 2008, 07:52:49 am »

these pictures may help, that is what i want, only one state at any time.
the buttons on the right bottom is my attempt to make the one state show component.

my current applet has 4 buttons which allows learner to toggle between the 4 states of components but to turn off, need to recheck the checkboxes. (NOT what i want)

0. None
1. show component 1
2. show component 2
3. show component 3
« Last Edit: May 13, 2008, 07:59:21 am by lookang » Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #12 on: May 19, 2008, 09:47:47 pm »

i think u want this to debug?
thanks!
« Last Edit: May 19, 2008, 10:20:03 pm by lookang » Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #13 on: May 20, 2008, 12:21:48 am »

http://www.ted.com/talks/view/id/216

this video is talking about new ways of collaboration , like me n you !


html code not enabled?


Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3079



WWW
«
Embed this message
Reply #14 on: May 20, 2008, 09:37:31 pm »

It is really a nice talk. I like the ideas and we should all start to share our knowledge and collaborate with each other to make a better world for us and for our children. If you can read Chinese, you are welcomed to visit my Chinese physics forum at http://www.phy.ntnu.edu.tw/demolab/phpBB/ . You will also find more educational resources. If you are interested in content management system, visit http://enjoy.phy.ntnu.edu.tw/  (I was modified from moodle + blog + wiki + ... many free tools developed by people around the world.)
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #15 on: May 20, 2008, 10:10:45 pm »

yes i will visit....btw can look at my codes on the component thingy? thanks!
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3079



WWW
«
Embed this message
Reply #16 on: May 20, 2008, 11:14:12 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
If java program did not show up, please download and install latest Java RUN TIME

There is some error when I open your xml. However, I create another example for you.
I think the effect shown in the following applet is what you want. You can download the xml file and find out what I did. You can also drag the vector.


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
If java program did not show up, please download and install latest Java RUN TIME
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #17 on: May 20, 2008, 11:29:39 pm »

close enough!!!

i will look at the codes soon Smiley
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #18 on: May 21, 2008, 12:04:43 am »

i figured out the logic, by trial n error Smiley


VIEW2[1]=false;
VIEW2[2]=false;
VIEW3[1]=false;
VIEW3[2]=false;
VIEW4[1]=false;
VIEW4[2]=false; for None

or for(int j=1;j<n;j++)
  VIEW2[j]=false;
  VIEW3[j]=false;
  VIEW4[j]=false;

the variables controlling them is VIEW2,VIEW3,VIEW4 and NOT showComponent2,showComponent3,showComponent4.


« Last Edit: May 21, 2008, 12:08:47 am by lookang » Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #19 on: May 21, 2008, 12:49:37 am »

what does this code do?

Code:
public void showComponent () {
  for(int i=1;i<n;i++)
  VIEW2[i]=showComponent;
}


i was changing it to VIEW3[i]=showComponent; or VIEW4[i]=showComponent;


but the applet appears to behave the same way



i managed to get the None, and First component to work fine even for 2 vectors A and B


But when only one vector A, everything works the way i can understand

but when vector A and B, the 3rd and 4th button shows the resultant ??

i not good with array, can explain ? Grin
« Last Edit: May 21, 2008, 10:42:29 pm by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3079



WWW
«
Embed this message
Reply #20 on: May 21, 2008, 04:51:45 pm »

The following code does not make sense

public void showComponent () {
  for(int i=1;i<n;i++)
  VIEW2=showComponent;
}

It is the same as

public void showComponent () {
  VIEW2=showComponent;
}

Because you are asking java to do the same instruction: VIEW2=showComponent; n-1 times.


for loop is used for doing repeated jobs. Normally works better with array.
i=1; // is for initialization (Normally, i will be set to 0, because array starts from 0, for example: if you define x[n], then you will have n variables: x[0], x[1],...[x[n-1])
 
Then it will do whatever inside the for loop,
 when it is done, it will execute i++ (i++; is the same as i=i+1;).
So , i become 2, and it will do whatever inside the for loop again,
...  repeate if i<n is satisfied.
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #21 on: May 21, 2008, 10:37:20 pm »

i think this forum setting recognize the square bracket as codes like html and /html

but strange in earlier posts no problem displaying
Code:
[i]

italics !!!!! i see

i had the array i in square bracket when i copy and paste but the forum disable them...

no wonder it does not mean sense Sad
« Last Edit: May 21, 2008, 10:47:34 pm by lookang » Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1783


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #22 on: May 21, 2008, 10:40:02 pm »


i think firefox got problem with java in new versions, recently java keeps hanging/crashing firefox
« Last Edit: May 21, 2008, 10:48:07 pm by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3079



WWW
«
Embed this message
Reply #23 on: May 22, 2008, 05:18:42 pm »

The php script for this forum was updated to latest version a few days ago.
But I think you still can use command between square bracket. For example:
Quote
i think firefox got problem with java in new versions, recently java keeps hanging/crashing firefox
I have no problem viewing java with my firefox browser. :-)
Logged
Pages: [1]   Go Up
  Print  
There is a better way to do it; find it. ..."Thomas Edison(1847-1931, American inventor, 1093 patients)"
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Summation of vectors
misc
ahmedelshfie 1 3610 Last post June 26, 2010, 12:22:56 am
by ahmedelshfie
EJS version of Vector addition (sum of two vectors)
misc
ahmedelshfie 1 4729 Last post October 09, 2010, 02:38:40 am
by ahmedelshfie
scalar product between two vectors
misc
ahmedelshfie 0 3420 Last post July 05, 2010, 09:08:05 pm
by ahmedelshfie
Summation of three vectors (Adding three vectors)
misc
Fu-Kwun Hwang 2 13308 Last post August 23, 2012, 11:13:31 am
by 168hengbet
Summation of three vectors (Adding three vectors)
misc
ahmedelshfie 0 4631 Last post December 21, 2010, 05:18:33 pm
by ahmedelshfie
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.112 seconds with 22 queries.since 2011/06/15