NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
September 21, 2020, 08:22:37 pm

Everything has its beauty but not every one sees it. ...Confucius (551-479 BC)

 Pages: [1]   Go Down
 Author Topic: Position vs. Time  (Read 17082 times) 0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message on: March 10, 2009, 12:45:47 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

Position vs. Time

This experiment uses the computer and the multimedia system to display graphs of Distance vs Time, Velocity vs Time and Acceleration vs Time.

http://www.phys.ufl.edu/demo/1_Mechanics/D_MotionTwoDimensions/PersonMotionsensor.html

i can figure out the rest except the click to drag part with a running time. may be i need some example to follow the syntax

 « Last Edit: March 10, 2009, 02:15:05 pm by lookang » Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #1 on: March 10, 2009, 04:41:20 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

strange, i cant modify my post after some time? is that a new feature?

anyway i was planning to quickly demonstrate how quickly i can get this to work but......

question:

1. the evolution page is dx/dt = v
i got the time t to increment by dt = 0.05, but the v does not vary as i change the position of circle coordinate (x,y)

2. on drag of (x,y) i notice the time t is slower than when no drag of the (x,y), how to make the increment of time constantly, independent of the interaction/calculation of the applet, to simulate like real time for example?

thansk!, attached is my attempt to make this applet in 10 minutes .

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!
 *** There are 1 more attached files. You need to login to acces it! « Last Edit: March 10, 2009, 04:43:03 pm by lookang » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #2 on: March 10, 2009, 05:35:42 pm » posted from:Taipei,T'ai-pei,Taiwan

The equations dx/dt=v at evolution page, tell EJS use the current value v to calculate x (t+dt) from x(t).
It does not have any other  effect.
The left hand side will change according to value at the right hand side of the equation.
It is not the reversed order.

In computer language: x=x+1; does not mean "x equal to x+1" which is always false.
It mean get value from x, add 1 and save the value back to x.

I do not understand what do you mean by
Quote
i got the time t to increment by dt = 0.05, but the v does not vary as i change the position of circle coordinate (x,y)
I do not understand what you really want to do. Please explain it in more detail.

The EJS simulation use the equation at evolution pages to calculate new value at t+dt from value at t.
And it does not remember previous values unless you add an array to store those values.

If you want to use mouse action to change the time , you need to
save values for all the variables
or
add code to move the time either forward or backward.
 Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #3 on: March 10, 2009, 08:25:35 pm » posted from:Singapore,,Singapore

strange mesage.

the applet:
i wanted to be able to drag the circle (x,y) along the x direction only, just like the real life case of a man moving forward and back to observe the graph of s vs t, v vs t, a vs t.

so the rate of me dragging the circle, determines the graphs.

drag slowly constant speed, gives s = v*t graph and v = v graph and a = 0 graph

i can't find any example on the public internet. private one i see before but i cannot link to them.

let me continue to search!

wait i think i am having a eureka moment. i think i figure out already
i tried
evolution page only:
x1 = x;
t = t + dt;
x2 = x;
v = (x2 - x1)/dt;

custom function: drag() // this is to make on drag(), t to increase still. to create illusion of time still running because without this, the drag moment t is not changing.

x1 = x;
t = t + dt;
x2 = x;
v = (x2 - x1)/dt;

but i seems to get no value for v.
i can't seems to create the difference in the value of x to be assigned to x2 and x1 differently despite the the line of code
t = t+ dt;
 *** There are 1 more attached files. You need to login to acces it! « Last Edit: March 10, 2009, 08:51:14 pm by lookang » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #4 on: March 10, 2009, 11:06:44 pm » posted from:Taipei,T\'ai-pei,Taiwan

It is a bug. I was wondering why no one download user uploaded jar files in the last week.
I just modified the code. You should be able to download it now.

I though you have did similar work before.
May be you can check out Integrator y= ∫ f(x) dx
You can drag the blue dot, which is follow the curve of of the function (user can input different function).
And the red curve is the integal of the function.
 Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #5 on: March 11, 2009, 07:53:50 am » posted from:SINGAPORE,SINGAPORE,SINGAPORE

it looks like i have done similar work but to create knowledge on my own is really difficult, and i can't seem to find the parts where you explained how to get velocity from first principles. so i am making up the knowledge (codes) from my thoughts and experience.

I still have a lot to learn

i just saw the xml. thanks! my current xml also can drag.

i just found a applet that is similar to what i was thinking of.
http://www.mste.uiuc.edu/users/Murphy/MovingMan/MovingMan.html

i see Lisa Denise Murphy  at the University of Illinois has one made in 1997

let me study it
 position.PNG (27.8 KB, 707x598 - viewed 402 times.) *** There are 2 more attached files. You need to login to acces it! « Last Edit: March 11, 2009, 08:55:11 am by lookang » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #6 on: March 11, 2009, 09:26:11 am » posted from:Taipei,T'ai-pei,Taiwan

If you just want to show trace similar to the applet  at http://www.mste.uiuc.edu/users/Murphy/MovingMan/MovingMan.html

Just add n trace in EJS, and enter x,y property as t and x position.
Let the applet change to play mode when user starts to drag the object and enter pause mode when user release the mouse.
Then you will get what you want! Check out the following applet (drag the blue dot).

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!
 Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #7 on: March 11, 2009, 01:19:13 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

nice!.

mine is ok too.

i just can't seem to get the first principle of velocity v = (x2 -x1)/dt to work.

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!
 position01.PNG (58.88 KB, 1280x1024 - viewed 434 times.) « Last Edit: March 11, 2009, 02:08:57 pm by lookang » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #8 on: March 11, 2009, 03:28:23 pm » posted from:Taipei,T'ai-pei,Taiwan

Please write down the code you sued to calculate velocity v.
You applet did not support v=0. But my previous applet does.
 Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #9 on: March 11, 2009, 04:38:28 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

x1 = x;
t = t + dt; // i can't seems to create the difference in the value of x to be assigned to x2 and x1 differently despite the the line of code t = t+ dt;
x2 = x;
v = (x2 - x1)/dt;

but i seems to get no value for v.

it shouldn't be that difficult, but i can't figure out.

can save me?
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #10 on: March 11, 2009, 05:53:47 pm » posted from:Taipei,T'ai-pei,Taiwan

x1=x; // value of x copy to x1
t=t+dt; // value of t add dt and copy result to t
x2=x;// the same x value copy to x2, so x2 is the same as x1

So v=(x2-x1)/dt is always equal to 0.

If you want to calculate velocity, you need to save previous x,
support we save it as xs (define xs first).
Add the following line in the Fixed relations Page:
v=(x-xs)/dt; // x is the new value , and xs is the previous one.
xs=x;// save x value to xs

You should not reverse the above order. otherwise, you will get the same result=0.

x=xs= (your initial value) at the Initialization page.

 Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #11 on: March 11, 2009, 07:47:34 pm »

excellent tip!
i must remember how to do this again.
it works now.
thanks a million!
 *** There are 1 more attached files. You need to login to acces it! Logged
 Pages: [1]   Go Up
Everything has its beauty but not every one sees it. ...Confucius (551-479 BC)