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) => Optics => Topic started by: Fu-Kwun Hwang on January 29, 2004, 10:47:02 pm



Title: Find the fastest Path
Post by: Fu-Kwun Hwang on January 29, 2004, 10:47:02 pm

In the above java applet, there are two different regions (green and yellow).
    The condition is :
      An object (red) located at the top left corner of the green region.
      It is going to move to the bottom right corner of the yellow region.

    Due to different friction in these two regions,
      its speed is also different (green: V1 , yellow: V2)You can change value of V1 and V2 from the textfield.

How to chose a path such that minimizes the travel time?
    Those two arrors represent the velocity vectors at those two region.
    You can click the left mouse button at the tip of the velocity vector
      and drag it left and right, to change the traveling path.

    To make it more interested. You can click the mouse button at the boundary,
      and drag it up and down, to change the height of those two regions.

    Press Start button to start the animation.
      A red ball will move along the chosed path.Another ball(blue) will follow the fastest path if you click the show checkbox:

    When it stop, compare the ratio of L1/L2 and compare with V1/V2Did you get the right answer?After how many tries?



Sounds familar? Fermat's principle states that:
    The path of a ray of light between two points is the path that minimizes the travel time.
    We can derives Snell's law from the relation found above L1

    where index of refraction n1 = c / v1,
      c is the speed of light in vacuum, and v1 is the speed of light in the medium.

    This is also true for other waves (e.g. sound wave) propagation between two different medium.


Title: L1/L2
Post by: kristianly on October 04, 2004, 09:16:52 pm
Dear Sir, what do you mean by L1/L2? I don't quite understand how the applet works. At a certain angle, the red path will take the least time (same as blue path). What does different is xx pt mean? The picture shows the source can be along the surface instead of the corner. Is it possible?

Thanks,
Christian Lee
NIE, Singapore


Title: Re: Find the fastest Path
Post by: Fu-Kwun Hwang on March 04, 2007, 11:13:58 pm
I am sorry. Our server was attacked by a hacker several months ago. Some of the files were deleted and I had to restored files from previous archive. And I restored an old version of this applet. There is no L1/L2 shown on the applet. Now, the latest and improved version is restored. Thank you!


Title: Re: Find the fastest Path
Post by: Fu-Kwun Hwang on June 16, 2009, 10:16:41 am
The following is a similar version created with EJS.
You can drag the star point (at the top) and end point(at the bottom) horizontally.
The velocity v change the moving speed.
Speed at upper half v1=v/n1, speed at lower half v2=v/n2.


Title: Re: Find the fastest Path
Post by: ahmedelshfie on July 21, 2010, 07:23:15 pm
Prof Hwang
Error in XML source code,, still now im not sure it because i'm use EJS 4.3.0 or it happen because have wrong in XML
However i close Events in evolution page so EJS console give one error before i close this page ejs console give 8 error.


Quote
symbol  : variable initregion
location: class users.br.ahmed.fastestpath_pkg.fastestpath._ODE_evolution1._ODE_evolution1_Event1
         if(initregion){  // > Evolution:Evol Page:Event.Zero Condition:2
            ^
D:\EJS_4.3.0\workspace\output\users\br\ahmed\fastestpath_pkg\fastestpath.java:504: cannot find symbol
symbol  : variable xl
location: class users.br.ahmed.fastestpath_pkg.fastestpath._ODE_evolution1._ODE_evolution1_Event1
        xl=Math.sqrt((x2-x[id])*(x2-x[id])+y2*y2);  // > Evolution:Evol Page:Event.Zero Condition:4
        ^
D:\EJS_4.3.0\workspace\output\users\br\ahmed\fastestpath_pkg\fastestpath.java:505: cannot find symbol
symbol  : variable xl
location: class users.br.ahmed.fastestpath_pkg.fastestpath._ODE_evolution1._ODE_evolution1_Event1
        vx[id]=v2*(x2-x[id])/xl;  // > Evolution:Evol Page:Event.Zero Condition:5
                             ^
D:\EJS_4.3.0\workspace\output\users\br\ahmed\fastestpath_pkg\fastestpath.java:506: cannot find symbol
symbol  : variable xl
location: class users.br.ahmed.fastestpath_pkg.fastestpath._ODE_evolution1._ODE_evolution1_Event1
        vy[id]=v2*y2/xl;     // > Evolution:Evol Page:Event.Zero Condition:6
                     ^
D:\EJS_4.3.0\workspace\output\users\br\ahmed\fastestpath_pkg\fastestpath.java:530: cannot find symbol
symbol  : variable initregion
location: class users.br.ahmed.fastestpath_pkg.fastestpath._ODE_evolution1._ODE_evolution1_Event1
        initregion[id]=false;  // > Evolution:Evol Page:Event.Action:1
        ^
D:\EJS_4.3.0\workspace\output\users\br\ahmed\fastestpath_pkg\fastestpath.java:531: cannot find symbol
symbol  : variable xl
location: class users.br.ahmed.fastestpath_pkg.fastestpath._ODE_evolution1._ODE_evolution1_Event1
        xl=Math.sqrt((x2-x[id])*(x2-x[id])+y2*y2);  // > Evolution:Evol Page:Event.Action:2
        ^
D:\EJS_4.3.0\workspace\output\users\br\ahmed\fastestpath_pkg\fastestpath.java:532: cannot find symbol
symbol  : variable xl
location: class users.br.ahmed.fastestpath_pkg.fastestpath._ODE_evolution1._ODE_evolution1_Event1
        vx[id]=v2*(x2-x[id])/xl;  // > Evolution:Evol Page:Event.Action:3
                             ^
D:\EJS_4.3.0\workspace\output\users\br\ahmed\fastestpath_pkg\fastestpath.java:533: cannot find symbol
symbol  : variable xl
location: class users.br.ahmed.fastestpath_pkg.fastestpath._ODE_evolution1._ODE_evolution1_Event1
        vy[id]=v2*y2/xl;  // > Evolution:Evol Page:Event.Action:4
                     ^
8 errors
Compilation produced an error!


Title: Re: Find the fastest Path
Post by: Fu-Kwun Hwang on July 21, 2010, 10:28:19 pm
The event page was disabled. You can remove it and it will work fine.
The above jar file has been updated,too!


Title: Re: Find the fastest Path
Post by: buymmlensf on October 02, 2010, 01:18:23 am
I'm finding this knowledge for my project work thanks