Electricity
& Magnetism
Mathematica Documentation
Mathematica Source Code
Page 2
A small magnet may be treated as a single magnetic dipole, of dipole moment M. If the dipole points in the +z direction, its magnetic field will be given by (r is the coordinate perpendicular to the z-axis) Bz = (uo/4pi)M(-r^2+2z^2)/(r^2+z^2)^(5/2) (parallel to the magnetic dipole direction) Br = (uo/4pi)M(3 r z)/(r^2+z^2)^(5/2) (perpendicular to the magnetic dipole direction) Many outboard motors and lawnmowers use rotating magnets passing by coils to create a high voltage for a spark. Instead of having a magnet pass by a coil, we will have a coil pass by a magnet, in order to illustrate the generation of emf. Let the magnet be located at the origin of coordinates, and pointing in the +z direction. We will have the coil traveling with velocity V in the r direction (perpendicular to the z-axis) so that it passes within a distance b of the magnet. The plane of the coil is perpendicular to the z-axis. The coil area A is so small that we may take the magnetic flux through the coil to be the scalar product of the coil area A and the magnetic field. The coil is supposed to be at z=b and y=0 at t=0, so the coordinates of the coil are (z=b, r = Vt). a) Calculate the magnetic flux through the coil as a function of time t. b) Calculate the induced emf through the coil (assuming N turns in the coil) c) Assume M = 2500 A-m^2, V = 120 m/s, and N=2000, b = 5 mm, and a loop area of 0.001 m^2, and plot the induced emf in the coil as a function of t; also plot the magnetic flux in the coil as a function of t.
Solution
Enter in equations for the magnetic dipole
field.
Bz = mu0/(4*Pi)*M*(2*z^2 - r^2)/(r^2 + z^2)^(5/2)
Br = mu0/(4*Pi)*M*(3*r*z)/(r^2 + z^2)^(5/2)
Substitute in values for the constants so
that a field plot can be done.
Br1 = Br/.{mu0 -> 1, M -> 1}
Bz1 = Bz/.{mu0 -> 1, M -> 1}
Load the necessary packages for a field plot.
NOTE: A couple of warnings may appear; ignore them. Needs["Graphics`PlotField`"]
Needs["Calculus`VectorAnalysis`"]
Generate a field plot of Br1 and Bz1.
PlotVectorField[{Br1, Bz1},{r,-3,3},{z,-2,2},
Axes -> True, VectorHeads -> True, PlotPoints -> 30, Graphics`PlotField`ScaleFunction->
(1&), PlotLabel -> "Vector field through a magnetic dipole"]
Determine the magnetic flux.
Flux = A*Bz
Part A
Fluxt = Flux/.{z -> b, r -> v*t}
Part B
Emf = -N*D[Fluxt,t]//Simplify
Part C
Substitute values into the Fluxt and Emf equations.
Fluxtsub = Fluxt/.{M -> 2500, v -> 120,
N -> 2000, mu0 -> 4*Pi*10^(-7), A -> 10^(-3), b -> 5/1000}
Emfsub = Emf/.{M -> 2500, v -> 120, N -> 2000, mu0 -> 4*Pi*10^(-7),
A -> 10^(-3), b -> 5/1000}
Plot the flux and induced emf.
Plot[Fluxtsub, {t,-.0002,.0002},PlotLabel
-> "Flux vs. time"]
Plot[Emfsub,{t,-.0002,.0002}, PlotLabel -> "Emf vs. time"]
We have a signal of interest at 2000 hz, whose amplitude is 100 mV, and an equal, unwanted signal at 60 hz (amplitude 100 mV). You are to build a RC filter to get rid of as much 60 hz as possible, and still leave at least 25 mV of usable signal at 2000 Hz. (The input voltage is applied as the capacitor C and the output voltage is taken at the point where the reisitor R and capacitor C join together). One side of the resistor is connected to the capacitor and the other side is grounded. Consider R values in the range 100 ohms to 5000 ohms, and capacitance values from 0.01 microfarads to 0.5 microfarads. a) Use dsolve to obtain the amplitude A(60) of the 60hz signal at the output of your filter for an arbitrary R and C value. b) Use dsolve to obtain the amplitude A(2000) of the 2000 hz signal at the output of your filter for an arbitrary R and C. c) In the formulas of parts a) and b), do R and C occur separately, or do they occur together? Will separate values of R and C be important, or will a combined value do? d) Make a 3D plot of A(2000) vs R and C in the range given above. e) Make a 3D plot of A(60) vs R and C in the range given above. f) Determine what R and C are needed to give at least a 25 mV signal, with as little noise as possible.
Solution
Parts A and B Current through the capacitor
i = C*D[Vc[t],t]
Voltage across resistor at output
eq1 = Vout[t] == i*R
Write Vc[t] in terms of Vin[t] and Vout[t]
eq2 = eq1/.{D[Vc[t],t] -> D[(Vin[t] - Vout[t]),t]}
Substitute the input voltages given in the
problem for Vin[t]
DE60 = eq2/.{D[Vin[t],t] -> D[1/10*Cos[60*2*Pi*t],t]}
DE2000 = eq2/.{D[Vin[t],t] -> D[1/10*Cos[2000*2*Pi*t], t]}
Solve the differential equations for Vout[t]
using initial conditions.
sol60 = DSolve[{DE60, Vout[0] == 0}, Vout[t],
t]//Flatten
sol2000 = DSolve[{DE2000, Vout[0] == 0}, Vout[t], t]//Flatten
The exponential terms drop out as time goes
to infinity. Substitute in 0 for the exponential terms to get the steady
state response.
sub60 = sol60[[1,2]]/.{Exp[-t/(R*C)] ->
0}//ExpandAll
sub2000 = sol2000[[1,2]]/.{Exp[-t/(R*C)] -> 0}//ExpandAll
Find the amplitude of the two expressions
by taking the square root of the sum of the squares of teh coefficients
of the cosine and sine terms.
A60 = Sqrt[(sub60[[1,{1,2,3,4,5}]])^2 + (sub60[[2,{1,2,3,4,5}]])^2]//Simplify
A2000 = Sqrt[(sub2000[[1,{1,2,3,4,5}]])^2 + (sub2000[[2,{1,2,3,4,5}]])^2]//Simplify
Part D
Plot3D[A2000//N, {C,.01*10^(-6),.5*10^(-6)},
{R,100,5000}, PlotLabel -> "A2000", PlotRange -> {.0,.1},
AxesLabel -> {"C", "R", ""}, ViewPoint->{-2.516,-3.013,1.033}]
Part E
Plot3D[A60//N, {C,.01*10^(-6),.5*10^(-6)},
{R,100,5000}, PlotLabel -> "A60", PlotRange -> {.0,.1},
AxesLabel -> {"C", "R", ""}, ViewPoint->{-2.516,-3.013,1.033}]
Part F
Plot the Signal to nosie ratio.
Plot3D[A2000/A60//N, {C,.01*10^(-6),.5*10^(-6)},
{R,100,5000}, PlotLabel -> "A2000/A60", PlotRange -> {0,35},
AxesLabel -> {"C", "R", ""}, Ticks ->
{{.01*10^(-6),.5*10^(-6)}, {100,3000}, Automatic}, ViewPoint->{-2.516,3.013,1.033}]
From the 3D plot we can see that the Signal
to Noise ratio is smallest when R and C are smallest. This is also where
the output signals of A60 and A2000 are the smallest. We want an output
signal as small as allowed (25mV) so the output signal will have the least
possible noise. The relationship between R and C at 25 mV is:
Capacitor = Solve[A2000 == 25*10^(-3), C]//N
NOTE: The only solution that is possible is the positive solution.
A rapidly moving particle of mass M and charge
Q travels with constant velocity Vin the x-direction. It passes by a stationary
particle of mass M' and charge Q'. The mass M' will be taken as fixed in
position and not free to move. The closest distance of approach between
the two particles is b.
a) Work out symbolically the net impulse in the y-direction delivered to
Q' from Q as it goes by.
For parts b) and c) let M = M' = 1.6 x 10-27 kg, Kinetic energy = 4.1 MeV
= 4.1 x 1.6 x10^-13 j, Q = Q' = 1.6x 10^-19C, Kelec = 8.99 x 10^9 N-m^2/C^2.
b) Sum up 100 impulses along the path, from -10 b to +10b.
c) Compare the answers from parts a) and b), and determine the percentage
difference. Which one do you think should give the larger answer?
Solution
Part A
Clear["Global`*"]
Distance from Q to Q'
r = Sqrt[b^2 + x^2]
Force between Q and Q'
F = (1/(4*Pi*Eo))*Q*Q2/r^2
Force in the y direction
Fy = F*b/r
Force in the y direction as a function of
time:
Fyt = Fy/.x -> v*t
Find the net impulse from -infinity to infinity. impulse = Integrate[Fyt, {t,-Infinity,Infinity}]
Part B
Define constants to solve a specific case.
Eo := 8.854*10^(-12)
Distance of closest approach
b := 1.2*10^(-9)
Charges of particles
Q := 16*10^(-20)
Q2 := 16*10^(-20)
Mass of particle
M := 1.6*10^(-27)
Kinetic Energy of Q
KE = 4.1*1.6*10^(-13) == 1/2*M*Vq^2
Solve for the velocity of Q
sol = Solve[KE, Vq]
Pick the positive solution for velocity.
v = sol[[2,1,2]]
Add together 100 y-direction impulses from
x = -10b to x = +10b
Find delta t.
deltat = (20*b/99)/v
ImpSum := 0
impsum = Sum[ImpSum + Fy*deltat, {x,-10*b,10*b, 20*b/99}]//N
Part C
Solution from integrating along the path.
impulse//N
Find the percent difference between the integral
and summing solutions.
PercentDiff = (impulse - impsum)/impulse*100//N
(a) Create a three dimensional contour plot of
the electric potential due to three point charges each with magnitude 2.00
µC located at positions (-0.50 m, 0), (+0.50 m, 0), and (0,+0.75
m). The first two charges are positive, the third is negative.
(b) Visually locate any points where a fourth positive test charge would
be in equilibrium. State whether the equilibrium is stable or unstable.
(c) Find the magnitude of the electric field at (0, 0.50 m). Going Further
(optional):
(d) Calculate the electric field by taking the negative gradient of the
potential function.
(e) Make a field plot of unit vectors created from E/|E|.
(f) Make a new vector field by multiplying the unit vector E/|E| by tanh(k*|E|),
where k is an adjustable scale constant. Do a 'fieldplot' of this new vector
field, with k= 10^5. [You may wish to try some other k values as well.].
Solution
Part A
Charge of the particles
q = 2*10^(-6)
Potential due to 1st charge only
pot1 = q/Sqrt[(x + 1/2)^2 + y^2]//ExpandAll
Potential due to 2nd charge only.
pot2 = q/Sqrt[(x - 1/2)^2 + y^2]//ExpandAll
Potential due to 3rd charge only.
pot3 = -q/Sqrt[x^2 + (y-3/4)^2]//ExpandAll
Total potential
pottot = pot1 + pot2 + pot3
Plot3D[pottot, {x,-1,1},{y,-1,1.5},PlotRange -> {-.00002,.00002}, PlotPoints -> 40, PlotLabel -> "3D contour plot of the electric potential", ViewPoint->{1.986,1.936,1.939}]
Part C
Find the potential at (0,0.5).
potential = pottot/.{x -> 0, y -> 1/2}//N
Part D
Find the electric field by taking the negative gradient of the potential
function.
gvect = -1*{D[pottot,x], D[pottot,y]}
Display the x and y components of gvect.
gvectx = gvect[[1]]
gvecty = gvect[[2]]
Part E
Magnitude of the field
mag = Sqrt[gvectx^2+gvecty^2]//Simplify
Change the electric field vector to a unit
vector. Supress the output.
gunit = gvect/mag;
Plot gunit. But first load the necessary packages; a couple of warnings may appear, ignore them. Needs["Graphics`PlotField`"] Needs["Calculus`VectorAnalysis`"] Needs["Algebra`Trigonometry`"]
PlotVectorField[gunit, {x,-2,2},{y,-1,1.5}, Axes -> True, VectorHeads -> True, PlotPoints -> 30, Grpahics`PlotField`ScaleFunction -> (1&), DisplayFunction -> $DisplayFunction, PlotLabel -> "Unit vector plot of E field"]
Part F
Scaling for the tanh command. A larger value will make the output more
unit vector like.
scalar = 10^5
Scale the x and y components of the gradient vector. gtanh = gvect/mag*Tanh[scalar*mag]; PlotVectorField[gtanh, {x,-2,2},{y,-1,1.5}, Axes -> True, VectorHeads -> True, PlotPoints -> 30, Grpahics`PlotField`ScaleFunction -> (1&), DisplayFunction -> $DisplayFunction, PlotLabel -> "Scaled electric field vectors"]
An electrostatic stack precipitator has a radial
electric field along its length, provided by a central wire of radius 0.0200
m, charged with a large negative voltage. The outer radius of the stack
is a cylindrical grounded conductor of radius 1.20 m. The electric field
at the surface of the central wire is 1.2 x 10^6 V/m, pointing radially
inward.
a) Determine the total potential difference applied between the central
wire and the grounded outer radius.
b) A particle entering at the bottom of the stack has a mass of 1.4 x 10-15
kg, and picks up a charge of -3.44 x 10-14 C at the central wire. The stack
gas velocity is such that the particle will take 5.3 s to travel up the
stack. Determine if this particle will be collected at the outer radius
of the stack before leaving the stack.
i) Assume the particle does not interact with any other particles.
ii) Assume a spherical particlethe radial motion is impeded by a viscous
force given by F(viscous) = -6 pi eta r v, where eta is the kinematic viscosity
(2.1 x 10^-5 N-s/m^2), r is the particle's radius and v is the particle's
radial velocity. [Obtain the particle's radius by assuming a density of
500 kg/m^3. ]
Solution
Part A: Potential Difference Enter in the
given radii.
innerradius = .02
outerradius = 1.2
For an infinite line of charge E is:
Eline = lambda/(2*Pi*Eo*x[t])
We know that when r = .02 m, E = 1.2*10^6
V/m. Substitue this into the above equation.
Elinesub = 1.2*10^6 == Eline/.{x[t] ->
innerradius}
Now solve for lambda.
sol = Solve[Elinesub, lambda]//Flatten
The electric field of the stack for .02<r<1.2
is: NOTE: make the answer negative because E is pointing in the -r direction.
Estack = -Eline/.sol//N
Integrate to find the potential between the
central wire and the grounded outer radius.
Vstack = -Integrate[Estack, {x[t], innerradius,outerradius}]
Part B: Collection of particle There are two forces acting on the particle: the force due to the electric field, and the viscous force. The force due to the electric field can be calculated by using the relationship E = F/q, where both q and E are given. Now solve for the force, after telling Mathematica the value of q, the charge of the particle.
q := -3.44*10^(-14)
Felec = Solve[Estack == F/q, F]//Flatten
Assign the solution.
Felec = Felec[[1,2]]
The viscous force is given, but r (the particle's
radius) must be calculated. To do this, the particle's volume needs to
be calculated from the given mass and density.
particlevolume = 1.4*10^(-15)*(1/500)
Using the relationship 4/3*Pi*r^3 = V gives:
particleradius = Solve[(4/3)*Pi*r^3 == particlevolume,r]
Assign the positive solution.
r = 8.74359*10^(-7)
Thus, the viscous force is:
Fvis = -6*Pi*(2.1)*10^(-5)*r*v//N
Using Newton's second law gives the following:
newton = Felec + Fvis == m*a
where a is the acceleration of the particle.
Substitute in the mass of the particle.
newton = newton/.m -> (1.4)*10^(-15)
Now convert this equation into a differential
equation.
newton = newton/.{v -> x'[t], a -> x''[t]}
Now solve the differential equation. NOTE:
DSolve does not work on this equation. Thus, NDSolve must be used; the
result is that the solution to the differential equation can only be graphed,
no evalutaion of the output is allowed. However, other items can be plotted
on the same graph. But before the solution is graphed, turn off two of
Mathematica's warning functions.
Off[CompiledFunction::ccr]
Off[CompiledFunction::cfex]
NDSolve[{newton, x[0] == innerradius, x'[0] == 0},x[t], {t,0,5.3}, MaxSteps
-> 1000] Plot[{Evaluate[ x[t] /. %], (outerradius - innerradius)}, {t,0,1},
PlotRange -> {0, (outerradius - innerradius)}, AxesLabel -> {"Time
(s)","Distance (m)"}]
As shown in the graph, the particle is collected at the outer radius in approximately .3 seconds.
A security system has a coil of wire in the shape
of a rectangle 1.0 m by 2.0 m. It consists of 500 turns and carries a current
of 1 ampere. It may trigger and alarm if the inductance changes when metallic
objects change the flux within the loop.
a) Use a 3DPlot to plot the magnetic field in an rectangular region 'interior'
to the security coil, 0.8 m by 1.8 m, centered on the larger coil. [This
smaller coil has each side parallel to a side of the larger coil and 0.1
m from it.]
b) If we bring a small loop of wire into the 'interior' rectangle, it will
change the inductance of the larger loop and may trigger an alarm. What
points in the 'interior rectangle' are most sensitive (the greatest flux
for a given area of the small loop) and which are least sensitive? [center
should be least sensitive, edges most sensitive]
Solution
Part A
The magnetic field at a point near a straight wire of any length is: B
= Uo*i/(4*Pi*y)*[Cos(theta) + Cos(phi)] where theta and phi are the angles
made by the wire and lines connecting the wire ends to the point and y
is the perpendicular distance from the wire to the point.
By breaking up the rectangle into 4 straight wire segments, the magnetic
field inside the loop can be calculated.
The magnetic field due to the top wire segment
is:
Btop = (Uo*i/(4*Pi*(2-y)))*(x/(Sqrt[x^2 +
(2-y)^2]) + (1-x)/(Sqrt[(2-y)^2 + (1-x)^2]))
The magnetic field due to the right wire segment
is:
Bright = (Uo*i/(4*Pi*(1-x)))*((2-y)/Sqrt[(2-y)^2
+ (1-x)^2] + y/Sqrt[y^2 + (1-x)^2])
The magnetic field due to the bottom wire
segment is:
Bbottom = (Uo*i/(4*Pi*y))*((1-x)/Sqrt[y^2
+ (1-x)^2] + x/Sqrt[x^2 + y^2])
The magnetic field due to the left wire segment
is:
Bleft = (Uo*i/(4*Pi*x))*(y/Sqrt[x^2 + y^2]
+ (2-y)/ Sqrt[(2-y)^2 + x^2])
The B field due to the rectangle is:
Btot = Btop + Bright + Bbottom + Bleft
Define the constants so that a 3D plot can
be produced.
Uo := 4*Pi*10^(-7)
i := 1*500
Plot the inner region. NOTE: The units on
the B field have been changed from Telsa to Gauss.
Plot3D[Btot*10^4, {x,.1,.9}, {y,.1,1.9}, PlotPoints
-> 30, PlotRange -> {0,20}, PlotLabel -> "B field of interior
security coil", AxesLabel -> {"X","Y",""}]
Part B
The points on the edge of the recangle are the most sensitive.
A charged rod with a uniform charge density of 2.0 x 10^(-7) C/m extends
from -1m to +1m along x-axis.
a) What will the electric potential look like at a distance of 1000 m from
the rod? [like that from a point charge; kq/r = 2700/1000 = 2.7 v]
b) Integrate along the rod to obtain the potential at any point (x,y).
c) Evaluate the potential at x=0, y=1000 and compare to your prediction
from part a).
d) Evaluate the potential at x=1000, y=2 and compare to part a).
e) From Ey = -dV/dy, obtain a function for Ey at any point (x,y)
f) How should Ey behave very close (0.001 m) to the center of the rod?
[Rod looks infinite; Ey = 2 k lambda / r]
g) Evaluate Ey at x=0 and y=1/1000 m. Compare to behavior expected in part
f)
Clear["Global`*"]
k = 9*10^9;
lambda = 1.5*10^(-7);
dv = Round[(k*lambda)]/Sqrt[(x-x1)^2+y^2]
v = Integrate[dv, {x1,-1,1}];
v/.{x -> 0, y -> 1000}//N
[Should get 3*900/1000, roughly, or 2.7; acts like point charge,
kq/r, same at 10,000]
v/.{x -> 1000, y -> 2}//N
doesn't seem to like y = 0; will put up with y = 2.
Ey = -D[v,y];
Ey/.{x -> 0, y -> 1/1000}//N
(2*k*lambda*1000)//N
The two expressions for electric field are extremely close, as we expect them to be.
A uniformly charged rod, length L and total charge Q.
a) Find the integral which gives the value of the electric potential at
an arbitrary point, a distance h beyond the end of the rod, and a distance
y perpendicular to the length of the rod. [Assume that the electric potential
at infiinity is zero, as usual.]
b) Make a contour plot of the bar for L= 5.0m, Q = 10 microcoulombs. Use
the option contours = [40000,60000,80000,100000,120000] to generate five
contours of electric potential.
Solution
Part A
For a continuous charge distribution, the potential at a given point is:
V = 1/(4*Pi*Eo)*Integral[1/r, dQ]
In this problem, the charge density lambda is Q/x, where x is the
current length of the rod.
cd = lambda == Q/x
As a rate of change, the above quantity can be expressed as:
cd2 = lambda == dQ/dx
Solving for dQ gives:
cd3 = Solve[cd2,dQ]//Flatten
Substituting dQ into V gives:
V2 = V/.cd3
r now needs to be expressed in terms of x.
The x-component of r is:
Rx = h + (L-x)
The y-component of r is:
Ry = y
Thus, by use of the Pythagorean theorm, r is:
r = Sqrt[Rx^2 + Ry^2]
The potential integral is now:
V2
Pulling out the lambda gives:
V3 = lambda*Integral[((h + L - x)^2 + y^2)^(-1/2),
dx]/ (4*Eo*Pi)
Integrating from 0 to L will give the electric potential at the
designated point.
V4 = lambda*Integrate[((h + L - x)^2 + y^2)^(-1/2),
{x,0,L}]/ (4*Eo*Pi)
Vsub = V4/.{lambda -> 10*10^(-6)/5, Eo -> 8.854*10^(-12) , L -> 5}
Part B
ContourPlot[Vsub//N, {h,-10,5}, {y,-5,5}, PlotPoints
-> 60, PlotRange -> {0,120000}, Contours -> {40000,60000, 80000,100000,120000}]
Potential and field plots of three point charges
Learning objectives: Translation of standard 1/r potential to off-origin
points Physical intuition regarding potential
Identify equilibrium points
Relate potential plot and electric field vectors
arbitrary units are used throughout in Coulomb's law
Set plot range;
use non-even values to avoid singular points in grids
Clear["Global`*"]
Off[General::spell1]
Define relative magnitude of three charges.
Q1 = 1;
Q2 = 1;
Q3 = -1;
Set plot range; use non - even values to avoid singular plots in
grids
X & Y plot domains
xmax:=0.755;
ymax:=0.755;
Potential due to the seperate charges & the combined potential
coul1:= Q1/((x-0.5)^2+y^2)^0.5;
coul2:=Q2/((x+.5)^2+y^2)^0.5;
coul3:=Q3/((x)^2+(y-.7)^2)^0.5;
coul123:=coul1+coul2+coul3;
3D contour plot of potential function
ContourPlot[coul123,{x,-xmax,xmax},{y,-ymax/2,2*ymax},
Contours -> 20, ContourSmoothing -> 100]
Get electric field from negative gradient of potential (must first
load the VectorAnalysis package)
Needs["Calculus`VectorAnalysis`"]
SetCoordinates[Cartesian[x,y,z]];
vect = Grad[-coul123]
Create new vector field of unit vectors E/|E|
vect2 = vect/Sqrt[(vect[[1]])^2+(vect[[2]])^2+ (vect[[3]])^2];
Plot the (2D) vector field (after loading the necessary packages)
Needs["Graphics`PlotField`"]
Needs["Calculus`VectorAnalysis`"]
PlotVectorField[{vect2[[1]],vect2[[2]]},{x,-xmax,xmax},{y, -ymax,ymax+1/2},
Axes -> True, VectorHeads -> True, PlotPoints -> 20, PlotLabel
-> "Unit vectors showing direction of E field"]
Compress dynamic range of E-vector lengths by taking ln(1 + |E|)
log is taken twice to put all lengths within range of fieldplot command
vect3 = vect2*Log[Log[Sqrt[vect[[1]]^2+vect[[2]]^2]+1]+1]
PlotVectorField[{vect3[[1]],vect3[[2]]},{x,-xmax,xmax},{y, -ymax,ymax+1/2}, Axes -> True, VectorHeads -> True, PlotPoints -> 20, PlotLabel -> "Electric field vectors"]
There is a famous theorem (Earnshaw's theorem) which says in effect
that you can't trap a charged particle with a cage made out of only other
stationary charges. But it looks like you should be able to build a cage
with charges on the 8 corners of a cube, and trap a charge at the center.
The starting material here is the potential on the x-axis due to a charge
at (a,b,c) k:=9e9: q:=1e-7: v:=k*q/sqrt(x-a)^2+b^2+c^2):
a) From this, create a function for electric potential due to 4 charges
at x=+1m, and y= +/- 1m, z= +/- 1m
b) Plot this function from x=0 to x=2 to show that the positive voltage
peaks around x=1, indicating the particle should not be able to escape
that way.
c) Now, put the other half of the cube together, 4 charges all at x=-1m,
and again at y=+/-1m, and z= +/-1 m. Then plot the total electric potential
from x=-2 to x=+2.
All we need is a minimum in the middle in order to trap the particle at
the center. How did we do at defeating Earnshaw's theorem?
Clear["Global`*"]
v from unit parrticle at (a,b,c) at point (x,0,0)
k = 9*10^(9);
q = 1*10^(-7);
v = k*q/(Sqrt[(x-a)^2 + b^2 + c^2])
Create a 'wall' of four charges
c1 = v/.{b -> 1, c -> 1};
c2 = v/.{b -> -1, c -> 1};
c3 = v/.{b -> -1, c -> -1};
c4 = v/.{b -> 1, c -> 1};
four = c1+c2+c3+c4
Plot[four/.a->1, {x,0,2}, PlotLabel -> "Potential due to a wall of 4 charges"]
Looks promising. A barrier is present at the wall. Now to add the
other wall and seal it up.
e1 = four/.a->1;
e2 = four/.a->-1;
e = e1+e2;
Plot[e,{x,-2,2}]
Oops, adding the other wall did away with the minimum we wanted in the center.
k:=9*10^9;
q:=1*10^(-7);
v:=k*q*Heaviside((a-x)^2-1e-6)/((a-x)^2 + b^2 )^(1/2);
(Heaviside function must be defined)
V due to charge q at (a,b) in xy plane at point (x,0) on the x-axis. The Heaviside (step) function makes the potential vanish very close (0.001 m) to the charge, where it would otherwise start to blow up.
Problem statement. Use the 'function' v in the sample program to create
a 'wall' of total charge =100 nC along the x-axis to prevent a proton (q=
+ 1.6e-19C, m=1.67e-27 kg) from penetrating anywhere along a line from
x=0 to x=1 m. The proton is confined to the xz plane, and when far away
from the origin it is traveling at 6.9x10^5 m/s. Try a single charge at
x=1/2 m and see if that fills the bill, then try two charges of 50 nC each
at x=1/4, x=3/4 m.
a) If the proton is to be persuaded not to pass anywhere between x=0 and
x=1, what must the minimum value be of the electric potential V between
x=0 and x=1? [ Hint: the proton PE = qV. You can find the initial KE of
the proton.]
b) Predict qualititatively whether the single or pair of charges should
do better, or if it will be a tie. {Cutting q in half gives same v at half
the distance, so this would suggest a tie, but it ignores the other charge
contributing to the potential. We will do better with 2 charges than one
[higher minimum potential]}
c) Do a plot v vs x for a single 'barrier' charge of 100 nC at x=1/2 m.
Write down the minimum value of v anywhere between x=0 and x=1.
d) Repeat with two 50 nC charges at 1/4 and 3/4 m to see if minimum v is
improved. Report the results. [Can leave it to students to think about
actually meeting the spec by moving the 2 charges.]
Clear["Global`*"]
Find out what proton velocity is needed for a 2500 V barrier.
vel = Sqrt[2500*1.6*10^(-19)/(1.67*10^(-27))]
Define the Heaviside function
Heaviside[x_] := If[x>0,1,0]
k = 9*10^9;
q = 1*10^(-7);
v = k*q*Heaviside[(a-x)^2-1*10^(-6)]/ ((a-x)^2 + b^2)^(1/2)
V due to unit particle at (a,b) in xy plane at point (x,0) on the
x-axis. The Heaviside (step) function makes the potential vanish very close
to the charge, where it would otherwise blow up.
e1 = v/.{a -> 1/2, b -> 0}
This is a single charge of 100 nC in the center of the 0..1 interval.
[Change : to ; in order to see output from this command.] Ditto for next
one.
e21 = v/.{a -> 1/4, b -> 0};
e22 = v/.{a -> 3/4, b -> 0};
e2 = (e21+e22)/2
This is the same total charge but 2 charges located at 1/4, 3/4
Plot[{e1,e2},{x,10^(-15),1}]
We see that the two charges produce a higher minimum voltage over the range than one did for the same total charge; this is a higher minimum barrier to the incoming charge. Stopping y values at 4000v gives good look at actual v values.
Still doesn't get to 2500 V. But moving q's farther apart will lower middle and raise the outside to do the trick. Moving the charges around shows that locating them at 1/5, 4/5 gives a higher minimum over 0..1 than at 1/4, 3/4