Author Topic: Simple Examples for beginner who want to learn EJS  (Read 14494 times)

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Simple Examples for beginner who want to learn EJS
« on: June 12, 2010, 12:42:50 am »
This following applet Vertical Spring
Created by prof Hwang Modified by Ahmed
Original project Vertical Spring
This is an applet related to a spring subject to gravitation force.

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide applet.

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #1 on: June 12, 2010, 12:56:10 am »
This following applet is Mathematic function F(x), F(y) plot
Created by prof Hwang Modified by Ahmed
Original project Mathematic function F(x), F(y) plot

You can change different mathematic function for x or y coordinate, i.e. Fx(t), Fy(t)
This simulation will plot it for you.
For example: if you enter fx(t)=A*sin(w1*t), fy(t)=B*cos(w2*t)
It will draw Lissajous pattern for you.
The default setting is for someone who want to study variation of Lissajous pattern due to some other noise C*sin(w2*t).


Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #2 on: June 12, 2010, 01:14:05 am »
This following applet is Projectile motion
Created by prof Hwang Modified by Ahmed
Original project projectile motion

This is a simple example for projectile motion. Change the velocity and click play to see the trace.

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #3 on: June 12, 2010, 01:27:47 am »
This following is Air density/pressure and temperature vs altitude
Created by prof Hwang Modified by Ahmed
Original project Air density/pressure and temperature vs altitude

This simulation display how air density, air pressure and temperature vary with altitude.
$h=44.3308 - 4.94654 P^{0.190263}$ where h = geopotential altitude (km), p=actual air pressure, Pascals
However, pressure is convert to atm (1 atm= 101325 Pa).

$h=44.3308 -42.2665 D^{0.234969}$ were used to calculate density from altitude h (km). The unit for density D is $kg/m^3$

The temperature is estimated with $T(h)= 15- 6.5 *h$

You can drag the dot shown in the curve to change the altitude h (or drag the slider vertically up/down)

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #4 on: June 12, 2010, 01:41:40 am »
This following applet is illustrate 10 base/ 2 base and 16 base Number
Created by prof Hwang Modified by Ahmed
Original project Another GUI example: illustrate 10 base/ 2 base and 16 base Number

The following example show a random generated number (from 0-999) with 10 base, 2 base and 16base display.

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #5 on: June 12, 2010, 02:05:00 am »
This following applet is Link EJS GUI properties to model variables (image:width/height/angle)
Created by prof Hwang Modified by Ahmed
Original project Link EJS GUI properties to model variables (image:width/height/angle)

This applet demostrate how to use image in EJS.
Width/Height and angle of rotation for the image can be set easily.

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #6 on: June 12, 2010, 02:16:17 am »
This following applet is Linear Equation a*x+b*y=c
Created by prof Hwang Modified by Ahmed
Original project Linear Equation a*x+b*y=c

This applet illustrate the meaning of a*x+b*y=c
You can drag sliders to change a,b,c and find out how the line changes!

