This is the web version of EJS interface
EJS version 4.2.7
  1. CaptureTools=true
  2. DataTools=true
  3. LanguageTools=true
  4. EmersionSupport=false
  5. UseInterpreter=true
    NameValueTypeDimension
    NameValueTypeDimension

    Cons Page

    // Field and potential from particle 1 if (xtest != x1) { E1 = k*q1/((xtest-x1)*(xtest-x1))*(xtest-x1)/Math.abs(xtest-x1); V1 = k*q1/(Math.sqrt((xtest-x1)*(xtest-x1))); } else { E1 = 1.0e12; V1 = 1.0e12*q1; } Enet = E1; Vnet = V1; // Field and potential from particle 2 if (show2) { if (xtest != x2) { E2 = k*q2/((xtest-x2)*(xtest-x2))*(xtest-x2)/Math.abs(xtest-x2); V2 = k*q2/(Math.sqrt((xtest-x2)*(xtest-x2))); } else { E2 = 1.0e12; V2 = 1.0e12*q2; } Enet = Enet + E2; Vnet = Vnet + V2; scale2 = 1.0; } else { E2 = 0.0; V2 = 0.0; scale2 = 0.0; } // Max x values of the functions if (showgraph) { plot1max = x1-0.01; plot2max = plot1max; if (show2) { showmidgraph = true; plot2max = x2-0.01; if (x2 < x1) { plot2max = plot1max; plot1max = x2-0.01; } else { if (x2 == x1) { showmidgraph = false; } } } else { showmidgraph = false; } } else { showmidgraph = false; } if (showVgraph) { plot1max = x1-0.01; plot2max = plot1max; if (show2) { showmidVgraph = true; plot2max = x2-0.01; if (x2 < x1) { plot2max = plot1max; plot1max = x2-0.01; } else { if (x2 == x1) { showmidVgraph = false; } } } else { showmidVgraph = false; } } else { showmidVgraph = false; } if (q1 > 0.0) { redness = 250; greenness = 0; blueness = 0; colorball1 = new java.awt.Color(redness,greenness,blueness); } else { if (q1 < 0.0) { redness = 0; greenness = 0; blueness = 250; colorball1 = new java.awt.Color(redness,greenness,blueness); } else { redness = 200; greenness = 200; blueness = 200; colorball1 = new java.awt.Color(redness,greenness,blueness); } } if (q2 > 0.0) { redness = 250; greenness = 0; blueness = 0; colorball2 = new java.awt.Color(redness,greenness,blueness); } else { if (q2 < 0.0) { redness = 0; greenness = 0; blueness = 250; colorball2 = new java.awt.Color(redness,greenness,blueness); } else { redness = 200; greenness = 200; blueness = 200; colorball2 = new java.awt.Color(redness,greenness,blueness); } }
    EJSVIEW: Click link to view it's content
    Control variables:(testing)
    double,double
    title="Electric Field and Potential in One Dimension"
    layout=border
    visible=true
    location="247,8"
    size="746,574"
    background=black
    position=east
    layout=border
    position=north
    layout=grid:0,1,0,0
    size=200,420
    variable=show2
    selected=true
    text=Use two charged particles
    foreground=128,192,0
    variable=showgraph
    selected=true
    text=Show graph of the field
    foreground=128,192,0
    variable=showVgraph
    selected=true
    text=Show graph of the potential
    foreground=128,192,0
    variable=q1
    value=10.0002
    minimum=-30.0
    maximum=30.0
    format=Charge on particle 1 (in nC) = 0.#
    orientation=HORIZONTAL
    foreground=255,128,0
    variable=q2
    minimum=-30.0
    maximum=30.0
    format=Charge on particle 2 (in nC) = 0.#
    orientation=HORIZONTAL
    enabled=show2
    foreground=255,128,0
    text=Reset Simulation
    action=_reset()
    background=BLACK
    foreground=128,0,128
    font=Dialog,BOLD,16
    text=%helpLabel%
    action=if (helpFlag) { helpFlag = false; helpLabel = "Show Help"; } else { helpFlag = true; helpLabel = "Hide Help"; }
    background=BLACK
    foreground=128,0,128
    font=Dialog,BOLD,16
    position=center
    autoscaleX=false
    autoscaleY=false
    minimumX=xmin
    maximumX=xmax
    minimumY=-2000.0
    maximumY=2000.0
    square=false
    title="Electric Field and Potential in One Dimension"
    titleX=Position (m)
    majorTicksX=true
    titleY="Electric Field (N/C) and Electric Potential (V)"
    majorTicksY=true
    interiorBackground=128,128,0
    foreground=128,64,0
    x=x1
    y=zeroval
    sizex=0.3
    sizey=160.0
    enabled=true
    dragaction=zeroval = 0.0;
    secondaryColor=orange
    color=colorball1
    x=x2
    y=zeroval
    sizex=0.3
    sizey=160.0
    visible=show2
    enabled=true
    dragaction=zeroval = 0.0;
    secondaryColor=64,192,0
    color=64,192,0
    x=x1
    y=-150
    enabled=false
    text=1
    color=192,0,255
    x=x2
    y=-150
    visible=show2
    enabled=false
    text=2
    color=192,0,255
    points=200
    min=-6.0
    max=plot1max
    variable=xval
    functionx=xval
    functiony=k*q1/((xval-x1)*(xval-x1))*(xval-x1)/Math.abs(xval-x1)+ k*q2*scale2/((xval-x2)*(xval-x2))*(xval-x2)/Math.abs(xval-x2)
    color=128,192,0
    stroke=2
    visible=showgraph
    enabled=false
    points=200
    min=plot1max+0.02
    max=plot2max
    variable=xval2
    functionx=xval2
    functiony=k*q1/((xval2-x1)*(xval2-x1))*(xval2-x1)/Math.abs(xval2-x1) + k*q2*scale2/((xval2-x2)*(xval2-x2))*(xval2-x2)/Math.abs(xval2-x2)
    color=128,192,0
    stroke=2
    visible=showmidgraph
    enabled=false
    points=200
    min=plot2max+0.02
    max=6.0
    variable=xval3
    functionx=xval3
    functiony=k*q1/((xval3-x1)*(xval3-x1))*(xval3-x1)/Math.abs(xval3-x1)+ k*q2*scale2/((xval3-x2)*(xval3-x2))*(xval3-x2)/Math.abs(xval3-x2)
    color=128,192,0
    stroke=2
    visible=showgraph
    enabled=false
    points=200
    min=-6.0
    max=plot1max
    variable=xval
    functionx=xval
    functiony="k*q1/(Math.sqrt((xval-x1)*(xval-x1)))+ k*q2*scale2/(Math.sqrt((xval-x2)*(xval-x2)))"
    color=64,64,0
    stroke=2
    visible=showVgraph
    enabled=false
    points=200
    min=plot1max+0.02
    max=plot2max
    variable=xval2
    functionx=xval2
    functiony=k*q1/(Math.sqrt((xval2-x1)*(xval2-x1))) + k*q2*scale2/(Math.sqrt((xval2-x2)*(xval2-x2)))
    color=64,64,0
    stroke=2
    visible=showmidVgraph
    enabled=false
    points=200
    min=plot2max+0.02
    max=6.0
    variable=xval3
    functionx=xval3
    functiony=k*q1/(Math.sqrt((xval3-x1)*(xval3-x1)))+ k*q2*scale2/(Math.sqrt((xval3-x2)*(xval3-x2)))
    color=64,64,0
    stroke=2
    visible=showVgraph
    enabled=false
    x=xtest
    y=zeroval
    sizex=0.2
    sizey=107.0
    enabled=true
    dragaction=zeroval = 0.0;
    secondaryColor=128,64,0
    color=128,64,0
    x=xtest
    y=12.0
    sizex=E1
    sizey=0.0
    scalex=0.01
    scaley=0.01
    enabledSecondary=false
    enabled=false
    style=ARROW
    color=255,128,0
    secondaryColor=255,128,0
    stroke=2
    x=xtest
    y=-12.0
    sizex=E2
    sizey=0.0
    scalex=0.01
    scaley=0.01
    visible=show2
    enabledSecondary=false
    enabled=false
    style=ARROW
    color=128,0,128
    secondaryColor=128,0,128
    stroke=2
    position=south
    layout=grid:4,3,3,3
    size=300,120
    border=50
    borderType=MATTE
    borderColor=CYAN
    value="At the test charge location"
    editable=false
    size=200,40
    foreground=128,128,0
    font=Dialog,BOLD,18
    value=units are N/C (+ = right)
    editable=false
    foreground=128,128,0
    font=Dialog,BOLD,18
    value=units are volts
    editable=false
    foreground=128,128,0
    font=Dialog,BOLD,18
    value=From charged particle 1
    editable=false
    foreground=64,128,0
    font=Dialog,BOLD,18
    variable=E1
    format=E1 = 0.##
    editable=false
    foreground=192,128,0
    font=Dialog,BOLD,18
    variable=V1
    format=V1 = 0.##
    editable=false
    foreground=128,0,255
    font=Dialog,BOLD,18
    value=From charged particle 2
    editable=false
    foreground=64,128,0
    font=Dialog,BOLD,18
    variable=E2
    format=E2 = 0.##
    editable=false
    foreground=192,128,0
    font=Dialog,BOLD,18
    variable=V2
    format=V2 = 0.##
    editable=false
    foreground=128,0,255
    font=Dialog,BOLD,18
    value=Net field and potential
    editable=false
    foreground=64,128,0
    font=Dialog,BOLD,18
    variable=Enet
    format=Enet = 0.##
    editable=false
    foreground=192,128,0
    font=Dialog,BOLD,18
    variable=Vnet
    format=Vnet = 0.##
    editable=false
    foreground=128,0,255
    font=Dialog,BOLD,18
    layout=grid:0,1,0,0
    visible=helpFlag
    onClosing=helpFlag = false; helpLabel = "Show Help";
    location="270,0"
    size="697,299"
    background=BLACK
    value=Click and drag the test charge (the small red circle) left or right to sample the field at different locations.
    editable=false
    foreground=128,192,0
    font=Dialog,BOLD,13
    value=Red indicates a positive charge, while blue indicates a negative charge.
    editable=false
    foreground=128,192,0
    font=Dialog,BOLD,13
    value=The magenta arrow is the field from particle 1, the light blue arrow is the field from particle 2.
    editable=false
    foreground=128,192,0
    font=Dialog,BOLD,13
    value=Use the sliders, in the menu at the right, to set the location of the charged particles and their charges.
    editable=false
    foreground=128,192,0
    font=Dialog,BOLD,13
    value=Use the checkboxes at the top right to turn on or off the second charge, and to show or hide the graph.
    editable=false
    foreground=128,192,0
    font=Dialog,BOLD,13
    value="You can completely reset the simulation using the Reset Simulation button."
    editable=false
    foreground=128,192,0
    font=Dialog,BOLD,13
    value=If you click in the graph area, you can read the coordinates in the yellow box at the bottom left.
    editable=false
    foreground=128,192,0
    font=Dialog,BOLD,13
    value=The electric fields from the two particles, and the net field, are shown in the table at the bottom.
    editable=false
    foreground=128,192,0
    font=Dialog,BOLD,13