Assignment 1, PHYD57

Minor edit on 14 Sep.

Due date and time have been changed to 22 Sep (Sun) at 11:59 pm

This time, you may do numerical calculations in because we did not work with C or Fortran language and compiler yet. But if you're learning C or F, we'll be very impressed to receive your calculations (in Quercus Assignments) done in one of those languages!
Please do not assume we will run your code -- do not submit Jupyter raw notebook files. In the problems involving programming, we would like to see the listing of a well-commented program with you own detailed comments, and your description or proofs of results, including plots if applicable. I believe Jupyter can provide a pdf output to help with that. Try to submit everything in one pdf file, if you can, though it's not strictly required and we will not award points for the beauty of text formatting, just for the clarity and correctness of your plots and descriptions.

Problem 1.1 [30 pts] Ballistic motion in air

A tennis ball is launched at an angle $\alpha$ to horizon with initial speed $v_0 = 130$ km/h (a pretty good but not exceptional player). The ball has diameter 6.6 cm, and weighs 57 grams. It starts from coordinates $(x,y)=(0,0)$.

Write a procedure that takes $\alpha$ as input, and returns:
(i) maximum height $h$ in meters,
(ii) the range $R$ in meters [the ball touches down at point $(R,0)$] and
(iii) the ratio of $x_h/R$ (to judge the asymmetry of trajectory's shape). Here, $x_h$ is the $x$ value at which the height is maximum.

If the motion takes place in vacuum, the problem has a simple analytical solution for (i)-(iii). Please derive it. Show that, in vacuum, maximum range $R$ is obtained with $\alpha_m = 45^\circ$ (evaluate $R$ and $h$ in vacuum), and the trajectory is a symmetric, inverted parabola ($x_h/R = 1/2$).

Numerical calculation is necessary when the tennis ball moves in air of standard atmospheric density $\rho = 1.225$ kg/m$^3$. Do not try to find analytical solution, since it is not known, except for very special $\alpha$, like 0 or 90$^\circ$. Please integrate the equations of motion to simulate the motion until the touchdown point, and explain your choice of method any other details you find important. It should be simple but it has to be accurate, so we suggest timestep dt=0.001 s. You are asked to code it yourself (do not use black-box packages or modules to do the simulation). With $\vec{r} = (x,y)$ being the position vector of the ball and $\vec{v}=\dot{\vec{r}}$ its velocity vector, the equation of motion reads $$ \ddot{\vec{r}} = -g\, \hat{y} -\frac{C_d A}{2M} \rho\, v \; \vec{v}$$ where: $v = |\vec{v}|$, $\hat{y} $ is a vertical versor pointing upward, $C_d=0.55$ is a nondimensional drag coefficient of tennis balls, $A$ is the cross sectional area of the ball, $M$ its mass, and $g = 9.81$ m/s$^2$.

You will code the problem as either two coupled 2nd order ODEs in variables $x$ and $y$ or four coupled 1st order ODEs for position and velocity components. The above vector eq. of motion splits into two separate 2nd order ODEs in two directions, while the 1st order eqs. are obtained by writing first writing $\ddot{\vec{r}} = \dot{\vec{v}}= ...$, plus another vector equation $\dot{\vec{r}} = \vec{v}$, and then splitting each into components). Test your procedure on a problem with $\rho=0$, for which you know the answer, and see to it that the air drag changes that solution, but not qualitatively (e.g., make sure the tennis ball doesn't travel a few meters only, or shoots to the Moon with increasing speed, all of which would indicate a programming bug or worse yet, a correct solution of wrong equations).

With the tested procedure, find the angle $\alpha_m$ which results in maximum range $R$. What are the quantities (i)-(iii) then? Plots of trajectories are welcome!

Problem 1.2 [22 pts] Maximum unidirectional drop of value

This problem comes up in the analysis of time series, such as financial data, and in physical sciences (e.g., find the biggest voltage drop along some axis).

You are given a series of values $x$ of length $N$; that is a vector of values $x_i$, where $i=1...N$. Formulate an algorithm that finds the maximum drawdown (maximum drop) of $x$ (representing investment or voltage) in some contiguous segment of data, i.e. the largest drop of value from some initial value $x_i$ to a lower value $x_j$ at index $j > i$.

For instance, if the series is $x$ = {4, 3, 6, 5, 4, 5, 2, 3, 4, 4, 11, 8, 10} then the largest dropdown is between positions $i=3$ and $j=7$, and equals $x_3-x_7= 6-2=4$. Notice that we could have even more points between those two, with values oscillating between 2 and 6, and the resuting maxmium dropdown would not change. A different $j$ might result but we are not interested in $i$ or $j$, just the maximum drop (precise interval can be provided with very little extra work, but the problem does not ask for it). Your algorithm must thus somehow not be fooled by local extrema.

You can describe your algorithm in words, and/or implement it, commenting the program very well, so it is clear how it works and how you proved that it correctly works to yourself.

Remark: Since all contiguous subsets (subintervals) of the dataset provide possible solution, examining them all separately would take an effort of computational complexity $O(N^2)$, because the number of all index pairs {$j\gt i$} is $N(N-1)/2$, so $\sim N^2$. For large $N$ this is an awful lot of computation. Try to obtain a cheaper asymptotic scaling with $N$ if you can. If you can't, code an inefficient method scaling like $N^2$, for a partial credit of up to 13 pts.

Problem 1.3 [15 pts] Second order stencil for curvature

Prove theoretically by using Taylor series expansion at different values of the argument of a function $y(x)$, that the following, symmetrical numerical approximation tothe second derivative $y^" = d^2y/dx^2$ $$f = \frac{y(x+h) - 2 y(x) + y(x-h)}{h^2}$$ has a second-order accuracy, i.e. its deviation from exact second derivative is proportional to $h^2$, $h$ being a small variation of argument $x$. (Assume that the function $y(x)$ has non-singular derivatives of all required orders.)

Show it numerically for a particular choice of function: $$ y(x) = e^{x-1} + x^3(x - 1) $$ around the point $x=1$. Make a plot of the difference between true analytical second derivative and its estimate $f$ above, as a function of $h$.

The plot should have a log-log scaling to reveal any power-law dependencies between the error and $h$. (What is the slope?) The suggested range of $h$ should be from, say, $10^{-7}$, to $10^{-2}$. and the power of ten that produces $h$ (not $h$ itself) should cover that range uniformly. Otherwise there will be a pileup of points toward one end of the plot in log-log axes.

Problem 1.4 [15 pts] What are the FPGAs and ASICs?

In the last two decades, these machines were thought by some to be a possible winner in the competition for future, fast computing platforms. But not everybody shares that view. Do you think they are going to dominate? Why? Why not? Do a quick research online and write 1/2 page summarizing your findings. Cite at least 2 sources.


Pawel Artymowicz / pawel.artymowicz@utoronto.ca