Home CAD/CAM/CAE WINTECH TRAC-Group MSI Academy BMSCenter Design Team My CV Contact me

## Saturday, April 12, 2014

### Everything is the Same: Modeling Engineered Systems

1. Introduction - Modeling Components - Newton’s Laws:

In particular, good engineers typically employ a combination of
• analytical reasoning,
• computational skills
• physical knowledge
to solve problems. The more critical the engineering problem is, such as making sure that the power grid does not experience failures, the more important it becomes to combine these skills rather than just using one.
By analytical reasoning, is the ability to write down mathematical expressions that represent a physical system.
By computational skills, is the ability to use a computer to either evaluate or predict characteristics of a model that are too challenging to solve analytically.
And by physical knowledge. Possibly the most important of the three. is the crucial ability of an engineer to think critically about analysis and computations in the context of real physical knowledge about the world. This last piece can only come from experience. Combining analytical reasoning, computational skills, and physical knowledge is an essential part of being an engineer.

Modeling components of a mechanical system:

In general, we use what are called constitutive of laws to model individual components. These constitutive laws relate variables of interest like position x and velocity v. The derivative of position with respect to time to forces.

A relationship that has a line relating the two variables is called a linear relationship. A linear relationship is a lot to hope for. And in general, natural systems do not behave that way. But engineered systems have some engineer's brain involved. And that engineer's brain knows that we would prefer this to be a line.

That's why engineered systems typically do end up with a constitutive law that can be described by a nice lineOnly engineered systems, systems that have been designed by someone actually behave this way.

Mechanical diagrams play a critical role in how we set up models of mechanical systems. We always assume that we have three types of components, springs, dampers and massesWe will always use these three symbols to represent the three types of idealized components. First, we have a spring. Second, we have a damper. And lastly, we have mass. Whenever a spring, is an extension, it's position x is to be defined as positive. Whenever a damper, like syringe is extending, its velocity is defined to be positive. Moreover, the relationship between force and position of a spring is always a line represented by the constituent of law F sub s is equals to K times X sub s. Where the positive number K is called the spring constant. The relationship between force and velocity of a damper is also always a line represented by the constitutive law, F sub d is equal to b times v sub d.

Fs = K.Xs

The relationship between force and velocity of a damper is also always a line represented by the constitutive law, F sub d is equal to b times v sub d.

Fd = b.Vd

Where the positive number b is called the damping constant. Hence the force on a spring being positive, implies that the position must be positive. And the force on a damper being positive implies that the velocity of the damper must be positive and the damper must be extending.

Fs > 0 ==> xs > 0,  Fd > 0 ==> vd > 0

With these sign conventions in mind, we can combine elements into combinations of elements. For instance, consider a wall and a spring and a damper that's in parallel with that spring.

And an external force that's pulling on both of them. There are two elements that are in parallel and a force. Note that the spring and damper both connected to the wall in the left must move in unison. The only allowed motion is horizontal motion. No matter how many elements are in parallel with each other, they must move just to the left or to the right. They can not move up and down in diagram. That implies that the end of the spring is attached to the end of the damper. Which implies a relationship between the position of the spring x sub s and the velocity of the damper v sub d. In particular, the time derivative of the position of the spring must be equal to the velocity of the damper.

We always deﬁne positive acceleration of a mass to be to the right and external forces are always positive if the force is acting to the right—that is, the force would cause a positive acceleration of a mass. A spring with an external force. If the force changes instantaneously, so does the position of the spring. This is unintuitive because this is an ideal spring.

The simple system in figure that consists of a spring with no mass and an external force. When the spring is in extension, the force is deﬁned to be positive, and when the external force is positive, it is pulling the spring into extension. What does our constitutive law say about what happens if Fext starts out at zero and then suddenly becomes positive? Speciﬁcally, what if Fext = 0N until t = 1 and then becomes Fext = 1N?

While the external force is zero, the force on the spring is zero and its position is zero. Because the spring will only be extended or compressed if something is forcing. If we make the force jump up to one Newton, the position of the spring will instantaneously jump as well. That probably seems unintuitive, but that's because real springs have ideal spring properties plus damping properties and mass propertiesKeeping in mind the difference between these idealized elements and the real physical objects they represent.  Because this difference forces us to bridge the gap between analytical reasoning and physical knowledgeKeep in mind that constitutive laws are linear because we engineer systems to make them linear. That sign conventions matter. And the idealized mechanical elements can have very unintuitive behavior.

As another example, with Fext = 0. Which of the two plots below is even plausible?

