Practice Problems-Week1
Practice Problems-Week1
nb
(a) N calculates numerical value of any expression. Lets find out Pi and E (the Euler number e) to 10 digits by evaluating the following
commands.
NPi
NPi, 10
N[E, 10]
(b) Find Pi to 100 digits.
exp(-x)
f (x)
0
log(x)
cos(2 x)
-1
-2
0 1 2 3 4 5
x
3. Sketch the following functions, first on a piece of paper analyzing them for their zeros, divergences, extrema and asymptotes. Next
cross - check your sketch by plotting the function on Mathematica.
Hyperbolic functions:
1-x 1 1-x
7. ln x 8. ln(ln(x)) 9. ln(x) / x 10. ln(ex - 1) 11. ln 1+x 12. x
ln 1+x
2
13. e-x cos( x) 14. e-x sin(x) 15. e- x cos(x) 16. e- x sin(x) 17. x e-x 18. x - 1 + e-x
x 1/ x + x, x + x,12 + x, 2
19. x 20. x 21. x 22. +x, 23. 24.
1++x,12 e x +1
1 -1
1
25. e x 26. e x2 27. x-12 - x-6 28. cosh-1 (x) 29. coth-1 (x) 30. coth (x) -
x
2
4. For a quadratic function given by y = a x + b x + c, where a > 0, find the equation of the minimum (xmin , ymin ) as a function of b.
Now rewrite ymin as a function of xmin . What is this function? Can you make a plot to show that the minima of the parabola
y = a x2 + b x + c lies on the curve ymin (xmin )? Use Manipulate to vary b and demonstrate that the minima always lies on this curve.
week1.nb 3
4. For a quadratic function given by y = a x2 + b x + c, where a > 0, find the equation of the minimum (xmin , ymin ) as a function of b.
Now rewrite ymin as a function of xmin . What is this function? Can you make a plot to show that the minima of the parabola
y = a x2 + b x + c lies on the curve ymin (xmin )? Use Manipulate to vary b and demonstrate that the minima always lies on this curve.
Hint: Try the following code. Can you figure what’s going on? Modify this code to manipulate a and c also.
- b2
ManipulatePlota x2 + b x + c, c - a x2 , + c /. {a → 2, b → b1, c → 4} // Evaluate,
4a
{x, - 2, 2}, Frame → True, PlotRange → {- 5, 10}, {b1, - 6, 6}
5. Find the point of intersection for curves y = log x and y = x13 up to three decimal accuracy. Hint: You can do this by hit and trial or
use a built in Mathematica function like NSolve.
6. Plot cosh(x) and its quadratic approximation at x = 0. Find the fractional deviation the quadratic approximation near x = 0 has with
y(x)-cosh(x)
respect to cosh(x) at x = 0.5 and x = 1, that is if y(x) represent quadratic approximation to cosh(x) near x = 0, then find
cosh(x) x = 0.5
y(x)-cosh(x)
and .
cosh(x) x =1.0
7. Electric field lines of a quadrupole: Plot the electric field lines and equipotential surfaces for the quadrupolar configuration: four
charges of same magnitude and alternating sign on the corners of a square of side a, that is, +q at (0, 0) and (a, a) while -q at (a, 0) and
(0, a). Use combination of StreamPlot and ContourPlot as shown in the lecture inside a Show function.
8. Magnetic field of a magnetic dipole: Magnetic field of a magnetic dipole is given by
μ0 +m, 5 5
B(r) = 2 cos θ r + sin θ θ (1)
3
4πr
Plot the magnetic field lines in the x-z plane as vector plot, stream plot and stream density plot. [Hint: Convert the magnetic field to
Cartesian coordinates first.]