NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
October 21, 2017, 07:11:43 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Life well spent is long. ..."da Vinci (1452-1519, Italian artist, sculptor, painter, architect, engineer and scientist) "
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 2 Mass Model with Gravity Field Vector, Field Lines, Potential  (Read 6266 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: August 05, 2011, 09:21:32 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

Ejs Open Source 2 Mass Model with Gravity Field Vector, Field Lines, Potential Visualization.
author: Fu-Kwun Hwang and slightly edited by lookang

reference:
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=539.0
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1968.0

re-purposed from charge to mass by
m1 = -q1;
m2 = -q2;

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: September 06, 2011, 09:35:16 pm by lookang » Logged
lookang
Moderator
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #1 on: September 06, 2011, 06:40:27 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

additional changes, added on 06 September 2011

added value of potential to be shown adapted codes from http://www.compadre.org/OSP/items/detail.cfm?ID=11443 Point Charge Electric Potential Model written by Wolfgang Christian
// adapted from http://www.compadre.org/OSP/items/detail.cfm?ID=11443
public void potentialMessage () {
  double xm=_view.DrawingPanel.getMouseX(); // mouse x-location
  double ym=_view.DrawingPanel.getMouseY(); // mouse y-location
  double v=0;
// for(int p=0; p   double dx=xm-x1; // for first charge // x-separation from grid point
   double dy=ym-y1; // y-separation from grid point
   double r2=dx*dx+dy*dy; // charge to grid point distance squared
   double dx2=xm-x2; // for second charge // x-separation from grid point
   double dy2=ym-y2; // y-separation from grid point
   double r22=dx2*dx2+dy2*dy2; // charge to grid point distance squared
  
   if(r2==0||r22==0){ // check for singularity
   v=Double.NaN; // field is not defined at singularity
// break; // break from loop
   }else{
   v = G*q1/Math.sqrt(r2)+G*q2/Math.sqrt(r22); // add scalar potential
// Evalue = G*q1/r2+G*q2/r2;
   } // end of if statement
// } // end of charge loop
  dragMsg="math_failure (math_unknown_error): \\phi = "+_view.format(v,"0.0E0")+ " J/kg";
// dragMsgE="g = "+_view.format(Evalue,"0.0E0")+ " N/kg";
  
}
added value of field strength to be shown redesigned by myself with reference and using http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=539.0
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1968.0 by Fu-Kwun Hwang.

// adapted from http://www.compadre.org/OSP/items/detail.cfm?ID=11443
public void fieldMessage () {
  double xm=_view.DrawingPanel.getMouseX(); // mouse x-location
  double ym=_view.DrawingPanel.getMouseY(); // mouse y-location
  double Evalue=0;
// for(int p=0; p   double dx1=xm-x1; //first charge // x-separation from grid point
   double dy1=ym-y1; // y-separation from grid point
   double r12=dx1*dx1+dy1*dy1; // charge to grid point distance squared
   double dx2=xm-x2; //second charge // x-separation from grid point
   double dy2=ym-y2; // y-separation from grid point
   double r22=dx2*dx2+dy2*dy2; // charge to grid point distance squared
double dx=q1*dx1/(r12*Math.sqrt(r12))+q2*dx2/(r22*Math.sqrt(r22));
double dy=q1*dy1/(r12*Math.sqrt(r12))+q2*dy2/(r22*Math.sqrt(r22));
double d=Math.sqrt(dx*dx+dy*dy);
double Evaluex=dx;
double Evaluey=dy;
//double Evalue = Math.sqrt(Evaluex*Evaluex+Evaluex*Evaluex);
 if(r12==0||r22==0){ // check for singularity
   Evaluex=Double.NaN; // field is not defined at singularity
   Evaluey=Double.NaN;
// break; // break from loop
   }else{
   Evaluex=G*dx;
   Evaluey=G*dy;
Eangle = Math.atan2(Evaluey,Evaluex)*180/pi;
// v = G*q1/Math.sqrt(r2)+G*q2/Math.sqrt(r2); // add scalar potential
   Evalue = Math.sqrt(Evaluex*Evaluex+Evaluey*Evaluey);
   } // end of if statement
 // } // end of charge loop
// dragMsg="V = "+_view.format(v,"0.0E0")+ " V";
  dragMsgEx="gx = "+_view.format(Evaluex,"0.0E0")+ " N/kg";
   dragMsgEy="gy = "+_view.format(Evaluey,"0.0E0")+ " N/kg";
   dragMsgE="|g| = "+_view.format(Evalue,"0.0E0")+ " N/kg at angle =" +_view.format(Eangle,"000") +"to +x-axis counterclockwise";
   }

« Last Edit: September 06, 2011, 09:34:53 pm by lookang » Logged
Pages: [1]   Go Up
  Print  
Life well spent is long. ..."da Vinci (1452-1519, Italian artist, sculptor, painter, architect, engineer and scientist) "
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Ejs Open Source Magnetic Field Vector of 2 current carrying wires Model
Collaborative Community of EJS
lookang 2 9933 Last post August 20, 2010, 08:15:22 am
by lookang
Ejs Open Source Gravitational Field & Potential of 2 Mass Java Applet
Collaborative Community of EJS
lookang 12 14633 Last post June 28, 2012, 08:17:32 am
by lookang
Ejs Open Source 2 Charge Model with Field Vector, Field Lines, Potential Visual
Collaborative Community of EJS
lookang 12 14591 Last post August 15, 2013, 07:41:28 am
by lookang
Ejs Open Source Bar Magnetic Field Lines Model Java Applet
Collaborative Community of EJS
lookang 7 8431 Last post December 20, 2012, 06:55:06 pm
by Fu-Kwun Hwang
Ejs Open Source Magnetic Dipole Field Vector & Field Lines 3D Model Java Applet
Collaborative Community of EJS
lookang 2 7203 Last post December 13, 2012, 10:03:40 am
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.927 seconds with 23 queries.since 2011/06/15