The one on the left implies that, as a function of time, xs gets smaller and smaller, very slowly. The one on the right implies that, as a function of time, xs gets bigger and bigger, very quickly. Therefore the one on the right doesn't really make sense for a physical system, but the one on the left does.

Newton's Laws:

What principles do we use to combine those constitutive laws into models of mechanical systems? Newton’s laws provide the basis for everything we do. They say that the sum of the forces at a point must be equal to the mass of that point times its acceleration.

The sum of forces being equal to mass times acceleration is very deep, because that means there can be multiple components that all interact with each other through this magical relationship.

In the spring and damper system shown in above picture, where we assume that the external force is equal to zero. This spring-damper system could represent a shock absorber on a vehicle that has a load of an external force on it or a bungee cord that can be stretched by pulling on the end with an external force. Newton’s laws tell us that the sum of forces at the point where the spring and the damper meet must be equal to the mass times the acceleration of that point.

A positive external force will cause the point mass to accelerate to the right. On the other hand, a positive spring force—indicating that the spring is in extension—will accelerate the point to the left. Similarly, a positive damping force would act to the left. Hence, the sign conventions we chose for the individual mechanical elements have consequences for the signs in Newton’s equations.

Fext - Fs - Fd = ma = 0

The generalization of keeping track of sign conventions in this way is called a free body diagram. For us, free body diagrams are unnecessarily complicated and don’t really help very much, but as soon as you are trying to add up forces acting on a body in three dimensions they become really useful.

Now, if we assume that the external force is zero and that the mass of the point is zero, we are left with a much simpler expression of Newton’s laws -Fs - Fd = 0. If we use the constitutive laws that relate the spring force to the spring position and the damper force to the damper velocity, Fs = kxs , Fd = bvd

and substitute these constitutive relations into Newton’s laws, we get an equation involving xs and vd. -Fs - Fd = 0 ==> -kxs - bvd = 0.

If we additionally keep in mind that the time derivative of the position of spring is equal to the
velocity of the damper (i.e., x˙s = vd), we get a simple equation involving only the position of the spring.
-kxs - bx˙s = 0

Now, if we deﬁne x to be the position of the spring (just dropping the “s”), we get -kx - bx˙ = 0

and if we then solve for x˙ (remembering that the “dot” notion is the same as d/dt x), we get what is called an ordinary differential equation or ODE for short.

x˙ = (-k/b)x
x˙ = f(x)

This ODE says that the “derivative of the position is equal to the negative spring constant divided by the damping constant multiplied by the position”.

Note that this means that the derivative of the variable x is equal to a function of the variable x. This is the form of an ODE—it is always the derivative of “something” being equal to a function of that “something”.

d/dt(something) = f(something)

In this case, that “something” is the position x and f(x) is equal to (-k/b)x. In general the "something” is called the state of the ODE.

States of mechanical systems do not have to be positions—later we will also use velocity of masses as states. Engineers get good at choosing the state of an ODE with experience.

Linear, constant coefﬁcient, ﬁrst-order ordinary differential equations:

• Linear means that the dependence of a state velocity on a state is always a line.
• Constant coefﬁcient means that the slope of that line is always constant.
• First order means that there is only one time derivative. That is, we should only see one dot over x rather than two.

Now we go back to the model of the spring and damper, but now allow the external force to be nonzero. This would be like we take the bungee cord and pull on it with a constant force. Now we have the external force in the equation but the mass is still zero. If we replace the spring and damper forces by their constitutive laws, we can solve for an ordinary differential equation that now includes the external force.

0 = Fext - Fs - Fd
==> 0 = Fext - kx - bx˙
==> x˙ = (-k/b)x + Fext/b

It is worth thinking about this differential equation and what it means. It says that if the position of the spring starts out less than zero, making the left hand term greater than zero, and if the external force is greater than zero, then the velocity of the position of the spring must be positive. If the position of the spring is positive and the external force is negative, then the velocity of the spring must be negative.

But if both position and force are positive, we don’t know which direction the spring will move—it depends on the magnitudes of the external force, the spring constant k, and the damping constant b.
Newton’s laws lead to Ordinary Differential Equations and that if the constitutive laws are linear, you should expect a linear, constant coefﬁcient differential equation.

Example: Suppose one just has a damper (no spring and no mass) and applies a force to it—what happens?

