Está en la página 1de 3

HW#5

PY414

Due: Sept. 30, 2013

Consider a line of charge (x) extending along the xaxis from a to b. Write down the expression for the electric potential V (x, y, z ) at the eld point (x, y, z ) in terms of the charge per unit length (x). Dene all mathematical symbols explicitly. Include all necessary vector arrows and hats, and clearly distinguish between primed and unprimed variables. ~ (x, y, z ) at the eld point (x, y, z ) in Write down the expression for the electric eld E terms of the charge per unit length (x). Dene all mathematical symbols explicitly. Include all necessary vector arrows and hats, and clearly distinguish between primed and unprimed variables. In this homework assignment you will compute the electric potential and electric eld at the eld point (x, y, z ), where x, y , and z are the last 3 nonzero digits of your NCSU ID. Throughout this assigment we will use SI units, so that distances are in meters, charge is in Coulombs, etc. Let the line charge be given by (x) = (1 x2 ) with = 6.0 106 . The endpoints of the line charge are a = 1 and b = 1. Recall that 0 = 8.85 1012 in SI units. What are your values for x, y , and z ?

Write a computer program to nd the electric potential V at your eld point (x, y, z ). Your answer should be accurate to 2 or more signicant digits. (You might need to experiment with the number of subdivisions in your integration scheme.) The answer for the instructors eld point is V (1, 3, 1) = 2.15 104 . Attach a copy of your program. ~ at your eld point (x, y, z ). Your answers Write a program to nd the electric eld E should be accurate to 2 or more signicant digits. (You might need to experiment with the number of subdivisions in your integration scheme.) For the instructors eld ~ (1, 3, 1) = 1840 point, E x + 5830 y + 1940 z . Attach a copy of your program. Use your rst program to compute V at the eld points (x + , y, z ) and (x , y, z ), where is a small number. (How small? should be small compared to the other length scales in the problem. Since the line of charge and the components of the eld point are all of order unity, then = 0.001 might be a reasonable choice.) Now approximate the xcomponent of the electric eld by V (x + , y, z ) V (x , y, z ) 2 How does this result compare to your calculation of Ex in the previous bullet? Ex (x, y, z )

Note: For the computer programs you can use fortran, C, C++, java, python, etc. You are also free to use a higherlevel software package such as mathematica, maple, matlab, etc. You should not use any canned routines; you must write your own algorithm to carry out the numerical integrations. Note: As with all homework assignments, you are welcome to work on this project with your classmates. This can help make learning fun and ecient. However, the work that you turn in must be your own. It is not acceptable to clone (or to clone and then modify) someone elses work.

ecalc.py

9/30/13 5:23 PM

#!/usr/bin/env python import math # setting constants r = [3.0,2.0,1.0] a=-1.0 b=1.0 k=1/(8.85*math.pow(10.0,-12.0)*4*3.14159) #determining intervals n=100000 sum=0.0 step=(b-a)/n #now to calculate E Ex=0.0 Ey=0.0 Ez=0.0 for i in range(n): x=i*step+a denominator=math.pow((r[0]-x)**2+r[1]**2+r[2]**2,1.5) inside=k*6.0*math.pow(10,-6)*(1.0-x*x)/denominator block=inside*step Ex+=block*(r[0]-x) Ey+=block*(r[1]) Ez+=block*(r[2]) print(Ex,Ey,Ez)

Page 1 of 1

vcalc.py

9/30/13 5:23 PM

#!/usr/bin/env python import math # setting constants r = [3.0-.001,2.0,1.0] a=-1.0 b=1.0 k=1/(8.85*math.pow(10.0,-12.0)*4*3.14159) #determining intervals n=100000 sum=0.0 step=(b-a)/n #summing blocks for V for i in range(n): x=i*step+a denominator=math.pow((r[0]-x)**2+r[1]**2+r[2]**2,.5) inside=k*6.0*math.pow(10,-6)*(1.0-x*x)/denominator block=inside*step sum+=block print sum

Page 1 of 1

También podría gustarte