# Dice Problem, Part 1

I came across an interesting question on the “/r/learnmath” subreddit.  The poster describes two players, A and B, playing a game of dice. Each one has a die that has a specific side weighted. Each player rolls his die. If it lands on the weighted side, he gets the value of the side added to his score and rolls again. If it lands on any of the nonweighted sides, his turn is over. Whoever has the highest score wins. I found this question intriguing, and thought it would be a good opportunity for me to work on understanding infinite series, a weak area for me. Note that the original question states that if the first roll is a nonweighted side, the player gets that many points (instead of zero like on subsequent rolls). I’m going to ignore that rule and focus on the general pattern.

Problem: Each player has a die that is weighted on one side. He gets that many points and gets to roll again if it lands on the weighted side; if it lands on the unweighted side, his turn is over. More specifically, A’s weighted side is 3 and he has a 20% chance of rolling it; B’s weighted side is 2 and she has a 30% chance of rolling it. What is the chance that A will win (not tie)?

# Launch to Orbit, Part 3

In Part 2, I found the velocity required for circular orbit was

$\displaystyle v = \sqrt{\frac{GM}{r}},$

where G is the gravitational constant, M is the mass of the body being orbited, and r is the distance to the center of that mass. I tested this on the ISS’s orbit and found the velocity matched quite well. Now, I’m interested in looking at orbital periods, and calculating aspects of some common orbits.

Problem: Calculate the velocity and periods for some typical circular orbits.

# Launch to Orbit, Part 2

See Part 1, where I looked at how increasing horizontal launch velocities could lead to orbit. Now I want to explore this mathematically. In the Feynman Lectures on Physics, Vol. I, Ch. 7, Section 7–4 “Newton’s law of gravitation,” Feynman looks at the velocity required to achieve (circular) orbit. He looks at how far a projectile would fall in one second, and then looks at how fast it would have to be traveling horizontally to clear the surface and maintain the same altitude. I’d like to expand on his approach and see if I can find a general expression for the velocity.

Problem: Use the standard projectile motion equations to derive an expression for the velocity required to achieve circular orbit.

# Launch to Orbit, Part 1

As a way to understand orbital motion, I’ve seen the idea of “Newton’s cannonball,” illustrated below from Wikipedia:

In this thought experiment, a cannon at the top of a tall mountain fires a cannonball at increasing velocities, until eventually it moves so fast that it achieves orbit.

Problem: Model a projectile being launched into orbit in this manner, and visually explore the transition between falling to Earth and orbiting.

# Random Walk in One Dimension, Part 2

See Part 1. I’ve been exploring a random walk in one dimension, where on object moves either +1 or −1 at each step, at random. On average, it will end up back near where it started (distance = 0), but over time, the likely positions start to spread out. I previously graphed the outcome of 1000 trials for 2000 steps. Although I can see the trajectories start to spread out, I’d like to actually graph the distribution.

Problem: Graph the probability of an object ending up at different distances from the origin during a random walk.

# Random Walk in One Dimension, Part 1

As I continue reading the Feynman Lectures on Physics, I’m intrigued by the discussion of the random walk in Chapter 6: “Probability,” Section 6–3: “The random walk.” Feynman discusses a random walk in one dimension, where at each step an object moves one unit either forward or backward at random. In Figure 6–5, he draws a graph tracing the distance moved over 30 steps, for 3 trials. I remember seeing graphs like this in my textbooks when I was in school, studying them and trying to appreciate them. And I realize that now technology has advanced so much that I can explore these further on my home computer.

Problem: Graph a random walk in one dimension, following more trials over longer periods.

# Kinetic Energy and Conservation of Energy, Part 2

See Part 1, where I used conservation of energy of a projectile to determine the formula for kinetic energy, Kmv². The aim was to see if I could derive a more intuitive understanding of this formula — especially why it depends on the square of the velocity. With a constant force and therefore constant acceleration, velocity increases linearly, by the same amount per second, so why does kinetic energy increase at increasingly large rates? (I should specify that I am using the nonrelativistic formula, so we assume speeds much lower than the speed of light.)

Problem: Can I understand the kinetic energy formula, Kmv², in a more intuitive manner?

# Kinetic Energy and Conservation of Energy, Part 1