The diagram might look like the one above. Applying force balance to this example leads to a potentially surprising outcome. We know that the damper force is deﬁned to be Fd = bvdwhere vd is the velocity of the damper. Hence, Fd > 0 when the damper is extending and Fd < 0 when the damper is compressing. Moreover, if we write force balance at the drawn node, we get Fext - Fd = 0, so vd = (1/b).Fext. This means that if one applies Fext = 1N of force to a damper, it will extend at a constant rate forever, until Fext changes.

State Choices and Sign Conventions:

Something that can be very annoying about all of this is how arbitrary the state choices and sign conventions seem. Let me discuss ﬁrst what it means to have a sign convention and then discuss — separately—why we choose states and signs the way we do. First, it is worth admitting that conventions are arbitrary. Everything in this class could be done under a different set of conventions, and one could make everything work out. For instance, we will always choose the position of a spring to be a state, and we will always choose the position to be positive if the spring is in extension and negative if the spring is in compression. This choice is largely to make the constitutive laws work out nicely. If the spring transitions from extension to compression, we would like the force generated by the spring to change sign as well, so choosing the position x to be positive in extension and negative in compression allows us to use a constitutive law of the form F = kx.
We could choose x to be the distance between the ends of the spring, but that would mean that the constitutive law would be F = k(x - L), so that whenever the spring is extended beyond its natural length L we get a positive force and whenever it is compressed we get a negative force. But this convention means we have to know L
So really, the convention we use is to make book keeping easier. It also turns out that with our choice of state, we will always get a linear ordinary differential equation, whereas if we use this one we get a form of ordinary differential equation that is harder to work with. The choice of state is largely to make our lives a bit easier. Choice of sign convention for forces works similarly. Here, it is worth noting that the “spring force” is not the same thing as the Newtonian force. Newtonian forces are deﬁned as positive if the force is to the right and negative if the force is to the left. Spring forces are positive if the spring is in extension and negative if the spring is in compression. Spring forces are deﬁned the way they are to enable the use of F = kx as the constitutive law, but Newtonian forces are deﬁned the way they are so that we can use PF = ma. That means we will have to convert between them when we are solving problems.

• Two springs with constants k1 and k2 are in series, the equivalent spring constant of a single spring is:
• Ideal dampers react instantaneously to a change in force, a jump in velocity will be seen when the force changes.

• The ODE that governs its time evolution for the following system is:

• Linear means that the dependence of a state velocity on a state is always a line.
• Constant coefficient means that the slope of that line is always constant.
• First order means that there is only one time derivative.

In MATLAB or Python, take the mean (average) of the numbers 1,2,3,4,5,6,7,8,9,,99,100 using a for loop:

=================================================
2. Euler Integration, Exponential Solutions, Superposition:
If we have a differential equation, how should we numerically approximate its solution?

The position of the spring, denoted by x, speciﬁcally depends on time—the position is allowed to change as a function of time. The right hand side of the differential equation as f(x(t)).  the derivative of x(t) with respect to t, which by deﬁnition is equal to:

(where := is the notation used to say that the left hand side is deﬁned to be the right hand side). This says that “the derivative of x is equal to the limit as dt goes to zero of x(t + dt) minus x(t) divided by dt”. So far I haven’t changed anything—this is still a differential equation and it is still equal to f(x(t)).
However, if I do not take the limit, and instead simply say that dt is some rather small number—
where, we get an expression that only approximates x˙ and is therefore approximately equal to f(x(t)).

If I rearrange this approximate equation, I get that x(t+dt)is approximately equal to x(t) plus dt
times f(x(t)).
This formula, called Euler integration, means that if we know x at some time t, we can approximate x at t+dt. This also means that you should expect to need to know x at some time in order to get the algorithm started. Euler integration is the easiest method for numerically approximating a solution to an ordinary differential equation, but there are certainly other options.

You will see in homework that sometimes Euler integration doesn't do a very good job, but if you make dt small enough, you will always end up approximating the limit in the deﬁnition of the time derivative well enough to give you a decent approximation of the solution to the ODE.

Example: To practically see how Euler integration works, let’s look at the spring/damper system again. Assume that we start out with x at time t = 0 equal to 0.5, k = 1, and b = 1, dt = 0.1. Then x(0) is, of course, equal to 0.5. What is x(0.1) approximately equal to? Well, using Euler. integration we know that x(0.1) is approximately equal to x(0) plus dt times "k/b.x(0). Once we know that, we can approximately x(0.2) by taking x(0.1) and adding dt times "k/b .x(0.1)to it.

We could continue this process for x(0.3), x(0.4), x(0.5), and so on.

Example in MATLAB:

