Note: 20% points on this assignment are for presentation and formatting of work.
1 Linearize a nonlinear ‘system’
Consider the nonlinear function \[f(x) = 5+x(x-4)(x-2) \tag{1}\]
Derive the expressions for a ‘linear model’ of Equation 1 near…
\(x=1\)
\(x=2\)
\(x=4\)
TipLinear Model
As used in this assignment, the term ‘linear model’ refers to a function \(f^*(x)\) such that \(f(x)\) is approximately equal to \(f^*(x)\) in some part of the domain. \(f^*(x)\) should be linear in \(x\).
Write out your answers including your derivation by hand.
TipTyped vs. Handwritten
Neatly handwritten answers are expected here. You may choose to submit typed answers, but only if you use proper typesetting software like LaTeX.
Plot the functions that you find in the vicinity of each point, i.e., plot your answer to 1 in a small neighborhood of \(x=1\), your answer to 2 in a small neighborhood of \(x=2\), and your answer to 3 in a small neighborhood of \(x=4\). Overlay all three plots on a global plot of Equation 1 over a domain large enough to show the nonlinear behavior.
TipGetting comfortable with plotting
You may use any plotting software to do this; I recommend either matplotlib.pyplot in Python or the standard plotting commands in MATLAB. It is okay to use online resources to help you plot things, but your work must be your own.
If you need help getting started, check out the Resources page on the class website.
Solution
Derivation of linearized systems
The slope of the function \(f(x)\) at any value of \(x\) is equal to its derivative evaluated at that value of \(x\). With this in mind, note that the derivative of \(f(x)\) is \(f'(x) = 3x^2-12x+8.\)
At \(x=1\), \(f'(x) = -1\)
At \(x=2\), \(f'(x) = -4\)
At \(x=4\), \(f'(x) = 8\)
We now have the slopes of each of the three functions we need. But we also need their y-intercepts. To find those, note that you already have one point on that line.
The point \((1,f(1)) = (1,8)\) lies on the required line. Thus, we can write the equation \[8 = (-1) \cdot (1) + c \implies c = 9\]
The point \((2,f(2)) = (2,5)\) lies on the required line. Thus, we can write the equation \[5 = (-4) \cdot (2) + c \implies c = 13\]
The point \((4,f(4)) = (4,5)\) lies on the required line. Thus, we can write the equation \[5 = (8) \cdot (4) + c \implies c = -27\]
Thus, our three functions are
\[y = -x + 9\]
\[y = -4x + 13\]
\[y = 8x - 27\]
Plotting it
import numpy as npimport matplotlib.pyplot as pltdef f2(x): # a non-linear functionreturn5+ (x -4)*(x)*(x -2)def f2prime(x): # the derivative of f2return8-12*x +3*x**2# Create an 'x axis' with 100 points from 0 to 5x_vals = np.linspace(0,5,100)# Plot f2plt.plot(x_vals,f2(x_vals),label="f(x) = 5 + x(x-4)(x-2)")# Define the three points of interestx1 =1.0x2 =4.0x3 =2.0# Create 'neighborhoods' around them.x1vals = np.linspace(x1-0.4,x1+0.4,100)x2vals = np.linspace(x2-0.4,x2+0.4,100)x3vals = np.linspace(x3-1.0,x3+1.0,100)# Define functions in their vicinityf2x1 =lambda x: f2(x1)+f2prime(x1)*(x-x1)f2x2 =lambda x: f2(x2)+f2prime(x2)*(x-x2)f2x3 =lambda x: f2(x3)+f2prime(x3)*(x-x3)# Plotplt.plot(x1vals,f2x1(x1vals))plt.plot(x2vals,f2x2(x2vals))plt.plot(x3vals,f2x3(x3vals))plt.xlabel("Input [x]")plt.ylabel("Output [y]")plt.legend()plt.grid()plt.show()
2 Complex Numbers
2.1 Cartesian and polar forms
The Cartesian form of a complex number is
\[z = x+iy, \tag{2}\]
and its polar form is
\[z = r e^{i \theta} \tag{3}\]
Derive the polar form of the following complex numbers given in Cartesian form, i.e., calculate \(r\) and \(\theta\) and then write it in a form like Equation 3
\(z_1 = 2 + 7i\)
\(z_2 = -3 + 7i\)
\(z_3 = -5 - 8i\)
TipSolution
To calculate, recall the complex plane diagram from lecture 2 and note that \(r = \sqrt{x^2 + y^2}\) and \(\theta\) can be found from trigonometry.
Let’s first plot all three on the complex plane.
We find that \(z_1\) is in the first quadrant, \(z_2\) in the second quadrant, and \(z_3\) in the third quadrant. We can use this to put correct signs on the angle \(\theta\) that we will find for each number.
Magnitude is \(r = \sqrt{2^2 + 7^2} = \sqrt{53} \approx 7.28\). Argument is \(\arctan{7/2} \approx 1.29\), so we have \(z_1 \approx 7.28 e^{1.29i}\).
Magnitude is \(r = \sqrt{(-3)^2 + 7^2} = \sqrt{58} \approx 7.61\). Argument is \(\pi - \arctan{7/2}\) which is approximately \(1.97\), so we have \(z_2 \approx 7.61 e^{1.97i}\). (Why do we subtract from \(\pi\)? You should be able to figure this out)
Magnitude is \(r = \sqrt{(-5)^2}+ (-8)^2 = \sqrt{89} \approx 9.43\). Argument is \(\pi + \arctan{8/5} \approx 4.15\), so we have \(z_3 \approx 9.43 e^{4.15i}\). Note that you could subtract \(2\pi\) from the argument and it would still be the same answer.
Derive the Cartesian form of the following complex numbers given in polar form, i.e., write it in the form of Equation 2.
\(z_4 = 5e^{0.5i}\)
\(z_5 = 5ie^{i \pi/6}\)
\(z_6 = 3 e^{0}\)
TipSolution
First, let’s plot these on the complex plane.
We find that \(z_1\) is in the first quadrant, \(z_2\) in the second quadrant, and \(z_3\) in the third quadrant. We can use this to put correct signs on the angle \(\theta\) that we will find for each number.
The number \(z_4\) can be written \(r \cos \theta + i r \sin \theta\). Thus, we have \(5 \cos 0.5 + 5 i \sin 0.5 \approx 4.38 + 2.39i\)
The number \(z_5\) should be placed into Cartesian form using a procedure such as follows. \[
\begin{aligned}
z_5 &= i \times (5 \cos \pi/6 + 5 i \sin \pi/6 ) \\
&= i \times \left( \frac{5\sqrt{3}}{2} + i \frac{5}{2} \right) \\
&= - \frac{5}{2} + i \frac{5\sqrt{3}}{2}
\end{aligned}
\]
This is simply \(3 + 0i\)
2.2 Complex Arithmetic
Complex numbers can be added, subtracted, multiplied and divided.
Calculate the following complex numbers and give them in Cartesian or polar form.
\[(-2)e^{0.3i} + 3 e^{5i}\]
TipSolution
\[-1.05 - 3.46 i\]
\[2+5i - e^{-i\pi/4}\]
TipSolution
\[1.29 + 5.70 i\]
\[(5+i) \times (3-i)\]
TipSolution
\[16-2i\]
\[2e^{3i} \times (-9) e^{7i}\]
TipSolution
\[15.10 + 9.79 i\] or \[-18e^{10i}\]
\[(6+7i) \div (7-6i)\]
TipSolution
\[0+i\]
\[-4e^{7i} \div 3 e^{5i}\]
TipSolution
\[-\frac{4}{3}e^{2i}\] or \[0.55 - 1.21 i\]
2.3 Plotting Complex Numbers
Start with the complex number \(z_7 = 2 + 3i\). On the same set of coordinate axes representing the complex plane, plot
TipThe complex conjugate
Remember that \(\bar{z}\) is the complex conjugate of \(z\), i.e., if \(z = x+ i y\) then \(\bar{z} = x - i y\).
A point corresponding to \(z_7\).
An arrow from the origin to \(z_7\).
A point corresponding to \(i z_7\).
An arrow from the origin to \(i z_7\).
A point corresponding to \(-z_7\).
An arrow from the origin to \(-z_7\).
A point corresponding to \(\bar{z_7}\).
An arrow from the origin to \(\bar{z_7}\)
TipSolution
3 Differential Equations
3.1 Placing equations in the standard form
The standard form for writing down a first-order differential equation is \[\dot{x} = f(x,t). \tag{4}\]
Place the following equations in the form of Equation 4. In doing so, explicitly identify and write down the function \(f(x,t)\).
Tip
Remember that \[f(x,t)\] could be a constant, just a function of \(t\), just a function of \(x\), or a function of \(both\).
\[\dot{x} + 2x = 1/x\]
TipSolution
\[\dot{x} = f(x,t) = \frac{1}{x} - 2x\]
\[\dot{x}^2 + 2x = t\]
TipSolution
\[\dot{x} = f(x,t) = \sqrt{t - 2x}\]
\[\dot{x}x + 2 = \cos t\]
TipSolution
\[\dot{x} = f(x,t) = \frac{(\cos t - 2)}{x}\]
\[\dot{x} = e^x - e^t\]
TipSolution
\[\dot{x} = f(x,t) = e^x - e^t\]
\[\dot{x} + \cos t x = 5\]
TipSolution
\[\dot{x} = f(x,t) = 5 - \cos t x\]
\[\dot{x} = \frac{1}{x}\]
TipSolution
\[\dot{x} = f(x,t) = 1/x\]
3.2 Coupled and uncoupled differential equations
Which of the following sets of equations are coupled? State whether the coupling is in both ways, or only one way, and if the latter, then specify which way it is coupled. You do not need to show your work for this.
The above equations are coupled both ways. Both \(v_1\) and \(v_2\) depend on each other.
3.3 Linear and nonlinear differential equations
Which of the following differential equations are linear and which are nonlinear?
TipWhat linearity of a differential equation means
A differential equation is linear if the function \(f\) appearing on its right-hand side is linear in \(x\) and all its derivatives
\[2 \dot{x} + x = \cos t\] Linear
\[(\dot{x} + x) \cos x = t\] Nonlinear
\[(\dot{x} + x) \cos \pi/6 = 2t \] Linear
\[\dot{x} = \frac{1}{x} \] Nonlinear
\[\ddot{x} + 2 \dot{x}^2 - 3x = 2t \] Nonlinear
\[\ddot{x} + 2 \dot{x} - 3x = 2t \] Linear
4 A coupled first-order linear system
TipSolving differential equations
is not necessary for this problem. We haven’t gotten to that yet! The plots shown below were made by a computer program. Very soon, you’ll learn how to make them yourself, but for now, don’t worry about how the solution was arrived at.
In class, we discussed the system described by the following diagram.
A box on a box with friction. Cross-hatch means a friction-full surface.
TipHow long are the boxes?
We will assume that the upper box is so much smaller than the lower box that it will never fall off. The lower box is assumed to be on the ground and the ground goes on for ever.
The governing equations for this system, if it’s not subjected to any external forces, are
If you start this system off such that the bottom box has a starting positive nonzero speed, while the top box starts off with zero speed, it can be shown that the speeds of the two boxes \(v_1\) and \(v_2\) (in the directions shown in the diagram) will evolve over time as follows.
Figure 1: Velocities \(v_1\) and \(v_2\) plotted against time
Note that box 1 is ten times heavier than box 2, and the two friction coefficients \(b_1\) and \(b_2\) are equal to each other.
4.1 Tasks
According to your intuition, what happens to the boxes’ positions as measured from the fixed wall? Will \(x_1\) and \(x_2\), measured relative to the wall, both increase? Or will one of them increase and the other decrease? Describe what happens to the boxes’ positions in a few sentences.
TipSolution
Our physics intuition suggests that there will be some kind of ‘lag’ between the motion of the two masses. If we start out by moving only \(m_1\), then \(m_2\) won’t immediately reach the same speed, and perhaps never will. However, if the speed is reasonably small, we do expect \(m_2\) to be carried along with \(m_1\) eventually. We know that sometimes it’s possible to ‘pull the rug from underneath’ by moving something very quickly.
It seems that this all depends very much on how much friction there is between \(m_1\) and \(m_2\). It’s unclear at this stage what this dependence is, exactly.
Using Figure 1, make a sketch of \(x_1\) and \(x_2\) as a function of time for the first few moments of the motion, until the orange and blue lines shown above intersect. Start both \(x_1\) and \(x_2\) from zero, which effectively means we’re re-defining zero to be wherever things started. Your knowledge of calculus will help you with this task. Remember that this is a qualitative, not a quantitative task.
TipSolution
For this solution, I have provided a plot rather than a sketch. It is possible to arrive at a sketch using the following arguments.
Figure 1 tells us that the speed of mass 1 is initially some large number (not infinite), while the speed of mass 2 is initially zero or close to zero. Thus, the slope of the position-vs-time graphs should start off as ‘some positive number’ for \(m_1\) and ‘basically zero’ for \(m_2\).
Figure 1 also tells us that the speed of \(m_1\) decreases while the speed of \(m_2\) increases. Thus, the slope of the two graphs should change accordingly.
At the point where the orange and blue lines intersect, we cannot say that the positions are the same. In fact, we know that mass 1 has moved much more than mass 2 by that point because the area under the graph for mass 2 is clearly lower than the area under the graph for mass 1. We can say that the slopes of the two graphs should be the same at that point.
All these characteristics are shown in the sketch below in Figure 3.
Figure 2: Positions \(x_1\) and \(x_2\), shifted so they both start from zero, plotted against time
Also make a sketch of \((x_2 - x_1)\) against time on the same set of axes as above, and explain what this represents physically.
CautionPosition vs. velocity
The point where \(v_1\) and \(v_2\) intersect is where the two boxes have the same velocity, not position!
TipSolution
Figure 3: Positions \(x_1\) and \(x_2\), shifted so they both start from zero, plotted against time
The fact that this is negative shows that mass 2 is actually moving backward relative to mass 1. It’s being ‘left behind’, but it’s catching up to some extent.
For a finite sized lower object, this would mean that the object on top falls off.