NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/  September 21, 2020, 07:14:00 am  Welcome, Guest. Please login or register.Did you miss your activation email? 1 Hour 1 Day 1 Week 1 Month Forever Login with username, password and session length "Choose a job you love, and you will not have to work for a day in your life." ...Confucius (551-479 BC)
 Pages:    Go Down Author Topic: Ejs Open Source 2 Mass Model with Gravity Field Vector, Field Lines, Potential  (Read 7403 times) 0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Moderator
Hero Member      Offline

Posts: 1796 http://weelookang.blogspot.com  « 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
• 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

Posts: 1796 http://weelookang.blogspot.com  « 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
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.

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:    Go Up
"Choose a job you love, and you will not have to work for a day in your life." ...Confucius (551-479 BC)
 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 11619 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 18810 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 18438 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 11365 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 9666 December 13, 2012, 10:03:40 am by lookang
Page created in 0.063 seconds with 24 queries. since 2011/06/15