NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
June 20, 2019, 12:34:20 am

Wisdom is to form a good attitude and a healthy lifestyle. ...Wisdom

 Pages: [1]   Go Down
 Author Topic: Simple Examples for beginner who want to learn EJS  (Read 12366 times) 0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

 « Embed this message on: June 11, 2010, 11:42:50 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

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!
to view/hide applet.
 springv.gif (20.32 KB, 730x408 - viewed 386 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

 « Embed this message Reply #1 on: June 11, 2010, 11:56:10 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

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!
to view/hide simulation!
 funcationxy.gif (13.77 KB, 540x513 - viewed 418 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

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

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

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!
to view/hide simulation!
 projectile motion.gif (13 KB, 644x368 - viewed 424 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

 « Embed this message Reply #3 on: June 12, 2010, 12:27:47 am » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

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!
to view/hide simulation!
 Air density.gif (21.22 KB, 561x568 - viewed 414 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

 « Embed this message Reply #4 on: June 12, 2010, 12:41:40 am » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

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!
to view/hide simulation!
 illustrate 10 base.gif (12.97 KB, 878x249 - viewed 396 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

 « Embed this message Reply #5 on: June 12, 2010, 01:05:00 am » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

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!
to view/hide simulation!
 tiger.gif (12.81 KB, 394x447 - viewed 451 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

 « Embed this message Reply #6 on: June 12, 2010, 01:16:17 am » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

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!
to view/hide simulation!
 Linear Equation.gif (15.84 KB, 446x510 - viewed 427 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

 « Embed this message Reply #7 on: June 12, 2010, 01:28:04 am » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

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!
to view/hide simulation!
 bouncingball.gif (9.91 KB, 332x334 - viewed 396 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

 « Embed this message Reply #8 on: June 12, 2010, 01:40:57 am » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

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!
to view/hide simulation!
 wave.gif (13.34 KB, 372x363 - viewed 407 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

 « Embed this message Reply #9 on: June 12, 2010, 01:50:45 am » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

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!
to view/hide simulation!
 collision between twp particles in one dimension(along a line).gif (11.61 KB, 343x386 - viewed 427 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

 « Embed this message Reply #10 on: June 14, 2010, 06:36:45 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

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!
to view/hide simulation!
 RotationalPendulum.gif (17.85 KB, 447x431 - viewed 426 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

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

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).

Click

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!
to view/hide simulation!
 videopendululm.gif (56.08 KB, 459x370 - viewed 425 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

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

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

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!
to view/hide simulation!
 Fall and Rebound.gif (10.6 KB, 380x327 - viewed 426 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

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

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

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!
to view/hide simulation!
 Predators and preys simulation.gif (22.97 KB, 680x427 - viewed 410 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

 « Embed this message Reply #14 on: June 18, 2010, 06:46:43 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

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

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!
to view/hide simulation!
 earthandmoon.gif (12.96 KB, 534x445 - viewed 433 times.) Logged
ahmedelshfie
Moderator
Hero Member

Offline

Posts: 954

 « Embed this message Reply #15 on: September 20, 2010, 05:56:37 pm » posted from:SAO PAULO,SAO PAULO,BRAZIL

This applet is Particles 3D Design by Francisco Esquembre.
Particles 3D:
This is a simulation of a set of particles moving freely inside a 3D cube and colliding with a moveable floor.
The state it is now, the example is just a show-off of the 3D capabilities of Ejs, but... can you think of an application to gas dynamics?

Click

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!

to view/hide applet!
 particles 3d.gif (38.11 KB, 489x380 - viewed 433 times.) Logged
 Pages: [1]   Go Up
Wisdom is to form a good attitude and a healthy lifestyle. ...Wisdom