NTNUJAVA: Virtual Physics Laboratory: Enjoy the fun of Physics

You need a java enabled browser (click for more information)

• Vector Addition by:at 2004/01/30 00:16

You are welcomed to check out EJS version of Vector addition (sum of two vectors),too!
This java applets try to show : How to add two vector A and Binto vector C
C = A + B = B + A
How to play:

1. There are two methods to form a vector
2.    1. Vector A/B originate from center of the window

Left click anywhere inside the window to form vector A or B
2. Vector A/B originate from where you first  click the button

Drag and lift the left mouse button to form vector A or B     Vector will move to center of the window.

• The program will show you how to add two vector A and B into C

•
 C = A + B or C = B+ A C = A - B or C= -B + A

A - B can be transformed to A + (-B)

• press reset button or right click the mouse button to reset.
•
Parameters are reset to default values.

•
X,Y components of each vector ...
How to process more than two vectors :
 SUM = A + B + C + D = (A + B) + (C+D) = E+ F E = A + B and F= C + D
Could you figure out how to process SUM = A + B + C ?
3-D version

The following is a flash demo for the above java applet.

How to form a 3_D vector
Move the mouse with the window will establish a vector at X-Y plane.  Left click the mouse, then drags it up/down to change the Z components. Then release the mouse button

When you form two vector A and B
Another vector C = A + B will show up.
Drag the right mouse button to change the viewing angle. Drag near the origin to change the its position.(displacement)
See 38 replies click

1. topic51 by:at 2004/01/30 12:18Subject: thanks! Date: Wed, 21 Oct 1998 21:21:49 -0400 From: dgoodwin <dgoodwin@1st.net> To: hwang@phy03.phy.ntnu.edu.tw We were reviewing vector addition this evening at a study session. Someone asked about help from the internet, so we searched and happened to find your page. There were a few "ah-ha's" when the program showed the parallelogram method for adding vectors so clearly. Thanks.

2. topic51 by:at 2004/01/30 12:28Subject: Date: Tue, 2 Feb 1999 22:39:22 -0200 From: "Marcilio Carneiro" <marcilio_roberto@uol.com.br> To: <hwang@phy03.phy.ntnu.edu.tw> Hi Mr Hwang: I?m from Brazil I worked as Physics about 10 years ago and since that time I had a desire : to make softwares for Physics teaching. The DOS interfaces I used to have forced me to give up. Last year (after spendig some time learning Windows based programming) I restarted the project but once again I didn?t like the results. I used Delphi 3.0 (Pascal Object Language) and made about 100 programs ( mechanics and eletricity) but when I saw your programs I felt even more disappointed with the ones i had done . Yours are brilliant , fantastic . Don?t you sell them ? I?m interested in many of them. One : sugestion: Don?t use weak green colors I hardly can see them . For instance the one you used in Vactor addition, Thank you and congratulations for your excellent work (I wish I was talented as you are) Marcilio Carneiro

3. topic51 by:at 2005/03/31 17:52
You can change the number of vectors (drag the bar up and down),
drag each vector (starting position, length, or direction)
Click play to add those vectors automatically.
Click "showsum" to view vector for the sum of those vectors.

4. topic51 by:at 2005/10/23 01:36Hi can i have the source code of the first applet [/b]

5. topic51 by:at 2005/11/13 14:31I am a graduate student at New Mexico State University working on my PhD in Physics Education. I just came across your site and wanted to just make a comment. I found this site GREAT and I am sure there is a number of applets that you have created that I would like to make use of. I hope that this will be okay with you since you are the author of the applets. I have tried to make my own but have had some trouble getting them to function properly. Thanks

6. topic51 by:at 2005/11/14 10:49You are welcomed to use our java applets for non-profit educational purpose. You will be able to get files related to any java applets at our web site if you are a registered user at http://www.phy.ntnu.edu.tw/ntnujava/ Just look for a button(with label: GET APPLET FILES) at the end of the first java applet message (You need to login to the forum). If you click the button, files related to that applet will be sent to your email account automatically. Fu-Kwun Hwang

7. topic51 by:at 2005/11/16 09:05I finally was able to get the codes sent to my email, the problem was in the security that our university uses. But now, I am having some other issues. I unzipped the files to my computer and when I open them they look all garbled. The graphs and animations work perfectly fine, but the letters look like a bunch of gibberish. Is this something to do with the files or am I doing something incorrectly? I was hoping to just extract the vectors animation and write them into a practice quiz that I am working on but am unsure of what the code is due to the weird lettering?

8. topic51 by:at 2005/11/16 09:48There are several html files for different language version. Vector.html is the english version. If it is still not working, may be it is due to two lines I forgot to remove in the html file Please remove the following two lines: <meta http-equiv="Content-Type" content="text/html; charset=big5"> <meta name="GENERATOR" content="Mozilla/4.7 [en] (Win98; I) [Netscape]"> And it should work fine. I have change the ZIP files so there should be no problem if you ask the ZIP file again.

