Exam 2024.

Exercise 1. Taylor Series .

Exercise 1: Compute the Taylor series expansion of the function f (x) = exp[x^2]f up to the order 6 . Extract and list the coefficients of the series terms . Plot the original function f (x)  and its series approximation on the same graph for x in the range[−2, 2] . Find the maximum |x| such that the difference between f(x) and the series approximation is below 1%.

Exercise 2. MonteCarlo integration.

3. Define the function f (x) as below . Plot it in the interval (0, 3). Integrate f(x) inside this range. Find numerically the maximum f_max of f(x) within the range (0,3). Write a code that generate 10^N random points uniformly distributed  in the rectangular region defined by x between (0,3) and y betwen 0 and f_max and counts how many points are below f(x). Plot the points below f(x) and the function itself for a couple values of N, e.g. N=2 and N=4 or create a Manipulate command showing the plot when varying N. The ratio of points below f(x) and the total number of random points 10^N, multiplied by the total area of the rectangular region, should approximate the exact integral of f(x) between 0 and 3 (MonteCarlo integration). Plot the result of the MonteCarlo integration as a function of N and show graphically that it converges to the  true value for N increasing from 1 to 5 or more.

Clear[f];f[x_]=x/(1+x^4);

Exercise 3. Classical physics.

Solve the differential equation for the motion of a projectile under a constant potential on Earth (g = 9.81 m/s^2) . The equations should be solved for the coordinates x (distance from the origin) and y (height above ground). Stop the integration when the projectile hits the ground. Assign initial conditions at the origin on ground level,  with an initial angle θ, and initial velocity 50 m/s. Vary θ between 0 and 90 degrees in steps of, e.g., 10 degrees, and use Manipulate to show the various trajectories.

Exercise 4. Quadrupole of an ellipsoid

The  quadrupole of an object with density ρ(x,y,z)>0 is defined as
(Subscript[q, ij])= ∫ρ(x,y,z) (x^i)(x^j) dx dy dz
The reduced quadrupole is defined as
(Subscript[Q, ij])= ∫ρ(x,y,z) (x^i)(x^j) dx dy dz-(1/3)(Subscript[δ, ij])q
where (x^i)={x,y,z} and  q is the Trace of (Subscript[q, ij]). 
1) Consider an ellipsoid with semiaxes a,b,c:
(x/a)^2+(y/b)^2+(z/c)^2=1
2) Perform the integration using the “integration over region” method. That is, define the region of integration (i.e. , the interior of the ellipsoid)  with ImplicitRegion and then use it to integrate in that region
3) First, show numerically (i.e., use NIntegrate) for a couple of arbitrary radial density distributions (such that ρ(x,y,z)=ρ(r) depends only on the radial distance from the origin) that the reduced quadrupole vanishes for a sphere.
4) Then, calculate symbolically (i.e., use Integrate) the reduced quadrupole for the ellipsoid assuming now a homogeneous ρ(x,y,z)=1. Check that you get the correct result (you can find it on internet). E.g., one has
Q_11=(4/45) a b c (2 (a^2)-(b^2)-(c^2)) π