Solenoid

How many loops are necessary to create a solenoid with a uniform magnetic field?   Build a solenoid by adding current loops to the simulation. You can measure the magnetic field by click-dragging the mouse and observing the yellow message box. You can also superimpose field lines by double-clicking inside the animation. 


Script Example

<script language="JavaScript"> 


x=-2;  // position of first loop





// reset button


function reset(){


   document.BField.setDefault();


   document.BField.setShowFieldLineOnDoubleClick(true);


   document.BField.setShowFieldVectors(true); 


   x=-2;  


}





// add loop button


function add(){


   document.BField.setShowBOnDrag(true);


   document.BField.setShowFieldLineOnDoubleClick(true);


   c1=document.BField.addCoil(x,0,1);


   x=x+0.2;


   document.BField.setDrag(c1,true);


   document.BField.setOptionDrag(c1,true);


   document.BField.setRadius(c1,1);   


}


</script>