9. Re: Vector Addition by:solids_raguat 2007/07/14 12:10dear Fu-Kwun Hwang

i like your simulation

10. Re: Vector Addition by:kinematix_playaat 2007/10/31 07:47This simulation completes me.

[size=7pt]*moist*[/size]

11. Re: Vector Addition by:Physicsmasterat 2007/10/31 08:54Fu-Kwun Hwang, you are an inspiration to us all.

12. Re: Vector Addition by:Physicsmasterat 2007/10/31 20:27I am a school teacher and have modeled this simulation with my students and they have learned lot from this.

13. Re: Vector Addition by:hwangat 2007/11/01 01:13I am glad to hear that it is useful.  ;D

14. Re: Vector Addition by:lookangat 2008/04/15 17:41change log.

change the color for show component for better color association.

change position of letters to the vector

added tooltips for the buttons

added autoscale for bigger view pleasure

i will make some change , and post it back !

15. Re: Vector Addition by:lookangat 2008/05/05 17:34i have some work in progress.

so difficult to make a powerful applet. need a lot of time

16. Re: Vector Addition by:lookangat 2008/05/05 18:18improving and adapting your applet to fit my teaching needs.

17. Re: Vector Addition by:zeyad80at 2008/05/31 05:48I want to say thank you Mr Hwang

God bless you

18. Re: Vector Addition by:mavitoat 2008/07/05 07:01Hello, professor.

I really loved your java applets, especially the one's about mathematics (I'm student of mathematics).
If you can, please send me java code for vector application on nidzge@gmail.com I would really be grateful.

I have three other applets that I really like:
1. sine and cosine (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=634.0),
2. quadratic function (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=526.0)
3. cross product (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=406.0).

So I would need java codes for that examples as well, if I'm not asking too much.

Another 3 applets were created with EJS . The EJS source code are all available when you view those web page (just below the simulation if you login to this forum). If you want to check the java code , you can run EJS and open ejs source code, Click RUN to compile it  and you will find generated java code. EJS have many pre-build library for scientific simulation. I do not need to write code line by line. I just need to define variables, provide equation / differential equations and create graphic user interface with mouse drag an drop (then set up properties --related to variables) and EJS will generate java code and compile it. If you are interested in EJS please check out related forum at this web site  or visit EJS official web site.

20. Re: Vector Addition by:mavitoat 2008/07/05 17:30Thank you sir. You have been most helpful.

21. Re: Vector Addition by:mavitoat 2008/07/08 02:53I was trying to upgrade this applet so it can do scalar product of vectors, but I haven't had any luck nor knowledge. Is there anyone who figured this out how to do it? Professor Hwang, any ideas?

22. scalar product between two vectors by:hwangat 2008/07/08 09:01I just created another applet to show the scalar product between two vector A, B.

You can drag those vectors to change location and length (orientation).

23. Re: Vector Addition by:featherfriends4evrat 2008/10/03 23:42 ??? ::) :) ;) ;D >:( :-* howdy y'all

24. Re: Vector Addition by:hwangat 2009/01/05 17:28Someone sent me an email as following:
[quote]
Enjoyed the vector models you provided on the website.  As you asked for suggestions - it would be very helpful if you could "rotate" the 3d version of the model from different angles.  Would give an enhanced perspective of the resultant vectors respective to each coordinate access.  Not a programmer myself so have no idea how much work would be involved but that feature would be very cool.
[/quote]
So I created the following applets:

25. Re: Vector Addition by:alex45at 2009/03/12 22:52The other option for returning multiple parameters is that objects are passed by reference as parameters. This means if you pass the initialised Vector in as parameter you can add values to it, and the calling method will be able to access those values.
-*-

26. Re: Vector Addition by:janelavisat 2009/09/22 14:50I think that you need to think a little more about the design of your Vector class. You need to decide upon a minimal but complete interface for Vector. It looks like you could do with some member variables instead of creating local variables named size and degree

27. Re: Vector Addition by:hwangat 2009/10/05 11:59Thank you for your comment. I am not a professional programmer. I am a physicist , I enjoy the fun of physics and I hope the simulations I have created can help users to enjoy the fun of physics, too!
I hope you can create better simulation to help other, too! :-) You are welcomed to upload it here and share with others.

28. Re: Vector Addition by:wenouyangat 2010/05/14 22:52Hello, Professor Hwuang,

Would you please send me the Java code for this version of vector addition?  I like your work and it illustrated the concept clearly!

Thank you!

Wen

29. Re: Vector Addition by:hwangat 2010/05/20 18:19The source code is available as attached file. Please download it by yourself.  ;)

30. Re: Vector Addition by:faranat 2011/07/06 04:34Hi folk, I need help.
I encountered a question in my high school exam that was

" The resultant of two anti-parallel vectors [b]A[/b] and [b]B[/b] is:
1) [b]A+B[/b]
2) [b]A-B[/b] "

