You can drag either charge and find out the new electric distribution. -*-

The field line are calculated in real time. However, please remember field line is not the same as trajectory for a test charge move in the same field. You can add test charge if the check box were checked and watch the trajectory of test charge.

It is easy to draw those vectors which represent electric field at different positions. Because we can calculate the electric field with . However, do you know how those field lines were calculated?

Hint: The tangential components of electric field line is the same as the firection of electric field at the same point.

Reply #8 on: October 05, 2010, 10:54:39 am » posted from:SINGAPORE,SINGAPORE,SINGAPORE

i been looking at the codes i have a question i notice the test mass uses

evolution to move dvxc/dt = -getF(-1,xc,yc,0)/m dvyc/dt= -getF(-1,xc,yc,1)/m

where getF double dx1,dy1,dx2,dy2,r12,r22,dx,dy,d,sign=-1; public double getF (int i, double xi,double yi, int mode) {//return electric field if(count>=n)return 0; // count >=n , do ntg dx1=xi-x1; dy1=yi-y1; dx2=xi-x2; dy2=yi-y2; r12=dx1*dx1+dy1*dy1; r22=dx2*dx2+dy2*dy2; if(i>-1){ if(add || out)return 0.; // if( (x>xmax && (y-ymax)*(y-ymin)>0) || (x<xmin && (y-ymax)*(y-ymin)>0) || //(y>ymax && (x-xmax)*(x-xmin)>0) || (y<ymin && (x-xmax)*(x-xmin)>0) || if(xi>scale*xmax || yi>scale*ymax || xi<scale*xmin || yi<scale*ymin || r12<size22 || r22<size22) { out=true;// if electric field line move outside the drawing region too far=> do not need to following the field line any more count++; return 0.; } } if(i<np)sign=q1/Math.abs(q1); // question sign mean sign of q1 ? else sign=q2/Math.abs(q2); // // question sign mean sign of q2 ? dx=q1*dx1/(r12*Math.sqrt(r12))+q2*dx2/(r22*Math.sqrt(r22)); dy=q1*dy1/(r12*Math.sqrt(r12))+q2*dy2/(r22*Math.sqrt(r22)); d=Math.sqrt(dx*dx+dy*dy); if(mode==0)return sign*dx/d; // question what does mode do? else return sign*dy/d; }

My thoughts: i tested the codes in the applet, i change the Q1 = + or - Q2 = 0 and the test particles goes in the out of the view direction regardless of the signs of Q1. it is a bug or i need to modify the codes more to reflect the sign of Q1 and Q2?

*** There are 1 more attached files. You need to login to acces it!

Reply #11 on: October 07, 2010, 05:13:44 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

fantastic!

thanks for update.

Can i request for another feature in your applet? arrows at the mid of charges to edge of applet to be position at midpoint and the direction of arrow is at direction of field lines at the mid point?

the pedagogy reason is field lines are normally drawn with some indication of the direction. chance to help

Reply #12 on: October 07, 2010, 09:36:27 pm » posted from:,,Taiwan

Right now the arrows are draw as 20x20 matrix. Do you mean you want it to be draw as 21x21 matrix (Then the middle one is the the center of the drawingPanel)?

Reply #16 on: October 09, 2010, 06:23:31 pm » posted from:,,Taiwan

I thought you were talking about the vector field. I changed it so that it re-present direction for the point at the center of of arrow (instead of the starting point).

Now. I finally understand you want to add arrow for field lines.

Reply #20 on: October 09, 2010, 10:37:18 pm » posted from:,,Taiwan

Because you asl for arrow for each field line, so fx,fy arrays are coordinnate where the arrow are drawn. fdx,fdy are vector for the arrow. Code are added to find fx,fy, fdx and fdy.