I’ve been wanting to systematically go through a physics text, refreshing my knowledge and filling in gaps. I found The Feynman Lectures on Physics, freely available online, based on lectures from the great physicist and physics popularizer, Richard Feynman. As I read Chapter 4: “Conservation of Energy,” I wonder if I can derive the formula for kinetic energy, the energy an object has due to its motion. My primary motivation is that while it is relatively easy for me to grasp why the gravitational potential energy is U=mgh (that is, weight times height), I have a much harder time intuitively understanding why the kinetic energy should be proportional to the velocity squared: Kmv².

Problem: Given the formula for gravitational potential energy, can I use the principle of conservation of energy (of a projectile) to derive the equation for its kinetic energy?

# Rocket Propulsion, Part 2

See Part 1, where I introduced the problem. Constant acceleration of an object (such as a spacecraft) produces a linearly increasing velocity and therefore a quadratically increasing kinetic energy (since EK = ½mv²). If it took a constant energy supply to produce the constant acceleration, there would seem to be a mismatch between the amount of energy consumed for propulsion and the amount of kinetic energy gained. Momentum must be conserved, so for the craft to increase velocity forward, it must eject some mass backward. I explored this using the case of a thruster that ejected a small amount of mass per second, and it turns out that while the kinetic energy of the craft increases quadratically, there is far more kinetic energy given to the expelled propellant, and the total kinetic energy appeared to increase linearly, at least in a spreadsheet that evaluated the first 60 seconds.

I would like to make this approach a little more rigorous. In particular, I assumed a drive that ejected a constant amount of mass each second, and looked at the behavior over the first minute. I am hoping that this approximates the continuous case, but I’ll want to verify this by using very small time intervals, if needed. And I also want to explore the behavior of the rocket over a much longer period of time. For this, I will need more than a spreadsheet — I will write a program in Python. Also, I assumed that the drive ejected the mass at a constant velocity relative to the craft. There is no guarantee that this will take the same amount of energy over time, since the mass of the craft changes. Let’s work it out more rigorously.

To make the math simpler, for each time interval, let’s choose a reference frame moving with the craft, so the initial velocity = 0. The craft will consume a certain amount of energy E to push apart the reaction mass and craft. Let’s assume that the drive is perfectly efficient and that all the energy consumed goes to increasing the kinetic energy of the objects. Let m1 be the mass of the craft (after the mass is ejected), and m2 be the reaction mass ejected. The final velocities will be v1 and v2, respectively. Momentum (p=mv) must be conserved, so the initial and final momentum must be the same:

$p_i = p_f$

$(m_1 + m_2) \cdot 0 = m_1 v_1 + m_2 v_2$

$m_1 v_1 + m_2 v_2 = 0$

Kinetic energy (EK = ½mv²) is not conserved; we are adding an amount of energy E each time interval.

$E_{Ki} + E = E_{Kf}$

$\frac{1}{2}(m_1 + m_2) \cdot 0^2 + E = \frac{1}{2}m_1 {v_1}^2 + \frac{1}{2}m_2 {v_2}^2$

$\frac{1}{2}m_1 {v_1}^2 + \frac{1}{2}m_2 {v_2}^2 = E$

I’m primarily interested in v1, the final velocity of the craft, so I’ll solve the momentum equation above for v2

$m_1 v_1 + m_2 v_2 = 0$

$m_2 v_2 = - m_1 v_1$

$v_2 = -\frac{m_1 v_1}{m_2}$

and substitute it into the kinetic energy equation:

$\frac{1}{2}m_1 {v_1}^2 + \frac{1}{2}m_2 {v_2}^2 = E$

$\frac{1}{2}m_1 {v_1}^2 + \frac{1}{2}m_2 (-\frac{m_1 v_1}{m_2})^2 = E$

$m_1 {v_1}^2 + m_2 (-\frac{m_1 v_1}{m_2})^2 = 2E$

$m_1 {v_1}^2 + \frac{m_2 {m_1}^2 {v_1}^2}{{m_2}^2} = 2E$

$m_1 {v_1}^2 + \frac{ {m_1}^2 {v_1}^2}{m_2} = 2E$

${v_1}^2 (m_1 + \frac{{m_1}^2}{m_2} ) = 2E$

${v_1}^2 (\frac{m_1 m_2}{m_2} + \frac{{m_1}^2}{m_2} ) = 2E$

