NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
January 24, 2020, 04:24:16 am

Life well spent is long. ..."da Vinci (1452-1519, Italian artist, sculptor, painter, architect, engineer and scientist) "

 Pages: [1]   Go Down
 Author Topic: *v^2 in a physlets formula for air resistance  (Read 12064 times) 0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
ahmedelshfie
Ahmed
Hero Member

Offline

Posts: 954

 « Embed this message on: June 10, 2010, 07:52:17 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

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
 values.gif (17.95 KB, 730x253 - viewed 410 times.)  airdrag.gif (14.47 KB, 755x402 - viewed 367 times.) *** There are 2 more attached files. You need to login to acces it! « Last Edit: June 10, 2010, 07:54:06 pm by ahmedelshfie » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #1 on: June 10, 2010, 10:31:33 pm » posted from:Taipei,T\'ai-pei,Taiwan

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);
 Logged
ahmedelshfie
Ahmed
Hero Member

Offline

Posts: 954

 « Embed this message Reply #2 on: June 11, 2010, 12:04:16 am » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

Embed a running copy of this simulation

Embed a running copy link(show simulation in a popuped window)
Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
• Please feel free to post your ideas about how to use the simulation for better teaching and learning.
• Post questions to be asked to help students to think, to explore.
• Upload worksheets as attached files to share with more users.
Let's work together. We can help more users understand physics conceptually and enjoy the fun of learning physics!

 « Last Edit: June 11, 2010, 01:09:58 am by ahmedelshfie » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #3 on: June 11, 2010, 05:01:10 pm » posted from:Taipei,T\'ai-pei,Taiwan

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.;
 Logged
ahmedelshfie
Ahmed
Hero Member

Offline

Posts: 954

 « Embed this message Reply #4 on: June 11, 2010, 06:17:14 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

Embed a running copy of this simulation

Embed a running copy link(show simulation in a popuped window)
Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
• Please feel free to post your ideas about how to use the simulation for better teaching and learning.
• Post questions to be asked to help students to think, to explore.
• Upload worksheets as attached files to share with more users.
Let's work together. We can help more users understand physics conceptually and enjoy the fun of learning physics!

 « Last Edit: June 11, 2010, 06:31:06 pm by ahmedelshfie » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #5 on: June 12, 2010, 10:20:09 pm » posted from:Taipei,T\'ai-pei,Taiwan

it was a bug in my original code, and it is fixed now.
 Logged
ahmedelshfie
Ahmed
Hero Member

Offline

Posts: 954

 « Embed this message Reply #6 on: June 13, 2010, 12:28:57 am » posted from:Uberaba,Minas Gerais,Brazil

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
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #7 on: June 13, 2010, 09:08:48 am » posted from:Taipei,T\'ai-pei,Taiwan

Please upload latest ejs xml source so that I can check it out.
 Logged
ahmedelshfie
Ahmed
Hero Member

Offline

Posts: 954

 « Embed this message Reply #8 on: June 13, 2010, 11:01:04 am » posted from:Uberaba,Minas Gerais,Brazil

Here is source code about last version of airdrag
 *** There are 1 more attached files. You need to login to acces it! Logged
ahmedelshfie
Ahmed
Hero Member

Offline

Posts: 954

 « Embed this message Reply #9 on: June 14, 2010, 08:58:21 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

And second applet prof is last version so i upload XML source code and have the jar file in second applet
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #10 on: June 14, 2010, 09:28:31 pm » posted from:Taipei,T\'ai-pei,Taiwan

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).
 *** There are 1 more attached files. You need to login to acces it! Logged
ahmedelshfie
Ahmed
Hero Member

Offline

Posts: 954

 « Embed this message Reply #11 on: June 14, 2010, 11:09:54 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

Now work very well thank you prof you the best
Last ask what is job of K1 and k2
 « Last Edit: June 14, 2010, 11:11:47 pm by ahmedelshfie » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #12 on: June 14, 2010, 11:20:18 pm » posted from:Taipei,T\'ai-pei,Taiwan

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.
 Logged
ahmedelshfie
Ahmed
Hero Member

Offline

Posts: 954

 « Embed this message Reply #13 on: June 15, 2010, 12:19:15 am » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

Embed a running copy of this simulation

Embed a running copy link(show simulation in a popuped window)
Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
• Please feel free to post your ideas about how to use the simulation for better teaching and learning.
• Post questions to be asked to help students to think, to explore.
• Upload worksheets as attached files to share with more users.
Let's work together. We can help more users understand physics conceptually and enjoy the fun of learning physics!
 « Last Edit: June 15, 2010, 01:14:33 am by ahmedelshfie » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #14 on: June 15, 2010, 09:39:56 am » posted from:Taipei,T\'ai-pei,Taiwan

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???
 Logged
ahmedelshfie
Ahmed
Hero Member

Offline

Posts: 954

 « Embed this message Reply #15 on: June 15, 2010, 05:26:08 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

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
 « Last Edit: June 15, 2010, 06:25:33 pm by ahmedelshfie » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #16 on: June 16, 2010, 06:33:18 pm » posted from:Taipei,T'ai-pei,Taiwan

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.
 *** There are 1 more attached files. You need to login to acces it! Logged
ahmedelshfie
Ahmed
Hero Member

Offline

Posts: 954

 « Embed this message Reply #17 on: June 16, 2010, 06:46:35 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

Thanks prof i fix wrong and now work very well without any wrong
Thanks
Now simulation on Airdrag
 « Last Edit: June 16, 2010, 08:27:07 pm by ahmedelshfie » Logged
panya.p
Newbie

Offline

Posts: -6

 « Embed this message Reply #18 on: January 22, 2020, 02:12:01 pm » posted from:Bangkok,Krung Thep,Thailand

 Logged
 Pages: [1]   Go Up
Life well spent is long. ..."da Vinci (1452-1519, Italian artist, sculptor, painter, architect, engineer and scientist) "