NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
November 20, 2017, 12:59:17 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
"Talk and eat less, think and listen more." ...Wisdom
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: Ejs Open Source Superposition of 2 Waves generated by equations  (Read 8544 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
on: January 28, 2009, 10:15:07 pm »

 Ejs Open Source Superposition of 2 Waves generated by equations

http://home.phy.ntnu.edu.tw/~lookang/EJS_4.1_090122/WaveFunctionPlotterSuperpositionwee.html

adapted from C:\EJS_4.1_090122\EJS_4.1\workspace\source\ModelingScience\Ch03_Basics\WaveFunctionPlotter.xml by Wolfgang Christian and Francisco Esquembre using the Easy Java Simulations (EJS) version 4.1 authoring and modeling tool.

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
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!

« Last Edit: August 14, 2012, 01:54:04 pm by lookang » Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #1 on: June 11, 2010, 04:11:30 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

Remix Legally by lookang
1. added another function input and graphics
2. change color scheme function 1 = blue, function 2 = black, sum = RED
3. added drop down menu for scaffolds and ease of exploration
4. added pedagogical options equations in como dropdown menu "sin(x-t);0.5*sin(x-t);2*sin(x-t);sin(0.5*x-t);sin(2*x-t);sin(x-0.5*t);sin(x-2*t);sin(x-t-0.785);sin(x-t-1.57)" and "sin(x+t);0.5*sin(x+t);2*sin(x+t);sin(0.5*x+t);sin(2*x+t);sin(x+0.5*t);sin(x+2*t);sin(x+t+0.785);sin(x+t+1.57)"
5. slider bar for n number of points to plot inbetween the screen
6. redesign interface to be bottom panel HORIZONTAL
7. added debug panel on the left set visible FALSE


Credits:
The Wave Function Plotter model was created by Wolfgang Christian and Francisco Esquembre using the Easy Java Simulations (EJS) version 4.1 authoring and modeling tool. You can examine and modify a compiled EJS model if you run the model (double click on the model's jar file), right-click within a plot, and select "Open Ejs Model" from the pop-up menu. You must, of course, have EJS installed on your computer. Information about Ejs is available at: and in the OSP ComPADRE collection .

Wave Function Plotter
A wave is a disturbance, such as sound, that propagates through space. For a wave propagating in one dimension, we use a wave function u(x,t) to represent the wave at position x and time t as shown in the screen shot. Although a sinusoidal wave function is a very common type type of disturbance, we should remember that there are many other wave functions, such as shock waves, that do not fit this functional form.
The model's fixed relations workpanel computes the data by evaluating the parser in the EJS Function element the using the following code:
double dx = (xmax-xmin)/n; // sample interval double x=xmin+dx/2; // position _view.trail.clear(); // clear old data for(int i=0; i
codes modified are

double dx = (xmax-xmin)/n; // sample interval
double x=xmin+dx/2; // position
_view.trail.clear(); // clear old data
_view.trail1.clear(); // need this else it will become a mess of points and make sure trail trail1 trail2 are names of the trail 2D element.
_view.trail2.clear(); // need this else it will become a mess of points



for(int i=0; i  double u = _view.waveFunction.evaluate(x,t); // evaluate wave function // make sure waveFunction is name of input function interface
  _view.trail.addPoint(x,u) ; // add data to trace // make sure name trail is name of trail 2D to _view.trail.addPoint(x,u)
//type _view. for scaffolds super cool!


// added by wee for another functionplot1
  double u1 = _view.waveFunction1.evaluate(x,t); // evaluate wave function
  _view.trail1.addPoint(x,u1); // add data to trace


// added by wee for sum
//sum = u+ u1 ;
sum = _view.waveFunction.evaluate(x,t)+_view.waveFunction1.evaluate(x,t);
_view.trail2.addPoint(x,sum);
// summax = %sum_string%;
x += dx; // increment position
}

old code used for http://home.phy.ntnu.edu.tw/~lookang/

« Last Edit: August 14, 2012, 01:24:41 pm by lookang » Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #2 on: August 13, 2012, 04:28:55 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

discussion with teachers

1 create a 1/8 step of the period

2 make 8 squares for 2 waves

3 added two pointers on progressive waves.



*** There are 1 more attached files. You need to login to acces it!
« Last Edit: August 13, 2012, 04:31:58 pm by lookang » Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #3 on: August 14, 2012, 01:24:26 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

discussion with teachers


1) I observed that when the new markers x-axis reach 4 units, the entire graph starts to shrink. If nothing can be done about it, then maybe we can remove the new markers?
done well autoscale false


2) The new "forward T/8" step function looks good. Sometimes there is a need to compare with the previous T/8 step. Do you think you could insert a "reverse T/8" step function too?
good idea done

3) The cyan colour looks nice but may not stand out. Can you pls help to change to say blue colour?
blue is good


Thanks man!

thanks to engrg1 for the coding for the dynamic selection of java string
public double cal_speed(String strTmp) {
  double temp;
  double coeff_x =1;
  double coeff_t =1;
 
  int tmp_start ;
  int tmp_end;
 
  // finding the constant x. Trying to extract coeff of x
  tmp_start = strTmp.indexOf('(');
  tmp_end = strTmp.indexOf("pi");
 
 
  if ((tmp_end - tmp_start )!= 1) {
  coeff_x = Double.parseDouble (strTmp.substring (tmp_start+1, tmp_end-1));
 
  }
  // finding the coeffient of t
  tmp_start = strTmp.indexOf('+');
  if (tmp_start == -1)
  tmp_start = strTmp.indexOf('-'); 
 
  tmp_end = strTmp.indexOf('t');
 

 
 if ((tmp_end - tmp_start )!= 1) {
 
  coeff_t = Double.parseDouble (strTmp.substring (tmp_start+1, tmp_end-1));
  } 
 
  temp = coeff_t/coeff_x;
 
 
 
  return temp;
 
 
 
}


* superposition_2012-08-14_1454.png (35.35 KB, 608x627 - viewed 338 times.)

*** There are 1 more attached files. You need to login to acces it!
« Last Edit: August 14, 2012, 01:53:37 pm by lookang » Logged
Pages: [1]   Go Up
  Print  
"Talk and eat less, think and listen more." ...Wisdom
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Interference between two waves (point source)
Wave
Fu-Kwun Hwang 10 167176 Last post July 21, 2015, 01:15:17 pm
by Walterting
Superposition of two waves (same frequency, different amplitude, phase/dir )
Wave and Fluid
Fu-Kwun Hwang 1 24187 Last post October 23, 2017, 08:29:35 am
by Jocafis
Superposition of two waves
wave and fluid
ahmedelshfie 0 4066 Last post June 08, 2010, 02:36:57 am
by ahmedelshfie
EJS open source code Circular Well Superposition Model
Simulations from other web sites
ahmedelshfie 1 3773 Last post July 07, 2010, 08:09:40 pm
by ahmedelshfie
grid on Superposition of Two Waves
Question related to Physics or physics related simulation
erwarzeski 4 16658 Last post August 09, 2010, 04:53:27 pm
by lookang
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.07 seconds with 23 queries.since 2011/06/15