${v_1}^2 (\frac{m_1 m_2 + {m_1}^2}{m_2} ) = 2E$

${v_1}^2 [\frac{m_1 (m_1+m_2)}{m_2}] = 2E$

${v_1}^2 = 2E \frac{m_2}{m_1 (m_1 + m_2) }$

$v_1 = \pm \sqrt{2E \frac{m_2}{m_1 (m_1 + m_2) }}$

I am specifying that the propellant is ejected in the negative direction (v2 < 0 ), so logically and by the momentum equation above, the craft will move in the positive direction (v1 > 0); therefore, we can discard the negative solution.

$v_1 = \sqrt{2E \frac{m_2}{m_1 (m_1 + m_2) }}$

This answer looks reasonable. Dividing energy by mass (m1), doubling, and taking the square root are just the inverses of the kinetic energy equation. The $\frac{m_2}{m_1 + m_2}$ is the fraction of the original mass that was ejected.

At last, I’m ready to code this into my program. The code will reevaluate the variables each timestep Δt. Given a predefined rate of propellant use (in mass/time), we know how much is used each interval: multiply the rate of propellant use by the timestep to get m2. We can subtract that from the ship’s prior mass to get its new mass, m1. We’ll use the velocity equation derived just above to derive its velocity increase (recall that I defined those equations in a reference frame where the craft was starting at rest), so we’ll add that to the craft’s prior velocity to get its new velocity. The energy E added each step is the predefined rate of energy production multiplied by the timestep.

Let’s use initial conditions similar to the example in the last post. I’ll start with a 1,000-kg craft. It will eject 1 g/s, and it will be powered by a 500-W drive (since in the last post, the kinetic energy increased by 5,000,005 mJ / 10 s = 5,000.005 J / 10 s = 500.0005 W). Running the simulation for 60 seconds yields a velocity of 0.0600 m/s and a kinetic energy of 1.80 J, just as in the prior example. The approach seems sound. Let’s run it for longer. I’ll say that 10% of the mass of the craft is propellant. Let’s see what happens:

The drive will work for 100,000 s (which makes sense since we eject 1 g/s, and we started with a reaction mass of 100,000 g — 10% of 1,000,000 g), or 27.8 h. It will reach a velocity of 105 m/s (235 mph, 378 km/h). The acceleration looks constant. Is it? I’ll add in a line in the program to calculate the acceleration, by taking the new velocity minus the old velocity, and dividing by the timestep: a = (vfvi) / Δt.

Interesting. I actually thought the acceleration would be roughly constant over this period. It starts off with an acceleration of 1.00×10−3 m/s², and ends with an acceleration of 1.11×10−3 m/s². I assume that this rate of increase is because the craft is 10% lighter by the end, so a constant thrust will accelerate it more. We can calculate the force by taking the acceleration and multiplying by the mass at that time (F=m1a).

Well, it certainly looks constant. That matches what I’ve read about ion thrusters. It starts and ends at 1.00 N of thrust. That means that the increasing acceleration is due to the progressive lightening of the craft. Our 500-W drive is able to produce 1 N of thrust when ejecting 1 g/s. That’s interesting. I wonder how it depends on the parameters (it doesn’t seem to depend much on the mass of the ship), and if we can derive a mathematical relationship — I’ll investigate that later. Finally, let’s explore the issue that sparked my interest in this problem in the first place, the kinetic energy. It just takes another line of code to calculate the kinetic energy as EK = ½m1v1²

As expected, it looks parabolic. Of course, the velocity is not increasing linearly, as we know the acceleration is actually increasing over time. But the mass is decreasing, too.  It reaches a kinetic energy of 5.00 MJ (5.00×106 J). We already know that this must only be a small portion of the total kinetic energy. Let’s find the kinetic energy of the propellant. This is slightly more complex to code, since each at each time step we need to add in the (unchanging) kinetic energy of the new bit of propellant that’s been ejected, rather than looking at the changing velocity and mass of the craft at that instant. And I’ll track the sum of the two kinetic energies as well.

