NTNUJAVA Virtual Physics Laboratory
Enjoy 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 radian
and 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 to
Code:
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 && y<ymin+size ){
_initialize();
playpause();
}
BY the way is the original code that i find when i begin modified simulation
And code in the "initialize" page.
Code:
vx=V*Math.cos(angle*PI/180.);
vy=V*Math.sin(angle*PI/180);
x=xmin+size2;
y=ymin+size2;
t=0.;
Second code i modified but first code is original I'm no change
And i modified variable pi=3.14159 to PI=3.14159
When i use code you post prof ejs consul give 7 error so i back to Original code
And post for you check what wrong i made more.
About a nother problems is the same (velocity is slowly),,,when i drag slider to value less than 30 degree simulation no work.
Applet after solve problem arrow of velocity [eye][ejsapplet][/eye]



Title: Re: *v^2 in a physlets formula for air resistance
Post by: Fu-Kwun Hwang on June 12, 2010, 10:20:09 pm
it was a bug in my original code, and it is fixed now.


Title: Re: *v^2 in a physlets formula for air resistance
Post by: ahmedelshfie on June 13, 2010, 12:28:57 am
Yes prof
But I'm try solve problem about when i drag theta less than 30 degree
Simulation not work i don't know where is wrong  ??? can you fix this wrong prof please
Thanks  :)


Title: Re: *v^2 in a physlets formula for air resistance
Post by: Fu-Kwun Hwang on June 13, 2010, 09:08:48 am
Please upload latest ejs xml source so that I can check it out.


Title: Re: *v^2 in a physlets formula for air resistance
Post by: ahmedelshfie on June 13, 2010, 11:01:04 am
Here is source code about last version of airdrag


Title: Re: *v^2 in a physlets formula for air resistance
Post by: ahmedelshfie on June 14, 2010, 08:58:21 pm
And second applet prof is last version so i upload XML source code and have the jar file in second applet


Title: Re: *v^2 in a physlets formula for air resistance
Post by: Fu-Kwun Hwang on June 14, 2010, 09:28:31 pm
Initialize page:
Code:
vy=V*Math.sin(angle);
need to be modified to
Code:
vy=V*Math.sin(angle[color=red]*pi/180.[/color]);

code in "fixed relation" page
Code:
if(_isPlaying() && x>xmin+size && y<ymin+size )
need to be modified to
Code:
if(_isPlaying() && x>xm[color=red]a[/color]x+size && y<ymin+size )

Then, it should be fine (or check out attached file).


Title: Re: *v^2 in a physlets formula for air resistance
Post by: ahmedelshfie on June 14, 2010, 11:09:54 pm
Now work very well thank you prof you the best  :)
Last ask what is job of K1 and k2


Title: Re: *v^2 in a physlets formula for air resistance
Post by: Fu-Kwun Hwang on June 14, 2010, 11:20:18 pm
The above simulation assume air drag is model with $F=k1*V+k2*V^2$ where $V$ is the magnitude of the velocity.

Nomally, for high speed projectile, the force is proportional to velocity square. i.e.$ k1=0, k2>0$
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 but
Is 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.0
So 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)