(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2"; MacintoshStandardFontEncoding; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times"; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times"; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times"; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times"; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times"; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times"; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 12, "Courier"; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R65535, L-5, 12, "Courier"; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier"; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier"; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = leftheader, inactive, L2, 12, "Times"; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times"; fontset = leftfooter, inactive, L2, 12, "Times"; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; paletteColors = 128; currentKernel; ] :[font = section; inactive; initialization; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981] Your Assignment: 1) Execute the entire notebook. Experiment if you like. 2) Generate a plot for the set of 3 charges described at the end. 3) Hand in the plot. ;[s] 2:0,0;16,1;162,-1; 2:1,19,14,Times,1,18,0,0,0;1,16,12,Times,1,14,0,0,0; :[font = subsubsection; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981] Suggestion: if you want to save this file on you disk, CUT the graphics first so it will fit. (Graphics take up over 1MB.) :[font = section; inactive; initialization; Cclosed; preserveAspect; startGroup] ********************************** Initialization Stuff: (Just execute this, don't read it!!!) ;[s] 2:0,0;56,1;95,-1; 2:1,19,14,Times,1,18,0,0,0;1,16,12,Times,1,14,0,0,0; :[font = input; initialization; preserveAspect] *) Needs["Graphics`PlotField`"]; Needs["Graphics`PlotField3D`"]; (* :[font = subsubsection; inactive; initialization; preserveAspect] Don't mind any Warning:... ind an messages here! ;[s] 3:0,0;16,1;29,0;51,-1; 2:2,13,9,Times,1,12,0,0,0;1,13,10,Courier,0,12,65535,0,0; :[font = input; initialization; preserveAspect] *) Clear["Global`*"]; Monopole[q_,v0_:{0,0,0},v_:{x,y,z}]:= q/(Sqrt[(v0-v).(v0-v)]) (* :[font = input; initialization; preserveAspect] *) go2d[distribution_]:= PlotGradientField[-distribution/.{z->0} //Evaluate ,{x,-2,2.01},{y,-2,2.01} ,Graphics`PlotField`ScaleFunction->(1&)]; (* :[font = input; initialization; preserveAspect] *) go3d[distribution_]:= PlotGradientField3D[-distribution //Evaluate ,{x,-2,2.01},{y,-2,2.01},{z,-2,2.01} ,PlotPoints->8 ,Graphics`PlotField3D`ScaleFunction->(1&) ,VectorHeads->True]; (* :[font = input; initialization; preserveAspect; endGroup] *) Protect[{go2d,go3d,Monopole}]; Off[Clear::wrsym]; (* :[font = section; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981] ********************************** Electric Fields Due to Point Charges: :[font = input; preserveAspect] Clear["Global`*"]; :[font = text; inactive; preserveAspect] The Monopole[q,{x,y,z}] function places a single charge q at position {x,y,z}. An example would be: Monopole[+1,{1,0,0}] Let's look at the field due to a single charge located at the origin, {x,y,z}={0,0,0}. The function go2d automatically plots the electric field vector in the {x,y} plane. (This automatically plots the region from {-2,2}.) ;[s] 5:0,0;105,1;127,0;229,1;233,0;352,-1; 2:3,13,9,Times,0,12,0,0,0;2,13,10,Courier,1,12,0,0,0; :[font = input; preserveAspect] go2d[ Monopole[+1,{0,0,0}] ]; :[font = text; inactive; preserveAspect] We can create a dipole from two Monopole functions: (Notice that the signs are opposite) ;[s] 3:0,0;32,1;40,0;89,-1; 2:2,13,9,Times,0,12,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = input; preserveAspect] dipole= Monopole[+1,{1,0,0}]+Monopole[-1,{-1,0,0}] :[font = text; inactive; preserveAspect] Now let's look at the E field. :[font = input; preserveAspect] go2d[ dipole ]; :[font = text; inactive; preserveAspect] In a similar fashion, go3d makes a plot of the E field in 3-dimensions. Try it! (3D plots will take some time.) ;[s] 5:0,0;22,2;26,0;80,1;111,0;112,-1; 3:3,13,9,Times,0,12,0,0,0;1,13,9,Times,3,12,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = input; preserveAspect] thisPlot= go3d[ dipole ]; :[font = text; inactive; preserveAspect] This may look neater from a different viewpoint. (Note how I defined thisPlot so I would not have to re-compute the above plot. This saves time.) (3D plots will take some time.) ;[s] 3:0,0;147,2;178,1;179,-1; 3:1,13,9,Times,0,12,0,0,0;1,13,9,Times,3,12,0,0,0;1,13,9,Times,1,12,0,0,0; :[font = input; preserveAspect] Show[thisPlot,ViewPoint->{0.000, 0.000, 4.000}]; :[font = text; inactive; preserveAspect] Now you get the idea. Instead of a dipole, let's try two charges of the same sign. :[font = input; preserveAspect] twoCharges= Monopole[+1,{1,0,0}]+Monopole[+1,{-1,0,0}] :[font = input; preserveAspect] go2d[ twoCharges ]; :[font = subsection; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981] Now that you are started, you can experiment with different charge configurations. Try three charges located at {1,0,0}, {-1,0,0}, {0,1,0}. Go and experiment. ^*)