This example also show you how to assign properties for GUI elements if you are interested in building simulation with EJS.

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #7 on: June 12, 2010, 02:28:04 am »
This following applet is A bouncing ball (learn how to create event to habdle bouncing condition in EJS)
Created by prof Hwang Modified by Ahmed
Original project A bouncing ball (learn how to create event to habdle bouncing condition in EJS

A ball bouncing back on the ground under gravitation force.
This example shows you how to use event in EJS to take care of the bounding conditiion.
(Check out event on evolution page under Model tab)

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #8 on: June 12, 2010, 02:40:57 am »
This following applet is A simple wave (moving concentric circles)
Created by prof Hwang Modified by Ahmed
Original project A simple wave (moving concentric circles)

Fond out how easy to create concentric circles with EJS.
Please click "load ejs as signed applet". You will need to give permission for browser to load ejs.
And you will find out how this applet was created with EJS.
You can modify it and generate new simulation,too!

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #9 on: June 12, 2010, 02:50:45 am »
This following applet is collision between twp particles in one dimension(along a line)
Created by prof Hwang Modified by Ahmed
Original project collision between twp particles in one dimension(along a line)

This is a simple model created with EJS.
The mass for two particles are the same initially.
Use mouse to drag the slider to change the velocity for one of the particle.
You will find the velocity exchanged when collision occurred.
Then, drag the slider to modify the mass for the particles, the situation getting complicated.
However, the momentum is always conserved.

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #10 on: June 14, 2010, 07:36:45 pm »
This following applet is RotationalPendulum
Created by prof Hwang Modified by Ahmed
Original project RotationalPendulum

This applet illustrate how to use 3D GUI elements: 3D Rotational Pendulum

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #11 on: June 14, 2010, 07:53:18 pm »
This following applet is How to combine simulation with a quicktime movie file
Created by prof Hwnag Modified by Ahmed
Original project How to combine simulation with a quicktime movie file

The following is an examples to include a quicktime movie in the simulation.
User is asked to adjust the parameter so that the simulation can re-product the same period of pendulum motion as the background movie.

P.S. This applet need to be signed to be able to view correctly (due to restriction in quicktime movie).
Please download it and run it as an application (and it will be fine).

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #12 on: June 14, 2010, 08:07:21 pm »
This following applet is Fall and Rebound
Created by prof Hwang Modified by Ahmed
Original project Fall and Rebound

Fall and Rebound
How do we simulate a (free) falling object?
Well, the answer, in principle, is rather simple: just solve the equation y'' = -g, where g is gravity.
And this works, perfectly well... except when the object reaches the ground. Then, we would expect the object to rebound.
When rebounding, the object changes instantly its velocity from downwards (negative) to upwards (positive). If the rebounding is perfectly elastic, then the object's velocity remains constant in modulus.
But, how would you implement this in a simulation?
This example shows two possible approaches to solve this problem.
The first one uses the closed form solution of the equations for the movement. It is fast, clean and efficient. But implies that we know the solution. In other, more complicated situations, we might not be able to solve these equations. For instance, if there is an external variable force applied to the falling object.
The second approach implies fine-tuning the way we solve numerically the second order differential equation at every moment. When the object comes closer to the ground, we ask the method to use a smaller time step. This provides a more accurate computation of the velocity the object had when reaching the ground.
The disadvantage is that the simulation seems to run slower at the critical moment. We try to compensate this, by asking Ejs to run faster!
Author : Francisco Esquembre

 From an original idea from Taiwan Workshop on Ejs Date : March 2002

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #13 on: June 15, 2010, 07:55:05 pm »
Predators and preys
The historical introduction to the problem of predator and preys can be found in the other example with a similar name (which you should see first). In that example, the classical approach of Lotka and Volterra was introduced.
In this simulation, we will try to really simulate how predators and preys coexist in a reduced piece of land. We need to describe how preys reproduce and feed predators (so to say), and how predators reproduce accordingly. To make it a bit more realistic, both, predators and pres move in each evolution step, and it is only if they meet that a predator can find its lunch!
The goal is to be able to produce a setting in which both species coexist with their respective population showing a (more or less) stable alternating behaviour.

There are plenty of activities that can be done here. Although you are presented with three slighty different solutions for this problem which give reasonable results, perhaps the most interesting activity is to clear the corresponding evolution pages and ask your students to provide their own specification for what the mutual interaction of these two species should be. This can be presented to your students as a kind of team competition game. The team which produces a more stable final solution wins!
 
1. Even if you give them the solution included in the example, you can ask them to find appropriate values for the parameters. It took me a lot of time to get to find the ones I include here. If you look closer at them, they look more parameters for an infection than parameters for tigers and rabbits. There is a reason for this. Simple models (like Lotka-Volterra) are suitable for simple situations only.
2. Try to improve the haunting scheme (make it more intelligent, let predators smell food from longer distances,...) and see if you can improve the result.
3. Implement a reservoir of preys, where predators can not get in and see if you can improve the result.

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!

ahmedelshfie

  • Moderator
  • Hero Member
  • *****
  • Posts: 930
Re: Simple Examples for beginner who want to learn EJS
« Reply #14 on: June 18, 2010, 07:46:43 pm »
Earth and Moon
This is a simulation of a reduced two-body problem.
I have used data for the Earth and the Moon just to make it more attractive . The rotation is simulated using animated gifs. However, in slow machines, this can unnecesarily waste some computer resources. Hence, if the simulation behaves strangely, substitute the animated gifs for the static ones you will find in the data directory.
The difficult part is certainly to set up initial conditions so that the elliptical orbit has a period that approximates the real one of the Moon around the Earth. As an exercise for your students, delete the initialConditions initialization page and ask your students to reproduce it!

Author : Francisco Esquembre
Original project Earth and Moon

Click

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • 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!
to view/hide simulation!