What is the correct answer?
I was told that it is A-B, but how could it be A-B, when resultant it self means that it is bascially the addition of two vectors.
If B vector is anti to A, then it should be -B as convention, but what if we say that -[b]B[/b]=[b]C[/b]
Then it becomes A+C, means we have to add them both to get answer.

31. Re: Vector Addition by:hwangat 2011/07/06 19:28two anti-parallel vectors $\vec{A}$ and $\vec{B}$ means $\vec{B}=-\vec{A}$

The sum of two vectors $\vec{A}$ and $\vec{B}$ is $\vec{A}+\vec{B}= \vec{A}+(-\vec{A})=\vec{0}$

32. Re: Vector Addition by:faranat 2011/07/07 04:05Thanks for the response.
But what if the two vectors are of different magnitude and are anti parallel.
Then infact we'll have to subtract their magnitudes that will be |A-B| , but what if we want to write them in vector form, what would we write them if we want to get resultant?

[b]A-B[/b]
or
[b]A+B[/b]

Some people told me that as they are anti-parallel, then their resultant will be ultimately
[b]A+[/b]([b]-B[/b]),
i.e [b]A-B[/b]

One of my friend argued that the resultant should be A+B because

Let two vectors [b]A[/b] and [b]B[/b],
[b]A[/b]= |A| ([i]k[/i] )
[b]B[/b]= |B| (-[i]k[/i])

Now
Resultant:

[b]A[/b] + ([b]-B[/b])

[|A| (k)] + [|B| (-k)]

As |B|(-k)= [b]B[/b]

so

[b]A[/b] + [b]B[/b]
----
Now if it is A+B, then it means that they would be added to each other, and their magnitutude should also be added?

Please do try to understand what I've written, and help me.
Waiting for the reply

33. Re: Vector Addition by:faranat 2011/07/08 03:57[b]???[/b]

34. Re: Vector Addition by:hwangat 2011/07/08 17:32The sum of two vectors is always $\vec{A}+\vec{B}$.

For example: if $\vec{B}=-0.2 \vec{A}$
$\vec{A}+\vec{B}=\vec{A}+ (-0.2\vec{A})=0.8 \vec{A}$ (1.0-0.2)

if$\vec{B}= 0.2 \vec{A}$ , two vector are parallel.
$\vec{A}+\vec{B}=\vec{A}+ (0.2\vec{A})=1.2 \vec{A}$ (1.0+0.2)

35. Re: Vector Addition by:THERITESHBABAat 2012/01/02 13:35if the angle between two vectors is [b]a[/b] & [b]b[/b] is @ and angle between vectors [b]a[/b]+[b]b[/b] and [b]a[/b] is O
then
[center]tan@=([b]b[/b]sinO )/([b]a[/b]+[b]b[/b]cosO )[/center]
now
[center]tan[sup]2[/sup] @=([b]b[/b]sinO)[sup]2[/sup]/([b]a[/b]+[b]b[/b]cosO)[sup]2[/sup] [/center]

now [center]tan[sup]2[/sup]@= sec[sup]2[/sup]@ -1
[/center]and [center]sec[sup]2[/sup]@ =1/cos[sup]2[/sup]@[/center]
[center]{[b]a[/b][sup]2[/sup] sec[sup]2[/sup]O + [b]b[/b][sup]2[/sup] + 2[b]a[/b][b]b[/b]secO}[/center]
so cos[sup]2[/sup]@=[center]____________________________________________________________________[/center]
[center]{[b]a[/b][sup]2[/sup]sec[sup]2[/sup]O + [b]b[/b][sup]2[/sup]sec[sup]2[/sup]O + 2[b]ab[/b]secO} [/center]

if @ =0
[center] [b]b[/b][sup]2[/sup]=[b]b[/b][sup]2[/sup]cos[sup]2[/sup]O[/center]
[center]O=0[/center]
if @ =90
[center][b]a[/b]=-[b]b[/b]cosO[/center]
if O=90
[center]-[b]b[/b][sup]2[/sup][/center]
tan[sup]2[/sup]@=[center] ____[/center]
[center][b]a[/b][sup]2[/sup]+[b]b[/b][sup]2[/sup][/center]

:) ;) :D ;D HERE BOLD CHARACTERS REPRESENT VECTORS.

36. Re: Vector Addition by:THERITESHBABAat 2012/01/02 14:48if the angle between two vectors is a & b is @ and angle between vectors a+b and a is O
then

tan@=(bsinO )/(a+bcosO )

now

tan2 @=(bsinO)2/(a+bcosO)2

now

tan2@= sec2@ -1

and

sec2@ =1/cos2@

{a2 sec2O + b2 + 2absecO}

so cos2@=

{a2sec2O + b2sec2O + 2absecO}

if @ =0

b2=b2cos2O

O=0

if @ =90

a=-bcosO

if O=90

-b2

tan2@=                                                                                                                                    _________________

a2+b2

37. Re: Vector Addition by:nateuerat 2012/11/17 22:42-*-
I have just seen it,nice I love that.

38. Re: Vector Addition by:koclup1580at 2012/12/29 14:13thanks