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

Information about this web site => Request for physics Simulations => Topic started by: jirischamberger on December 23, 2010, 02:36:57 am

 Title: Help with simulation "Feynman QED" in EJS/board:26-101- Post by: jirischamberger on December 23, 2010, 02:36:57 am Hallo, i am trying to make the simulation based on the Feynman QED (as you can see on the pictures below) in EJS, but to say the true, i dont even know how to start. My goal is : Two mirrrors, which can be changer (straight and concave), the user will click on any place in the mirrors and in the second window he will see the summation of probability amplitudes. Can anybody help me, please ? Title: Re: Help with simulation "Feynman QED" in EJS Post by: Fu-Kwun Hwang on January 15, 2011, 10:21:43 pm Does the following simulation is what you need?You can drag S,P to different location.The red segments show the path which is shertest distance (or smallest time value). Title: Re: Help with simulation "Feynman QED" in EJS/board:26-101- Post by: jirischamberger on January 23, 2011, 03:14:09 pm Yes, that is exatly what I needed. Thank you very much  :) :) Title: Re: Help with simulation "Feynman QED" in EJS/board:26-101- Post by: ahmedelshfie on January 24, 2011, 08:43:52 am In my opinion is excellent applet, thanks prof Hwang for the wonderful work  :) Title: Re: Help with simulation "Feynman QED" in EJS/board:26-101- Post by: jirischamberger on February 27, 2011, 07:44:53 pm I have tried this simulation in a different way : You can drag each point or you can generate (random or Gaussian) the points positions. But I have one problem : Somewhere I do a mistake and I cannot properly display the graphical summation of vectors. Can you help me, please ? Thank you.  Title: Re: Help with simulation "Feynman QED" in EJS/board:26-101- Post by: Fu-Kwun Hwang on February 27, 2011, 08:47:48 pm I do not understand what is the problem ? Could you create snapshot of the image for your simulation (right click mouse and select snapshot) when the problem occurs? Explain what you want and what you have in the current program. There is no way to help if I do not understand what is the problem. Title: Re: Help with simulation "Feynman QED" in EJS/board:26-101- Post by: jirischamberger on February 28, 2011, 12:21:28 am Hi, my problem is that i cannot display properly summation of vectors (and resultant vector). It should be looked like Cornu spiral, i think, but I cannot link vectors to each other (vetor A to B, then to C etc. and finally resultant vector), and I cannot find mistake. Thank you. Title: Re: Help with simulation "Feynman QED" in EJS/board:26-101- Post by: Fu-Kwun Hwang on February 28, 2011, 08:23:13 am Quoted1 = Math.sqrt((x1-x2)*(x1-x2)+(y2-y1)*(y2-y1))+ Math.sqrt((x4-x2)*(x4-x2)+(y2-y1)*(y2-y1));d2 = Math.sqrt((x1-x29)*(x1-x29)+(y2-y1)*(y2-y1))+ Math.sqrt((x4-x29)*(x4-x29)+(y2-y1)*(y2-y1));d3 = Math.sqrt((x1-x26)*(x1-x26)+(y2-y1)*(y2-y1))+ Math.sqrt((x4-x26)*(x4-x26)+(y2-y1)*(y2-y1));d4 = Math.sqrt((x1-x24)*(x1-x24)+(y2-y1)*(y2-y1))+ Math.sqrt((x4-x24)*(x4-x24)+(y2-y1)*(y2-y1));d5 = Math.sqrt((x1-x22)*(x1-x22)+(y2-y1)*(y2-y1))+ Math.sqrt((x4-x22)*(x4-x22)+(y2-y1)*(y2-y1));d6 = Math.sqrt((x1-x23)*(x1-x23)+(y2-y1)*(y2-y1))+ Math.sqrt((x4-x23)*(x4-x23)+(y2-y1)*(y2-y1));d7 = Math.sqrt((x1-x25)*(x1-x25)+(y2-y1)*(y2-y1))+ Math.sqrt((x4-x25)*(x4-x25)+(y2-y1)*(y2-y1));d8 = Math.sqrt((x1-x28)*(x1-x28)+(y2-y1)*(y2-y1))+ Math.sqrt((x4-x28)*(x4-x28)+(y2-y1)*(y2-y1));d9 = Math.sqrt((x1-x32)*(x1-x32)+(y2-y1)*(y2-y1))+ Math.sqrt((x4-x32)*(x4-x32)+(y2-y1)*(y2-y1));d10 = Math.sqrt((x1-x27)*(x1-x27)+(y2-y1)*(y2-y1))+ Math.sqrt((x4-x27)*(x4-x27)+(y2-y1)*(y2-y1));d11 = Math.sqrt((x1-x30)*(x1-x30)+(y2-y1)*(y2-y1))+ Math.sqrt((x4-x30)*(x4-x30)+(y2-y1)*(y2-y1));d12 = Math.sqrt((x1-x31)*(x1-x31)+(y2-y1)*(y2-y1))+ Math.sqrt((x4-x31)*(x4-x31)+(y2-y1)*(y2-y1));The above is a copy from part of your code. It is very difficult to read or debug your code.This is not the way to write a program.You should have defined an array (e.g. d[12]) and do it with a for loop.Do the same for x,y,phase, ...You might want to check out my ejs source from the above example  to find out how to do it with a loop. Title: Want to have a suit fashion beautiful dress? Then, please click