Physics 230 - Exam 1 - Winter 2014

The Rules:

• This exam covers material from Labs 1 - 5. It is due at midnight of Tues, Feb 17 for the Friday section (this is a day longer than indicated in the syllabus), or midnight of Friday Feb 20 for the Monday section.

• The exam is completely open notes/books. You may use your old labs, Mathematica's help files, internet websites, etc.

• You may not consult with any person about the exam. That includes classmates, TAs, friends, relatives, other professors, Facebook, internet message boards or chat rooms, etc. If anything on the exam is unclear, please ask me directly.

• Do not speak to any of your fellow students about the exam until after the SECOND due date (i.e. midnight Feb 20).

• There is no partial credit, except in extraordinary circumstances. All problems are pass/fail, 1 pt each. Be sure to read each problem very carefully so that you are doing what is requested, and that you are doing EVERYTHING that is requested.

• The problems are listed roughly in order of difficulty--but only roughly, because what's hard for one student might not be hard for another.

• Enter your solutions directly in this notebook after each problem. Rename the notebook to be “exam1 - [your name].nb”, and email it to me when completed. My email address is john_colton@byu.edu.

• To grade your exam I will:
(1) quit the kernel (so the previous student’s exam won’t affect you).
(1) select Delete All Output under the Cell menu,
(2) select Evaluate Notebook under the Evaluation menu, 
(3) and then grade the output. 
Therefore, all solutions must be generated by Mathematica commands in your notebook. I will not Clear variables or Quit/Start the kernel between your problems. Choose your variable names carefully so that there are no conflicts, and be very careful if you use “%”.

Sincerely,

Dr Colton

Problem 1

Find the numerical value of (Sqrt[((1/(1 + (e^4))))+((2/(3-ln(4))))]) , to 10 decimal places.

Sqrt[1/(1+E^4) + 2/(3 - Log[4])]
N[%,10]
(* took me 0:30 *)

Problem 2

Create a list of what the function f(x) = (x^5) cos(x) is equal to, for x = 1, 2, 3, 4 and 5  (in numerical form)

f[x_] = x^5 Cos[x]
f /@ {1,2,3,4,5} //N
(* took me 30 seconds*)

f[Range[5]] //N
(* alternate *)

Problem 3

Put this algebraic expression in simplest form:  (1/(3(1+x))) - ((-1 + 2x)/(6(1-x+(x^2)))) + (2/(3(1 + (1/3)(((-1 + 2x))^2)))).  (Don’t worry about x possibly equalling something that causes the denominators to be zero.)

Simplify[1/(3 (1+x)) - (-1 + 2 x)/(6 (1 - x + x^2)) + 2/(3 (1 + 1/3 (-1 + 2x)^2))]
(* took 35 seconds *)

Problem 4

With each step George goes 1/3 the distance from himself to a wall (one “unit” away). With his first step he goes 1/3 units, with his second step he goes 1/3 of the remaining 2/3 units = 2/9 units, with his third step he goes 1/3 of (1 – 1/3 – 2/9) units = 4/27 units, etc. The pattern is such that the next few steps are 8/81 units, 16/243 units, 2^5/3^6 units, 2^6/3^7 units, etc. After an infinite number of steps, how far has he gone? (And does he reach the wall?)

Table[2^(n-1)/3^n,{n,1,10}]  (* just to make sure I got the pattern right *)
Sum[ 2^(n-1)/3^n,{n,1,Infinity}]
(* yes, he reaches the wall! *)

(* took me 0:45 *)

Problem 5

Find what x equals, at the intersection of y = cos(x) and y = x^5.  Then calculate the sine of that value. As a reminder, your code must automatically generate the final answer, so you cannot use any copying & pasting or typing in of the answer to the first part. Instead, use a “slash dot” command to gain access to the value obtained by the first part.

Plot[{Cos[x],{x^5}},{x,-2,2}]
FindRoot[Cos[x]==x^5,{x,1}]
x0 = x /. % 
Sin[x0]
(* took me 1:10 *)

Problem 6

Suppose you have a sphere of charge of radius R, whose charge density (charge per volume)  ρ varies with distance from the center according to this formula: ρ = C (r/R)  (Subscript[(e^(-r/R)) ,  ]).  (C is a constant that has units of coulombs/(m^3) and r is the distance from the center of the sphere.) In other words, the charge is less concentrated at the center of the sphere than it is towards the edge. How much total charge is inside the sphere? To find this you must compute the integral ∫∫∫   ρ   dx dy dz, with dx dy dz converted into spherical coordinates as done in one of the assignments in the Integration lab. Be sure to use the proper limits of integration as also explained in that assignment.

Plot[r Exp[-r],{r,0,1}] (* not needed *)
Integrate[C r/R Exp[-r/R]  r^2 Sin[theta],{r,0,R},{phi,0,2 Pi},{theta,0,Pi}]

(*alternate method, using shells*)
Integrate[C r/R Exp[-r/R]  4 Pi r^2,{r,0,R}](* took me 1:15*)

Problem 7