I notice several interesting things about this graph. As expected, the kinetic energy of the exhaust is much more than the kinetic energy of the spacecraft (note the 10-fold increase in scale from the previous graph). The total kinetic energy does appear to be increasing linearly: the kinetic energy of the exhaust ends at 4.50×107 J, and after adding in the 0.500×107 J of spacecraft kinetic energy, we get a total of 5.00×107 J. In a way, this is a relief, because we’ve run our 500-W power source for 1.00×105 s, and multiplying the two gives 5.00×107 J. This gives me some confidence that the coding is correct. I also note that the kinetic energy of the exhaust increases, but that rate of increase slows over time (it curves away from the total line). Of course, this is to be expected, because the spacecraft’s kinetic energy is increasing at an increasing rate (and there is a fixed amount of total energy), but I’m still interested in understanding why this is happening. Let’s look at the exhaust velocity (v2 in our derivation above).

The exhaust velocity starts and ends at -1000 m/s (for graphing purposes, I flipped the sign to make it positive). This is also a relief, because our engine power was based on the earlier model which used a  craft that ejected propellant at -1000 m/s. If the exhaust velocity is constant, and we’re ejecting a constant amount of mass each second, why is the rate of kinetic energy dropping off? It’s because the constant exhaust velocity is relative to the spacecraft. But the velocity is less, relative to our rest observational frame. To begin with, if the craft is motionless and ejecting propellant at -1000 m/s, we’ll also measure that velocity. But if the craft were moving at, say, 10 m/s, then the propellant would be ejected at -990 m/s relative to us. It would have less kinetic energy than the propellant that was previously ejected. (From the observer’s point of view, the propellant had been moving forward at 10 m/s, so even though it was pushed out with the same energy, it didn’t achieve as high a speed moving backward.)

If the spacecraft’s kinetic energy were truly parabolic, it would eventually cross any arbitrary line, including the line of total kinetic energy. Since this presumably can’t happen, I’ll want to explore what actually does occur — in the next post.

# Rocket Propulsion, Part 1

The kinetic energy of an object (the energy it has due to its motion) is equal to ½mv2; that is, half the product of its mass and the square of its velocity. But a question I saw recently pointed out some interesting consequences of this, especially in regards to travel in space.

We often think about constant forces accelerating objects. If the force is constant, so is the acceleration (by F=ma). And if the acceleration is constant, then the velocity increases at a constant rate. It would seem that it would take a constant supply of energy to supply a constant force (that is, the total energy used would increase linearly). But the kinetic energy of the object would increase quadratically. If it took x amount of energy to increase the velocity by a certain amount, it would take 4x to double that and 9x to triple that. Where is this extra energy coming from?

Let’s construct a scenario and put in some test numbers. I’m going to stick to velocities well below the speed of light and analyze the situation according to classical mechanics, not taking relativity into account. We’ll start with summarizing the basic physics involved. If you’re already familiar with the basics of momentum, feel free to skip ahead.

Of course, forces can’t be applied arbitrarily. There has to be a source. Even if a craft has plenty of power, conservation of momentum affects how it can move. Recall that (linear) momentum is the product of mass and velocity (p = mv); each object has a momentum. The sum of the momenta of a closed system (m1v1 + m2v2 + m3v3 + …) is conserved and cannot change; the total momentum of all the objects in the system before an event must be equal to the total momentum afterwards. For an isolated spacecraft, mivimfvf. If a spacecraft is initially at rest, then vi = 0 and so momentum p = 0. If it is to start moving with a positive velocity vf, then it will have a positive momentum mvf. Of course, 0≠mvf. (Or even if it’s not at rest, in order to accelerate, the velocity on the right will be higher than on the left, and therefore, so will the momentum). We either need to add a positive mv term to the left side of the equation or a negative mv term to the right (and since mass is positive, it will have to be an object with positive velocity before or with negative velocity after).

A positive term on the left would represent a second object with positive velocity, flying toward the spacecraft. This could be a laser beam on Earth fired towards the craft, particles from the solar wind pushing a solar sail, and so on. However, it’s not the type of propulsion we are looking for, since it has to be produced by an external source and can only push the craft away from the source.

The other way for momentum to be conserved is to add a negative mv term on the right side of the equation. That is, something must be pushed backwards. On Earth, this could be air (for an airplane), or the Earth itself (for a car, or for people walking). In the near vacuum of space, there is not much to push against, and so any mass pushed backward must come from the spacecraft itself. This is called reaction mass. Let’s designate the craft mass 1, and the propellant mass 2. The momentum equation would thus be (m1 + m2)vim1v1f + m2v2f.

