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

## Easy Java Simulations (2001- ) => Collaborative Community of EJS => Topic started by: lookang on August 02, 2010, 12:29:48 pm

 Title: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on August 02, 2010, 12:29:48 pm Ejs Open Source Gravitational Field & Potential of 2 Mass Java Appletmany thanks to Professor Andrew Duffy for his original codes http://www.compadre.org/osp/items/detail.cfm?ID=9411 , to Professor Fu-Kwun Hwang for his forum and community of learners & to Professor Paco for creating Ejs toolkit.Professor Wolfgang for OSP codes. Title: Re: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on August 02, 2010, 12:33:02 pm remixing it for gravity field and potential  work in progress :)  1 convert all variables to mass 2 convert constant to G  3 redraw the position of the force 4 introduce range and rangey to make the mass always appears as a circle as a function of the xmax, xmin, ymin, ymax used by applet 5 trying to convert the symbolic representation to mass type from electric type 6 added ODE to make test mass move according to d(xtest)/dt = vxtest & d(vxtest)/dt = g_net 7 added code to make vxtest=0 when slider move or xtest drag etc. 8 change all text to gravity instead of electric. 9 added Fnet = mtest*g 10 added U = mtest*ø10 play button for ODE to run11 added slider from text mass12 changes are made based on an applet by Andrew Duffy http://physics.bu.edu/~duffy/classroom.html is the creator of his original applet.13 closer remix was based on http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1918.msg6989#msg698912 May 2011added 0.00 E-08 to all readings to make it as calculated by calculatorJuly 2011made the slider to include input fields for exact value of mass = 300 kg for examplesome slight adjustment of the check-box03 august 2011added step () buttonmove checkbox to left of bar value for both potential and field to reduce space taken up by the words for the checkboxesTo do.May need one customized to real earth and moon dataMass of Earth = 6.0 x 1024 kgRadius of Earth = 6.40 x 10^6 m      Mass of Moon = 7.35 x 10^22 kgRadius of Moon’s orbit = 3.84 x 10^8 m      Time for Moon to complete one orbit around the Earth = 2.36 x 106 s Title: Re: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on March 09, 2012, 03:11:33 pm discussion with teachersG field strength & potential- please add a button to reveal and hide the g field strength and potential value bars - make colour change of g field value bar to reflect +ve and -ve values.- make -ve sign more visible if possible- dotted lines to trace the test mass to graphs (g field & potential) and to vertical axis- analysis tool to reveal the gradient of tangent to potential graph and g field strengththis are to do Title: Re: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on March 11, 2012, 09:35:05 pm work in progress Title: Re: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on March 12, 2012, 03:10:21 pm updated!changes includeredesign the way g and V are plotted by combining into a graph for ease of data analysis tool with a blocker to block the middle linemade the mathematical representation without *improve the scale to draw forcemove g and V to the right side and made to scaleadd indicator lines for both g and Vadd data analysis tool for investigation of dV/dx = - g for any point xenjoy! Title: Re: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on April 27, 2012, 12:45:30 pm need to have discussion with teacher F2F before i implement the changes1) Can we have the arrow scale slider permanently displayed, instead of hiding in the green check box?added permanent on the left 2) Can we have the two arrows along the same line, instead of one above another?the purpose is to allow visualization when both are perfectly align it is hard to see.i make it slightly apart still acting of the particle, should be better now. 3) Can we also hide Mass 1 and display only Mass 2? This will help students observe the individual g and potential graphs before they observe the net g and potential graphs.agree, done 4) Can we have a button to hide the g field arrows? So that the arrows won't confuse the students when they are observing the potential graphs.agree, done  5) Is it necc to have the Fnet and Unet? I suggest remove the green and transparent check boxes.to complete the computer model to allow inquiry into the Fnet and Unet.i recommend keep them for students to understand  6) Can we indicate 'g' beside the g graph check box? same for potential graph check box.agree, done 7) Mass 1 and Mass 2 sliders and display boxes are just next to each other and the same blue colour may make it difficult to differentiate. Can you demarcate the two with a thick solid line. agree, done 8) Can we have a button to display a tangent for potential graph? The gradient of tangent should be equal to the - (g value). Good to display the value of gradient and g value simultaneously for comparison.  agree, done made dV/dr = to show to be compare to g.for realization of dV/dr = - g.the minus sign is to be included by students to deepen thinking. Title: Re: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on May 07, 2012, 08:22:47 am changes made:made the mathematical representation consistent for mass1 to be not shown.add scale1 to make the formula consistentgy= k*q1*scale1/((xtest-x1)*(xtest-x1))*(xtest-x1)/Math.abs(xtest-x1)+ k*q2*scale2/((xtest-x2)*(xtest-x2))*(xtest-x2)/Math.abs(xtest-x2);Vy = k*q1*scale1/(Math.sqrt((xtest-x1)*(xtest-x1)))+ k*q2*scale2/(Math.sqrt((xtest-x2)*(xtest-x2)));enjoy! Title: Re: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on May 07, 2012, 04:36:03 pm discussion with teacher1) there is a small circle below the test mass. I think the circle is meant for potential graph. Can the circle only appears when the potential graph is checked, to reduce distraction? Thanks. 2) right now, the g field arrow only appears when we check the g button and then check the g1 button. Actually I would like the students to visualise the arrows first without looking at the graph. Furthermore, when we uncheck the g button and check the V button, the arrow still appears because the g1 button is not unchecked. Can we have another button to activate the g arrows? and the arrow for the particular M will appear as long as the g arrow button is checked and the M button is checked. Thanks. 3) can we make it such that the g2 bar (on the right side) only apears when the M2 button is checked? because it is causing distraction and serves no purpose if M2 is not present. Similarly the g net bar should only appear when both M1 and M2 buttons are checked simultaneously. What do you think? 4) the tangent for dV/dr is nice, although I think the value is fake. :) but it provides good visualisation for our students. Just one small request, the dV/dr value has a 'E08' placed very far to the right. Students may not notice it. Can we reduce the length of the value display bar?3can you standardise the symbol for potential because the sim uses both V and greek symbol 'phi'. Title: Re: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on June 02, 2012, 08:31:52 am More discussionNO time to change yet.For the attached simulation, I notice that the potential is labelled as V.Can you change it to the 'phi' symbol for all?done using Code:$\\phi$Also can I suggest that the g field strength arrow/s appear automaticallywhen the g button is clicked and M1 or/and M2 is clicked?doneInstead of having to check the box on top of the g field strength bars (onthe right of the screen).What happen now is that the students may have unchecked the g button butthe g arrows are still around because they have not unchecked the box ontop of the g field strength bars. Title: Re: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on June 08, 2012, 01:33:48 pm More discussionFor the "Gravitational Field and Potential in One Dimension Model", could he make it such that if the central button for potential "v" is NOT clicked, the tick box for dv/dx will also automatically be unticked? I initially was confused at how come there was a gradient line but it didnt follow the g-field plot. [OK, i was not following instructions in the worksheet, but playing around on my own]done Title: Re: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on June 11, 2012, 10:55:31 am discussionNow I'm looking at the checkbox for the "?" at the lower right hand corner.In the pop-up window, the last set of instructions [to click on graph area>Select Elements options - PlottingPanel - DataAnalysis to verify dg = - d$\phi$/dr] . . . i cant find DataAnalysis after the PlottingPanel. Also, should it be g = - d$\phi$/dr ? done, i have removed Data Analysis and replace with the phi and d(phi)/dr check box and display for more immediate concept-trend generalization after discussion with teacher(s) Also, i noticed the displayed values for d$\phi$/dr is always kept to 2 dp. But the bar is exceptionally long. Verifying manually, i missed out the E-08 at the end initially. If it's not too much trouble already, could you help me reduce that box length sincethe values are already constrained?done Title: Re: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on June 12, 2012, 11:30:02 am teacher feedback "Thanks! I particularly like the horizontal lines you added to map to the bars on the right. " Title: Re: Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet Post by: lookang on June 28, 2012, 08:17:32 am changesadded time to allow a sense of passage of time especially when m1 is moving and simulation pause when m1 hits M1 or M2improved collision detection and pause//case 2  inside mass1 if (show1==true&&xtest <(x1+size/2)&&xtest>(x1-size/2)) {  _pause();  }//case 3  inside mass2 if (show2==true&&xtest <(x2+size/2)&&xtest>(x2-size/2)) {  _pause();  }