Note that at the top of the code we declare the initial conditions to be x(0) = 0.5, that dt = 0.1, that k = 1 and b = 1. Then we create an array to store all the variables for all time. Then a loop executes Euler integration and stores the values in the array. After exiting the loop, we plot the results.

Euler integration provides a means to approximate  the solution to an ordinary differential equation and it doesn't matter whether the differential equation is linear or not!

Example: Let’s say that x˙ = -2x and x0 = 1. Moreover, let’s assume we are going to use a dt of 0.1. How can we approximate x(0.1)?

So x(0.1) is approximately 0.8.

Exponential Solutions:
Euler integration allows one to approximately solve a ordinary differential equation. What do we do if we have an ordinary differential equation that we want to solve exactly? For general f(x) in x˙ = f(x), we cannot expect an exact solution, but for linear, constant coefﬁcient, ﬁrst-order ODEs we can.

Having a good guess matters a lot, and for us that guess will always be the exponential solution

Where h is an unknown parameter.

This says that we expect a solution to an ordinary differential equation to be an exponential times the initial condition x0—which is x(t) at time t = 0 (which we assume to be the initial time). Notice that if h > 0, this solution will blow up and go to inﬁnity if x0 = 0. If h < 0, then it will go to zero. This observation is a good way to have some physical intuition about what the exponential function means and if it makes any sense. What does it mean to “solve” a differential equation, anyhow? It is helpful to think of x˙ as the time derivative:

x “solves” the differential equation if plugging it into the left hand side—that is, taking its time derivative—is the same as plugging it into the right hand side—that is, evaluating f at x(t) for all time.

Example: To see how this works, let’s assume that our spring-damper system has an exponential solution and plug into the differential equation to ﬁnd the value of h. If we plug into to both sides, we get:

Taking the derivative of the exponential drops the h down, and since we know that the exponential is never zero we can divide by both sides.

This means that h is equal to -k/b (assuming x0 = 0). So we know that the solution is:

If we now specify that k = 1, b = 1, x = 0.5 then we see that:

Note that this behavior is somewhat unintuitive. It says that if I extend the spring-damper system by 0.5 units, then I will see it move forever, which of course a real system will never do. This is largely because damping tends to be nonlinear at very low velocity—suggesting we can never fully believe our analytical models or computational models—but this solution

will capture the behavior of many spring-damper systems.

Above figure shows two simulations at dt = X and dt = Y as well as the analytical solution for x˙ = −x with an initial condition of 0.5.

We can now compare the results of the analytical solution to the results of Euler integration— an example is in figure above. At large dt the approximation to the solution is not very close to the analytical solution but at small dt it is. This means that you have to use your judgement when choosing the dt for your simulation.

Exponential solutions are valid for any linear, constant coefﬁcient ﬁrst-order differential equation where the external force is zero. An analytic solution exists for many engineered systems that you will encounter.

Example: Let’s ﬁnd the analytic solution of x˙ = 2x with x( 0) = 1, and use it to ﬁnd the exact value of x( 0.1). We know the solution is of the form of an exponential

where r and A are constants. Plugging into the differential equation, we get:

which implies that r = 2. Setting t = 0 implies that A = 1. So the solution is:

which implies that:

What Does The Word Linear Mean?

The word “linear” in “linear, constant coefﬁcient, ﬁrst-order ODEs” can cause a lot of confusion. In many respects, that is because the word “linear” has two primary uses. One use is descriptive— so that when we see an equation of a particular form, we know what to call it. The other use is based on properties that we might want.

At the following equations:

Here both x and y are variables, and the graph relating them is shown in this picture.

In both cases y is related to x through a constant of proportionality 1/2. Now, let’s assume that we have four choices of x values we are interested in—x1, x2 , x3, and x4. Each of these maps to a y value—y1, y2 , y3, and y4. Lastly, assume that we know that x3 = 2x1 and x4 = x1 + x2. What might we hope? It would be helpful if knowing y1 and y2 helped predict y3 and y4. Speciﬁcally, we might hope that y3 = 2y1 and y4 = y1 + y2. In general, this relationship does not hold, even for y = 1/2x + 1.

An equation with a mapping between y and x that satisﬁes both the scaling property and the additive property is linear. It happens that all equations of the form y = ax are linear in this sense, but other types of relationships are linear as well. However, relationships like y = 1/2x + 1 are not linear, because the 1 added to the equation makes the properties disappear (y = 1/2x + 1 is called linear afﬁne).
All of this may sound very academic when talking about a relationship between y and x, but if y and x are vectors, or curves, or—as in the next section—solutions to ODEs, suddenly scaling and additive properties can matter a lot, both in terms of conceptually understanding and concretely doing calculations.