Plot the field lines (StreamPlot) and equipotential contours (ContourPlot) for the following set of charges which mimic a parallel plate capacitor:  eleven positive charges at locations (-5, 2), (-4, 2), ..., (+5, 2);  and eleven negative charges at locations (-5, -2), (-4, -2), ..., (+5, -2). Use the same technique as used in the differentiation lab. All charges have magnitude 1, and as done in that lab, set all multiplicative constants equal to 1. Make your plots with x and y both going from -10 to 10, and superimpose the two plots. The two sets of lines should be perpendicular to each other, and your results should look somewhat like what you learned about the field & equipotential lines of a capacitor in Physics 220. Hint: I advise you to add up the charges in some clever way rather than manually typing out the combined electric potential from all 22 charges.

Vbase = 1/Sqrt[x^2+y^2];
V = Sum[Vbase /. {x-> (x-n), y-> (y-2)}, {n,-5,5}] - Sum[Vbase /. {x-> (x-n), y-> (y+2)}, {n,-5,5}] ;
Ex=-D[V,x];
Ey=-D[V,y];
p1=StreamPlot[{Ex,Ey},{x,-10,10},{y,-10,10}];
p2=ContourPlot[V,{x,-10,10},{y,-10,10},ContourShading->None];
Show[p1,p2]
(* took me 3:10 *)

Problem 8

Create a graphics object of a large smiley face using these elements all combined together: a circle of radius 5 centered at the origin (the head), two circles of radius 0.75 centered at (-2,1) and (2,1) (the eyes), a circle of radius 0.3 centered at the origin (the nose), and an elliptical arc taken from an ellipse centered at (0,-1) with semimajor and semiminor axes of 3 and 2, respectively (the smile). Hint: the elliptical arc can be done with the Circle command; read about it and play around with the options for the angles (Subscript[θ, 1]) and (Subscript[θ, 2]) until it looks like a smile.

face = Circle[{0,0},5]
eye1 = Circle[{-2,1},.75]
eye2=Circle[{2,1},.75]
nose=Circle[{0,0},.3]
smile = Circle[{0,-1},{3,2},{210 Degree, 330 Degree}]
Graphics[{face,eye1,eye2,nose,smile}]
(* took me 3:45 seconds*)

Problem 9

The integration lab discussed orthogonal functions, which are functions whose product integrates to zero over a particular range. One example was sine functions: sin(nx) and sin(mx) are orthogonal over the range from 0 to 2π  when n≠m.  Another example, given in the extra credit problem, was the Legendre polynomials: (Subscript[L, n])(x) and (Subscript[L, m])(x) are orthogonal over the range from -1 to 1 when n≠m.

Another class of orthogonal functions are the “Hermite polynomials”, (Subscript[H, n])(x), given in Mathematica by the function HermiteH[n,x]. They are a set of polynomials which arise in quantum mechanics when solving for the wave functions of a spring-like potential (commonly called the “quantum harmonic oscillator” problem). The Hermite polynomials are orthogonal over the range from -∞ to +∞, but an additional “weighting function” of (e^(-(x^2)))must be included in the integral. That is, (∫_(-∞)^∞)(Subscript[H, n])(x)(Subscript[H, m])(x)(e^(-(x^2)))dx  = 0  if n≠m.

(a) Generate a list of the first six Hermite polynomials (i.e. m runs from 0 to 5) and plot them all on the same graph over the range {x, -2, 2} (with an appropriate PlotRange selected so you can see them all).
(b) Pick two of the polynomials (different ones), and plot  (Subscript[H, n])(x)(Subscript[H, m])(x)(e^(-(x^2))) with the Filling->Axis option, to convince yourself it’s plausible that the total area above the graph equals the total area below the graph. Then do the integral with those two specific polynomials (from -∞ to ∞) to show that it does actually equal zero.
(c) Repeat part (b), using two of the same polynomial instead of two different ones. In this case, the graph area will not cancel out and the numerical integral won’t equal zero. 
(d) Now construct a table of values of the integral for all values of m and n. Do this with the Table command, using {n,0,5} and {m,0,5} as options, and display it with TableForm.   (Interesting mathematical sidenote: the integer coefficients multiplying the square root of π along the diagonals of your table are the “double factorials” of the even integers.)

Table[HermiteH[n,x],{n,0,5}]
Plot[%,{x,-2,2}, PlotRange->All ]

Plot[HermiteH[2,x] HermiteH[3,x]  Exp[-x^2],{x,-2,2},Filling->Axis]
Integrate[HermiteH[2,x] HermiteH[3,x]  Exp[-x^2],{x,-Infinity, Infinity}]

Plot[HermiteH[2,x] HermiteH[2,x]  Exp[-x^2],{x,-2,2},Filling->Axis]
Integrate[HermiteH[2,x] HermiteH[2,x]  Exp[-x^2],{x,-Infinity, Infinity}]

Table[Integrate[HermiteH[n,x] HermiteH[m,x]  Exp[-x^2],{x,-Infinity, Infinity}],{n,0,5} , {m,0,5}]
%//TableForm
(* took me 4:50 *)

Problem 10

(a) How long did you spend working on this exam?
(b) If you could eliminate or modify one assignment from one of the first five labs, what would it be and why? As long as you give a reasonable explanation for your choice you will get credit for this.

Blah blah blah