# Tutor profile: Alex P.

## Questions

### Subject: Python Programming

When trying to find the optimal normalization factor for an array of numbers to find the best fit to another array of numbers (the "correct" array), state one time-consuming method and another method that would be quicker than the previously stated method.

Perhaps the most time intensive way to find such a normalization factor would be by using a grid search "brute force" type approach. This method relies on creating an extensive list of numbers that might be the correct normalization factor and checking every number in that list and calculating the error between the newly normalized array and the "correct" array and then recording the optimal normalization value. As you can imagine, this method would not be optimal from a time perspective. There are many ways one could go about optimizing this type of problem, one of them being the scipy.optimize.minimize function. This function will take the error function you want to minimize the error from (i.e. chi square error), an initial guess as to what the optimized normalization factor might be (doesn't have to be very close), and whatever arguments need to be passed onto the error function (in this case, the "correct" array and the non-normalized array). This method is much faster than the brute force approach due to the optimization algorithms, but it can be tricky to set-up if trying a more complex problem.

### Subject: Astrophysics

Initially, a star cluster is in equilibrium and has a mass $$M_{old}$$, a radius $$R_{old}$$, and a velocity dispersion $$\sigma_{old}$$. At some time later, some of the cluster's mass is removed via stellar feedback which removes a portion f of the original cluster mass. How does the final energy of the system compare the initial energy of the system? Assume the new energy is measured right after the stellar feedback event occurs.

The key idea here is to recognize that since the cluster is in equilibrium, the Virial Theorem ($$T = -\frac{U}{2}$$) can be applied to the cluster initially and instantly after the stellar feedback happens. We know that the final mass of the cluster will be M$$_{new}$$ = (1-f)M$$_{old}$$ and we also know that potential energy will take the form of $$U = k\frac{GM}{R}$$ and kinetic energy will take the form $$T = aM\sigma^{2}$$. By applying the old to new mass relation to the potential energy and kinetic energy, we find that $$U_{new} = (1-f)^{2}U_{old}$$ and $$T_{new} = (1-f)T_{old}$$. The new energy of the system must be: $$E_{new} = T_{new} + U_{new} = T_{old}(1-f) + U_{old}(1-f)^{2}$$. Since $$E_{old} = T_{old} + U_{old}$$, by the Virial Theorem: $$U_{old} = 2E_{old}$$ and $$T_{old} = -E_{old}$$. By combining all these relations so the equation is in terms of $$E_{new}$$ and $$E_{old}$$ and then simplifying, $$E_{new} = (1-2f)(1-f)E_{old}$$.

### Subject: Physics

Consider an Atwood machine: a simple pulley with a sting on it with two masses (m1,m2) on either end of the string (m$$_{2}$$ on left, m$$_{1}$$ on right) only being affected by gravity and the tension on the string. Assuming the masses cannot move further than the length of the string and are confined to movement in an up/down direction, what would be the acceleration on each mass in terms of m$$_{1}$$, m$$_{2}$$, and any necessary constants?

Perhaps the simplest way to approach this problem is through Newton's Laws. We can start by constructing a free body diagram (FBD) of the right mass (m$$_{1}$$). The mass is held up by the tension force and pulled down by gravity. When m$$_{1}$$ is at rest, the tension and gravitational forces cancel each other out. However, when one is larger than the other, there is a net force on the mass that can be described using Newton's Second Law (F$$_{net}$$ = m*a). Using the dot notation ($$x$$ = position, $$\dot{x}$$ = velocity, $$\ddot{x}$$ = acceleration), Newton's second law becomes: F$$_{net}$$ = m*$$\ddot{x}$$. By defining the upward direction as positive x and downward as negative x, F$$_{net}$$ = F$$_{Tension}$$ - m$$_{1}$$*g. By combing these ideas, the equation of motion of the mass is: F$$_{Tension}$$ - m$$_{1}$$g = m$$_{1}*\ddot{x}$$. This then leaves the acceleration of the mass as: $$\ddot{x}$$ = $$\frac{F_{Tension}}{m_{1}}$$ - g. While this result is technically correct, it is somewhat unsatisfying due to that tension force.$$\\$$ Next, let's consider a slightly harder way to visualize the problem but gives a more satisfying result. This next method is called the Lagrangian ($$\mathcal{L}$$) which is defined as the kinetic energy of the system minus the potential energy ($$\mathcal{L}$$ = T - U). The first step is to relate the motion of the two masses together somehow. Since the two masses are connected by a string, if one mass goes up, the other must go down. The string is a fixed length which must be the distance from the first mass to where the string contacts the pulley (x), the distance from the second mass to where the string contacts the pulley on the other side (y), and the distance around half of the pulley (2$$\pi$$*R/2 = $$\pi$$R where R is the radius of the pulley). Given this, the total length of the string must be L = x + y + ($$\pi$$*R). This equation mathematically relates the two motions of the masses through y = C - x, where C = L - ($$\pi$$*R). The kinetic energy of the system can then be written as T = $$\frac{1}{2}m_{1}\vec{v}^{2}$$ where $$\vec{v}^{2}$$ = $$\dot{x}^{2}$$ + $$\dot{y}^{2}$$. The two velocities here ($$\dot{x}$$ and $$\dot{y}$$) are independent directions which when squared give the squared total velocity (recall the Pythagorean Theorem). The kinetic energy can be simplified to T = $$\frac{1}{2}(m_{1}+m_{2})\dot{x}^{2}$$ with proper substitutions. Since the only potential energy here is gravitational potential energy, the potential energy of the system (U = -m*g*h) can be written as U = ($$m_{2} - m_{1}$$)gx + C. We can ignore the constant C here as it doesn't change the final result. With these two equations know, we can now know that $$\mathcal{L} = \frac{1}{2}(m_{1}+m_{2})\dot{x}^{2} + (m_{1}-m_{2})gx$$. The derivative of $$\mathcal{L}$$ with respect to the velocity gives the momentum and the derivative of $$\mathcal{L}$$ with respect to position gives the force. By combining these two ideas, it can be shown that $$\frac{d\mathcal{L}}{dx} = \frac{d}{dt}\frac{d\mathcal{L}}{d\dot{x}}$$. Taking these derivatives and equating them by that relation gives the the acceleration of $$m_{1}$$ is $$\ddot{x} = \frac{(m_{1}-m_{2})g}{(m_{1}+m_{2})}$$ which is a much more satisfying result than before. However, there is yet another way to solve for the acceleration of the masses which is by using the Hamiltonian. The Hamiltonian is defined as $$\mathcal{H}$$ = T + U. Hamilton's equations are a little more complex ($$\dot{q} = \frac{d\mathcal{H}}{dp}$$, $$\dot{p} = -\frac{d\mathcal{H}}{dq}$$, where q is a coordinate direction and p is the momentum in the direction q) but by using the same coordinate system as before, $$\dot{x} = \frac{p_{x}}{(m_{1}+m_{2})}$$ and $$\dot{p_{x}} = (m_{1}-m_{2})g$$. By taking the time derivative of the first of those two equations and substituting in the second equation, we get the same result as before: $$\ddot{x} = \frac{(m_{1}-m_{2})g}{(m_{1}+m_{2})}$$. While these two methods are a little more intense than solving a system using strictly Newton's equations, the Lagrangian and Hamiltonian provide a more generalize approach to solving systems which can be used in many more difficult scenarios.

## Contact tutor

needs and Alex will reply soon.