Formally, that if y = g(x), then ay = g(ax). Formally, that if y1 = g(x1) and y2 = g(x2), then y1 + y2 = g(x1 + x2).

Superposition:

Why do we bother being so careful to design systems to have constitutive laws that are linear? It is a reasonable question, particularly considering that Euler integration allows us to approximate solutions to ordinary differential equations whether they are linear or not—as long as dt is small enough. Maybe having an exact, analytical solution isn't worth the trouble! The real value of linear constitutive laws comes from the fact that we get to use what is called the principle of superposition.

The key thing about linear constitutive laws and the resulting linear ODEs is that if I give you two solutions—regardless of how I obtained them—you can get a whole bunch of potential solutions from those two. We know that Euler integration requires having an initial condition to get started, but superposition allows us to solve for everything we need without worrying about the initial condition until the end, after we have done most of the calculations. This ends up being a really powerful idea.

Example: Starting with our favorite example, the spring-damper system, with k = 2 and b = 1.

let’s say we have two solutions, x1(t) and x2(t). How can we even have two solutions? Well, every initial condition gives us a different time evolution, so every initial conditions corresponds to a different solution to the differential equation. In this case, we might have x1(0) = 1 and x2(0) = −2. From this, using the fact that the solution for each initial condition is exponential, we can conclude that:

x1 is an exponential and x2 is an exponential.

Now let’s assume that alpha and beta are constants numbers that is, they are numbers like 1 or 1/2. we will even allow these numbers to be imaginary numbers. Then the principle of superposition tells us that if alpha and beta are numbers, and if x1(t) and x2(t) are both solutions to the same linear, constant coefﬁcient, ﬁrst order ordinary differential equation, then:

is a solution.

That means that if there are two solutions, you can generate a whole bunch of other solutions with them! Let’s say that x˙ = ax and we had two solutions x1(t) and x2(t) and deﬁned x(t) = ax1(t) + bx2(t). Then:

so x(t) really is a solution to the differential equation. We have the two solutions:

and if we add them together we get the sum of the two solutions. Now let’s check that these two solutions added together really are a solution to the differential equation. We do this by taking the resulting sum:

and substituting it into the differential equation:

and we ﬁnd that we still get that d/dt of x(t) is equal to −k/b times x(t), so x(t) = x1 + x2 is indeed  solution to the differential equation. We can do the same thing with x(t) = x1(t), where -k/b= 3 and ﬁnd that this also solves the differential equation. That is,

and we can take this and substitute it into the differential equation:

Remember that when you have a linear constitutive law, and the resulting linear, constant coefﬁcient ordinary differential equation, you get to use solutions you have already computed to ﬁnd new solutions. Why would you need to do this? You might have already calculated the solution for one initial condition, and then someone tells you that the original initial condition was wrong and you need to do it again for a new initial condition. If you can write the new initial condition as a function of adding and scaling initial conditions for which you have already computed solutions, superposition allows you to use those solutions for the new initial condition. For a simple system, you would probably just calculate the whole solution again, but as systems get more complex—if there were thousands or millions of spring-damper components all connected together—recomputing the solution might take a very long time.

What Does The Word Linear Mean for Ordinary Differential Equations?

Look, for a moment, at the following equations:

Here x(t) is a solution to the ODE. In both cases x˙ is related to x through a constant of proportionality 1/2. Now, let’s assume that for a particular initial condition x1 we have solved this ODE and obtained x1(t) that has x1( 0) = x1. Moreover, let’s assume we have done so for an initial condition x2 as well. What ifwe now have a new initial condition x3 = 2x1 or x4 = x1 + x2?

We would like the resulting solution to the ODE to be x3(t) = 2x1(t) and x4(t) = x1(t) + x2(t). This linearity property in the context of ODEs is exactly the property of superposition. Moreover, notice that it does not hold for x˙ = 1/2x+1, so in general we do not call x˙ = 1/2x+1 a linear differential equation. Instead, we call it a linear afﬁne ordinary differential equation.
===============================================
3. Newton’s Laws with Mass:

Today we are going to look at what happens when the mass at a point is nonzero. That is, we are going to look at:

F = m.a