In this example, the questioner suggested the object be a spacecraft with an ion thruster, which uses an electric field to accelerate ions out the rear of the craft, pushing the craft forward. These use only small amounts of mass, and generate a roughly constant thrust. This sounds perfect for our initial exploration, since we’ll get a constant force and acceleration and the mass of the craft shouldn’t change significantly.

Finally, it’s time to put in some test numbers. We’ll start with a spacecraft mass of 1000 kg to start — of course, it will get lighter over time. It will start at rest. Let’s assume it can eject 1 g (=0.001 kg) of mass each second at -1000 m/s. To make it easier, we’ll break this down into 1-second intervals. At t=0, the craft is 1000 kg and is moving at 0 m/s. After the first second, it ejects 1 g of mass at -1000 m/s. This is a momentum of -1 kg·m/s. The craft now still has a mass of 1000 kg (technically 999.999 kg), and since the initial momentum was 0, it must have a momentum of 1 kg·m/s. Dividing by the new mass gives a velocity of 0.001 m/s, and a kinetic energy of 0.0005 J = 0.500 mJ.

We’ll use the momentum equation from above. We know the mass of the craft and the propellant, and the initial velocity. The propellant velocity vpf (the propellant velocity) is vi – 1000 (starting at the velocity of the craft, and being ejected at a relative -1000 m/s). If mc is the mass of the craft, mp is the mass of the propellant, and mc’ = mcmp is the new mass of the craft, then

$m_c v_i = m_{c^\prime}v_f + m_p v_{pf}$

$m_c v_i - m_p v_{pf} = m_{c^\prime} v_f$

$\frac{m_c v_i - m_p v_{pf}}{m_{c^\prime}} = v_f$

Or put simply, we need to find the initial momentum, subtract the final momentum of the propellant to get the final momentum of the craft, and divide by the new mass to find the final velocity (at each step).

Continuing in this fashion, at t = 2, the mass is down to 999.998 kg, velocity is 0.002 m/s, and kinetic energy is 2.00 mJ. Let’s look at the first minute:

Time / s Mass / kg Velocity / (m/s) Acceleration / (m/s²) Kinetic energy / mJ
0 1000 0 0 0
10 1000 0.0100 0.00100 50
20 1000 0.0200 0.00100 200
30 1000 0.0300 0.00100 450
40 1000 0.0400 0.00100 800
50 1000 0.0500 0.00100 1250
60 1000 0.0600 0.00100 1800

Over this minute, we can see that the craft stays roughly the same mass (it drops to 999.94 kg) and has roughly constant acceleration (it actually increases from 0.001000000 to 0.00100006 m/s²). But the kinetic energy is going up quadratically, as one would expect with constant acceleration and subsequent linearly increasing velocity. What are we missing? Of course, we’ve ignored the propellant that’s been ejected. It may have very low mass compared to the craft, but it has proportionally high velocity, and remember that kinetic energy is ½mv2. In that first second when the 1,000,000-g craft reached 0.001 m/s and a kinetic energy of 0.500 mJ, we ejected 1 g of reaction mass at -1000 m/s. With this high velocity, this mass has a kinetic energy of 500,000 mJ! That is one million times the kinetic energy of the craft. The combined kinetic energy is 500,000.5 mJ. Let’s look at what happens over the first minute, remembering that we have to add up the kinetic energy of each block of mass that’s been ejected up to that point.

Time / s Kinetic energy / mJ
Spacecraft Propellant Total
0 0 0 0
10 50 4,999,955 5,000,005
20 200 9,999,810 10,000,010
30 450 14,999,565 15,000,015
40 800 19,999,220 20,000,020
50 1250 24,998,775 25,000,025
60 1800 29,998,230 30,000,030

This, then, is the resolution to the paradox. The vast majority of the kinetic energy goes to the propellant, not to the spacecraft. The spacecraft does accelerate and its kinetic energy does go up quadratically, but it is only a tiny fraction of the total kinetic energy (which in this example, goes up by 5,000,005 mJ every 10 seconds).

Of course, we used a model where the amount of mass ejected was very small relative to the craft. What will happen over longer periods, or if we use more mass? Any quadratically increasing function will eventually pass a linear one. In order to explore these issues, we’ll have to make our model a bit more rigorous (in particular, we have to clarify how our drive works). I’ll look at these in the next post.