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

## Information about this web site => Question related to Physics or physics related simulation => Topic started by: ahmedelshfie on June 10, 2010, 07:52:17 pm

 Title: *v^2 in a physlets formula for air resistance Post by: ahmedelshfie on June 10, 2010, 07:52:17 pm Hi prof Hwang I modified project *v^2 in a physlets formula for air resistance and come to my mind idea to add slider for control in angle(theta)So i add slider position up name is theta and back to equation and typing it vx=V*Math.cos(angle/90);vy=V*Math.sin(angle/90);After i back again to slider theta and add the following values in image gif that I'm attach But I'm sure have wrong because when i drag slider theta to value less 40 simulation not work I don't know why ??? ??? ???Could you check prof what wrong i make Thanks  :)I attach also jar,,XML files of simulation Title: Re: *v^2 in a physlets formula for air resistance Post by: Fu-Kwun Hwang on June 10, 2010, 10:31:33 pm For angle in degree from 0 to 180 is correspond cta in radian from 0 to pi.so cta= angle*pi/180.;where pi=3.14159 or you can define variable pi=Math.PI;// where Math.PI is a pre-defined java constant i.e. You should use vx=V*Math.cos(angle*pi/180.);or define a2c=pi/180.; //  angle in degree to cta in radianand use vx=V*Math.cos(angle*a2c); Title: Re: *v^2 in a physlets formula for air resistance Post by: ahmedelshfie on June 11, 2010, 12:04:16 am I do first solution that is i use variable pi=3.14159  in page basic.And equation: vx=V*Math.cos(angle*pi/180.);But i notice that arrow of velocity is down by way strange down more than normally,,cant drag arrow easy for degree i want,,movement of mass slowly.And if i use less value on slider theta simulation no work.I don't know what wrong i do.And i want say another point when i change value of pi from 3.14159 to Math.PI happend diffrent movement i can say is more good than i use pi=3.14159.But problems about velocity arrow,,hard control in drag slider of theta and when less value on slider theta simulation no work is the same no change may is have some diffrent in movement become more fast.I upload applet for you check prof by first value pi=3.14159.Applet prof [eye][ejsapplet][/eye] Title: Re: *v^2 in a physlets formula for air resistance Post by: Fu-Kwun Hwang on June 11, 2010, 05:01:10 pm The problem is due to code in "Fixed relation" page.Code:if(_isPlaying() && x>xmin+size && y_initialize();playpause();}And the following code in the "initialize" page.Code:vx=V*Math.cos(angle/90);vy=V*Math.sin(angle/90);x=xmin+size2;y=ymin+size2;t=0.;When you click "Play" x>xmin and ySo it execute initialize page again.You can fix it if you modify the code in "Fixed relation" page to.Code:if(_isPlaying() && x>[b]xmax[/b]+size && y_initialize();playpause();}and the code in initialize page toCode:vx=V*Math.cos(angle*Math.PI/180);vy=V*Math.sin(angle*Math.PI/180);x=xmin+size2;y=ymin+size2;t=0.; Title: Re: *v^2 in a physlets formula for air resistance Post by: ahmedelshfie on June 11, 2010, 06:17:14 pm I solve problem about control in arrow of velocity and work now very well.But code in "Fixed relation" page.Code:if(_isPlaying() && x>xmin+size && yxmin+size && yxm[color=red]a[/color]x+size && y0\$Howeve,for slow projectile, the force is proportional to velocity. i.e.\$ k1>0, k2=0\$e.g. simulate a projectile moving under water. User can adjust \$k1,k2\$ to find a suitable model for the case s/he want to simulated and compared with the real case under studied.And that can be one of the purpose for the above simulation. To find out a suitbale model for a real case. Title: Re: *v^2 in a physlets formula for air resistance Post by: ahmedelshfie on June 15, 2010, 12:19:15 am Very well prof thanks for information's.but i notice a thing prof in applet when theta = 0.0 mass move to down I mean even i don't drag slider theta and I'm just press play without drag theta simulation work but what is strange Is mass work and fall to down My ask how theta 0.0 and mass fall down i think mass should be move direct or not move butIs moving down i will upload applet for you check prof Title: Re: *v^2 in a physlets formula for air resistance Post by: Fu-Kwun Hwang on June 15, 2010, 09:39:56 am When the initlal velocity of the projectile is in the horizontal: Then it will move with constant speed in the horizontal direction and it will also have free fall motion in the vertical direction.Why it should only move horizontally? or even not moving???Let me know your argument! Title: Re: *v^2 in a physlets formula for air resistance Post by: ahmedelshfie on June 15, 2010, 05:26:08 pm I thought when i drag theta to 0.0 and initial V to 0.0So we no have velocity or angle,so no have movement.I mean when it should move horizontally this if we drag only initial V without drag theta,So we will have velocity without angle in this case i think move horizontally.However prof thanks i understand your explain now I'm just try understand every thing about simulation  :) Title: Re: *v^2 in a physlets formula for air resistance Post by: Fu-Kwun Hwang on June 16, 2010, 06:33:18 pm You did not add any action when initial velocity slider were changed.I add _initialize() to the action. And it should work fine when you drag slider for V. Title: Re: *v^2 in a physlets formula for air resistance Post by: ahmedelshfie on June 16, 2010, 06:46:35 pm Thanks prof i fix wrong and now work very well without any wrong Thanks  :)Now simulation on Airdrag (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1832.0)