where m = 0. Remember that here F are the forces acting on a point, always deﬁned to be positive if the force would cause a positive acceleration. The variable a is the acceleration—the second time derivative of the position of the point, deﬁned to be positive if the acceleration is to the right. The acceleration a is also the ﬁrst time derivative of the velocity vm of the point. Lastly, remember that vm of the mass is always assumed to be measured relative to what is called an inertial reference frame. In the case of the spring-mass-damper system the inertial reference frame is the wall—that is, we measure velocities with respect to the wall.

This diagram could represent a lot of things, like the shocks on a car or bicycle, or even the slinky I showed in lecture, where the bottom of the slinky is connected together so that we think of the bottom of the slinky as having a ﬁxed mass. If I hold the slinky horizontally, then the force due to gravity has no effect on the linear motion, but if I hold it vertically, then gravity introduces an external force on the system. The slinky is a good example to keep in mind because the model we choose to use really depends on what behavior we are trying to model; if the slinky oscillates with only one frequency of oscillation, the model that we get from just a spring, damper, and mass will do a good job. If, however, we create extra oscillations, like I did in lecture, we might have more trouble with such a simple model. Hence, your engineering judgment matters—you cannot just blindly write down a model and expect it to be valid.

Let’s look at a model of a mass with a spring and damper. The sum of the forces are equal to the mass times acceleration.

which is a linear, constant coefﬁcient, second-order ordinary differential equation in the position of the spring xs. We know that we need a ﬁrst-order ODE if we are going to use Euler integration and the analytic solutions, so we need to convert this system to a ﬁrst-order ODE.

To do so, it is helpful to note that the equation:

where now we have written d/dt in two different ways. The nice thing is that we can recognize x˙s as vm, so we are going to relabel x˙ s as v. Now we have the differential equation.

where x˙s = v comes from the relabeling we just did. This exercise of converting from a second-order differential equation to a ﬁrst-order differential equation is something you will do a lot as an engineer. It is worth practicing.
First, that Newton’s equations allow you to incorporate mass into a linear constant coefﬁcient ordinary differential equation; second, hopefully the slinky convinced you that when you have mass you should expect the possibility of oscillation; and third, that ODEs have to be converted into ﬁrst-order differential equations, which will mean increasing the number of differential equations.

Example: Consider the following mechanical diagram:

What does force balance say about this system? It says that the sum of the forces is equal to mass times acceleration, so we get:

where vm is the velocity of the mass. Note the negative signs in front of F1 and F2 , both of which are deﬁned to be positive whenever the spring is extension or the damper is extending; in the force balance equation these forces must have a negative sign in front of them since the force acting on the mass is to the left whenever F1 and F2 are positive.

Newton’s Laws with Several Masses:

Newton’s laws with mass lead to second-order ODEs that we convert into ﬁrst-order ODEs with multiple equations. What if we want to go backwards from a ﬁrst-order ODE with multiple equations to a second-order ODE? Using the same example as before, we have:

How do we model several masses? For instance, let’s say that we have a slinky, but with both the end and the middle bound so that it is like two masses. Let’s say we have a two mass and three spring system like the one seen in figure below. Newton’s laws tell us that the sum of forces at each mass must be equal to the mass times the acceleration of each mass, where acceleration is deﬁned to be positive if the mass is moving to the right and the velocity of each mass is measured relative to the left wall.

That is, we have an equation that is of the form d/dt(something) = f(something), but the something has four variables instead of just one. If we made a mistake and made a bad choice of state, we would not be able to get an ODE with these four variables as the state. As you might guess, if we had lots of masses we would end up with lots of equations and lots of states, which might make keeping track of things a bit unmanageable.

Newton’s laws will give you ODEs describing the time evolution of a system that has multiple masses, but the number of ﬁrst-order differential equations you get increases (or goes up) as the number of masses increases. Typically, you should expect to have two equations for every mass. Lastly, note that in the equation for the masses, the total distance between walls, L, is playing the role of an external force in the equation, and this is quite common any time there is a constraint between variables—in this case x1, x3, and x5.

Imaginary Numbers and Euler’s Formula:
Newton’s laws give us linear, constant-coefﬁcient, ﬁrst-order ODEs for systems with masses. We know that 1) we want to model mechanical systems using masses, springs, and dampers; and 2) real systems, like the slinky, oscillate. However,we would use exponential solutions for linear, constant-coefﬁcient, ﬁrst-order ODEs, so that should be true here as well. But how do we get an exponential function like e^ht to give us cos() and sin()? The answer is that we use the unfortunately named imaginary numbers. The idea is really simple and magical and very, very cool, and it all hinges on the Taylor series. We are going to Taylor expand e^ht and sin(wt) and cos(wt):

=======================================================