NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

JDK1.0.2 simulations (1996-2001) => Misc => Topic started by: Fu-Kwun Hwang on January 29, 2004, 11:16:34 pm



Title: Vector Addition
Post by: Fu-Kwun Hwang on January 29, 2004, 11:16:34 pm


You are welcomed to check out EJS version of Vector addition (sum of two vectors) (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1247.0),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 + BorC = B+ A
    C = A - BorC= -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.  
     
  • select info checkbox to show more information.
  •  
         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)


    Title: topic51
    Post by: on January 30, 2004, 11:18:43 am
    Subject: 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.


    Title: topic51
    Post by: on January 30, 2004, 11:28:18 am
    Subject:
    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


    Title: topic51
    Post by: Fu-Kwun Hwang on March 31, 2005, 04:52:05 pm

    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.


    Title: topic51
    Post by: Ahmad on October 23, 2005, 12:36:07 am
    Hi can i have the source code of the first applet
    [/b]


    Title: topic51
    Post by: repsol_23 on November 13, 2005, 01:31:25 pm
    I 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


    Title: topic51
    Post by: Fu-Kwun Hwang on November 14, 2005, 09:49:41 am
    You 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


    Title: topic51
    Post by: repsol_23 on November 16, 2005, 08:05:48 am
    I 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?


    Title: topic51
    Post by: Fu-Kwun Hwang on November 16, 2005, 08:48:00 am
    There 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.


    Title: Re: Vector Addition
    Post by: Sivasayanth on July 14, 2007, 11:10:12 am
    dear Fu-Kwun Hwang

    i like your simulation


    Title: Re: Vector Addition
    Post by: kinematix_playa on October 31, 2007, 06:47:16 am
    This simulation completes me.

    *moist*


    Title: Re: Vector Addition
    Post by: Physicsmaster on October 31, 2007, 07:54:40 am
    Fu-Kwun Hwang, you are an inspiration to us all.


    Title: Re: Vector Addition
    Post by: Physicsmaster on October 31, 2007, 07:27:00 pm
    I am a school teacher and have modeled this simulation with my students and they have learned lot from this.


    Title: Re: Vector Addition
    Post by: Fu-Kwun Hwang on November 01, 2007, 12:13:25 am
    I am glad to hear that it is useful.  ;D


    Title: Re: Vector Addition
    Post by: lookang on April 15, 2008, 04:41:04 pm
    change 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 !


    Title: Re: Vector Addition
    Post by: lookang on May 05, 2008, 04:34:17 pm
    i have some work in progress.

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


    Title: Re: Vector Addition
    Post by: lookang on May 05, 2008, 05:18:13 pm
    improving and adapting your applet to fit my teaching needs.


    Title: Re: Vector Addition
    Post by: zeyad80 on May 31, 2008, 04:48:35 am
    I want to say thank you Mr Hwang

    God bless you


    Title: Re: Vector Addition
    Post by: mavito on July 05, 2008, 06:01:43 am
    Hello, 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.

    Thanks in advance.


    Title: Re: Vector Addition
    Post by: Fu-Kwun Hwang on July 05, 2008, 09:23:20 am
    Source code for vector addition has been sent to your email address.
    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.


    Title: Re: Vector Addition
    Post by: mavito on July 05, 2008, 04:30:05 pm
    Thank you sir. You have been most helpful.


    Title: Re: Vector Addition
    Post by: mavito on July 08, 2008, 01:53:18 am
    I 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?


    Title: scalar product between two vectors
    Post by: Fu-Kwun Hwang on July 08, 2008, 08:01:05 am
    I 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).



    Title: Re: Vector Addition
    Post by: featherfriends4evr on October 03, 2008, 10:42:00 pm
     ??? ::) :) ;) ;D >:( :-* howdy y'all


    Title: Re: Vector Addition
    Post by: Fu-Kwun Hwang on January 05, 2009, 04:28:24 pm
    Someone 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.
    So I created the following applets:




    Title: Re: Vector Addition
    Post by: alex45 on March 12, 2009, 09:52:58 pm
    The 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.
    -*-


    Title: Re: Vector Addition
    Post by: janelavis on September 22, 2009, 01:50:31 pm
    I 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


    Title: Re: Vector Addition
    Post by: Fu-Kwun Hwang on October 05, 2009, 10:59:25 am
    Thank 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.


    Title: Re: Vector Addition
    Post by: wenouyang on May 14, 2010, 09:52:14 pm
    Hello, 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


       


    Title: Re: Vector Addition
    Post by: Fu-Kwun Hwang on May 20, 2010, 05:19:42 pm
    The source code is available as attached file. Please download it by yourself.  ;)


    Title: Re: Vector Addition
    Post by: faran on July 06, 2011, 03:34:59 am
    Hi folk, I need help.
    I encountered a question in my high school exam that was

    " The resultant of two anti-parallel vectors A and B is:
    1) A+B
    2) A-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=C
    Then it becomes A+C, means we have to add them both to get answer.
    I'm stuck please help me out.


    Title: Re: Vector Addition
    Post by: Fu-Kwun Hwang on July 06, 2011, 06:28:00 pm
    two 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}$


    Title: Re: Vector Addition
    Post by: faran on July 07, 2011, 03:05:59 am
    Thanks 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?

    A-B
    or
    A+B

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

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

    Let two vectors A and B,
    A= |A| (k )
    B= |B| (-k)

    Now
    Resultant:

    A + (-B)

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

    As |B|(-k)= B

    so

    A + 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


    Title: Re: Vector Addition
    Post by: faran on July 08, 2011, 02:57:45 am
    ???


    Title: Re: Vector Addition
    Post by: Fu-Kwun Hwang on July 08, 2011, 04:32:35 pm
    The 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)


    Title: Re: Vector Addition
    Post by: THERITESHBABA on January 02, 2012, 12:35:36 pm
    if 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




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


    Title: Re: Vector Addition
    Post by: THERITESHBABA on January 02, 2012, 01:48:13 pm
    if 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

     

     


    Title: Re: Vector Addition
    Post by: nateuer on November 17, 2012, 09:42:01 pm
    -*-
    I have just seen it,nice I love that.


    Title: Re: Vector Addition
    Post by: koclup1580 on December 29, 2012, 01:13:07 pm
    thanks