This is the web version of EJS interface
EJS version 4.3.0
  1. Title=Magnetic Field of 2 wires
  2. Author=Fu-Kwun Hwang - Dept. of Physics, National Taiwan Normal Univ. and lookang
  3. Keywords=current magnetic parallel opposite
  4. Level=high school
  5. Abstract=hwang@phy.ntnu.edu.tw weelookang@gmail.com
  6. CaptureTools=false
  7. DataTools=false
  8. LanguageTools=true
  9. EmersionSupport=false
  10. UseInterpreter=true
  11. AuxiliaryFiles=./MagneticField2Wire/;
  12. DetectedFiles=./MagneticField2Wire/MagneticField2Wire.html;

MagneticFieldFromLoops

neticField2Wire/MagneticField2Wire
    NameValueTypeDimension
    NameValueTypeDimension

    Init Page

    t=0; px=mx; py=my; tcst=Math.abs(x2-x1);

    Evol Page

    Indep. Var. Increment
    d px /dt=calBx(px,py)
    d py /dt=calBy(px,py)
    SolverRungeKuttaFehlbergTolerance=0.000001

    FixRel Page

    for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ x=xmin+(i+0.5)*dx; y=ymin+(j+0.5)*dy; r1=Math.sqrt((x-x1)*(x-x1)+y*y); r2=Math.sqrt((x-x2)*(x-x2)+y*y); c1=Math.atan2(y,x-x1); c2=Math.atan2(y,x-x2); sc1=Math.sin(c1); cs1=Math.cos(c1); sc2=Math.sin(c2); cs2=Math.cos(c2); Bx[i][j]=-(sign1)*(magnitude1)*sc1/r1+(-sign2)*(magnitude2)*sc2/r2+B*cst; // Bx[i][j]=-c1/r1-sc2/r2+B*cst; By[i][j]=(sign1)*(magnitude1)*cs1/r1+(sign2)*(magnitude2)*cs2/r2+Bexternaly*cst; //By[i][j]=cs1/r1-cs2/r2; //bc=Math.atan2(Bx,By); } }

    dvalue

    double dv; public double dvalue (double v) { if(v>0)dv=0.5; else if(v<0)dv=-0.5; else dv=0; return (int)(v*100+dv)/100.; } public double calBx(double x,double y){ r1=Math.sqrt((x-x1)*(x-x1)+y*y); r2=Math.sqrt((x-x2)*(x-x2)+y*y); c1=Math.atan2(y,x-x1); c2=Math.atan2(y,x-x2); sc1=Math.sin(c1); cs1=Math.cos(c1); sc2=Math.sin(c2); cs2=Math.cos(c2); bx= -(sign1)*(magnitude1)*sc1/r1+(-sign2)*(magnitude2)*sc2/r2+B*cst; by = (sign1)*(magnitude1)*cs1/r1+(sign2)*(magnitude2)*cs2/r2+Bexternaly*cst; //bx=-sc1/r1-sc2/r2+B*cst; // by=cs1/r1+cs2/r2; return bx*tcst; } public double calBy(double x,double y){ return by*tcst; } public void vinit(){ _view.trace.clear(); }
    EJSVIEW: Click link to view it's content
    Control variables:(testing)
    double,double,double,double
    title="Frame"
    layout=border
    visible=true
    location="30,29"
    size="600,643"
    position=south
    layout=VBOX
    borderType=LOWERED_ETCHED
    layout=HBOX
    variable=magnitude1
    value=1.0
    minimum=-5
    maximum=5
    format="I1 = 0.0 A"
    ticks=11
    closest=true
    background=YELLOW
    tooltip="current in wire 1, positive current in out of the plane Z"
    variable=magnitude2
    value=1.0
    minimum=-5
    maximum=5
    format="I2 = 0.0 A"
    ticks=11
    closest=true
    background=CYAN
    tooltip="current in wire 2 , positive current in out of the plane Z"
    position=center
    image=/org/opensourcephysics/resources/controls/images/reset.gif
    action=_reset()
    position=center
    layout=GRID:1,0,0,0
    position=center
    autoscaleX=false
    autoscaleY=false
    minimumX=xmin
    maximumX=xmax
    minimumY=ymin
    maximumY=ymax
    square=true
    x=mx
    y=my
    pressaction=_pause(); t=0;
    action=_initialize(); _play();
    background=LIGHTGRAY
    minimumX=xmin
    maximumX=xmax
    minimumY=ymin
    maximumY=ymax
    xcomponent=Bx
    ycomponent=By
    length=dx
    elementposition=CENTERED
    levels=60
    visible=magnitude1>=0
    x=x1
    y=0+0
    sizeX=size
    sizeY=size
    enabledPosition=true
    releaseAction=vinit ()
    lineColor=YELLOW
    fillColor=null
    lineWidth=stroke
    x=x1
    y=0+0
    sizeX=size/5
    sizeY=size/5
    enabledPosition=true
    releaseAction=vinit ()
    lineColor=YELLOW
    fillColor=YELLOW
    lineWidth=stroke
    visible=magnitude1<0
    x=x1
    y=0+0
    sizeX=size
    sizeY=size
    transformation=pi/4
    enabledPosition=true
    releaseAction=vinit ()
    style=WHEEL
    lineColor=YELLOW
    fillColor=null
    lineWidth=stroke
    visible=magnitude2>=0
    x=x2
    y=0+0
    sizeX=size
    sizeY=size
    enabledPosition=true
    releaseAction=vinit ()
    lineColor=CYAN
    fillColor=null
    lineWidth=stroke
    x=x2
    y=0+0
    sizeX=size/5
    sizeY=size/5
    enabledPosition=true
    releaseAction=vinit ()
    lineColor=CYAN
    fillColor=CYAN
    lineWidth=stroke
    visible=magnitude2<0
    x=x2
    y=0+0
    sizeX=size
    sizeY=size
    transformation=pi/4
    enabledPosition=true
    releaseAction=vinit ()
    style=WHEEL
    lineColor=CYAN
    fillColor=null
    lineWidth=stroke
    x=px
    y=py
    memory=5
    maxpoints=npt
    active=_isPlaying()
    norepeat=true
    connected=t>dt
    color=BLACK
    stroke=stroke
    position=west
    layout=VBOX
    position=north
    text="B ext y"
    tooltip="External B Field in y direction"
    position=center
    variable=Bexternaly
    minimum=-1
    maximum=1.0
    format="0.00"
    orientation=VERTICAL
    ticks=11
    closest=true
    action=vinit ()
    tooltip="External B Field in y direction"
    position=north
    layout=HBOX
    variable=B
    minimum=-1.0
    maximum=1.0
    format="B ext x=0.00"
    ticks=21
    closest=true
    action=vinit ()
    tooltip="External B Field in x direction"