Paths of a projectile.

I had my Numerical Methods student calculate the angle that would give a ballistic projectile its maximum range, then I had them write a program that did the the same by just trying a bunch of different angles. The diagram above is what they came up with.

It made an interesting pattern that I converted into a face-plate cover for a light switch that I made using the laser at the TechShop.

Face plate cover.

**Citing this post**: **Urbano**, L., 2017. Projectile Paths, Retrieved February 23rd, 2017, from *Montessori Muddle*: http://MontessoriMuddle.org/ .

**Attribution (Curator's Code )**: Via: ᔥ Montessori Muddle; Hat tip: ↬ Montessori Muddle.

Posted in Physics, ProgrammingNo Comments » - Tags: ballistics, math, numerical methods, programming, TechShop

We’ve started working on the physics of motion in my programming class, and really it boils down to solving differential equations using numerical methods. Since the class has a calculus co-requisite I thought a good way to approach teaching this would be to first have the solve the basic equations for motion (velocity and acceleration) analytically–using calculus–before we took the numerical approach.

## Constant velocity

**Question 1**. A ball starts at the origin and moves horizontally at a speed of 0.5 m/s. Print out a table of the ball’s position (in *x*) with time (*t*) (every second) for the first 20 seconds.

**Analytical Solution:**

Well, we know that *speed * is the change in position (in the x direction in this case) with time, so a constant velocity of 0.5 m/s can be written as the **differential equation**:

To get the ball’s position at a given time we need to integrate this differential equation. It turns out that my calculus students had not gotten to integration yet. So I gave them the 5 minute version, which they were able to pick up pretty quickly since integration’s just the reverse of differentiation, and we were able to move on.

Integrating gives:

which includes a constant of integration (*c*). This is the **general solution** to the differential equation. It’s called the general solution because we still can’t use it since we don’t know what *c* is. We need to find the **specific solution** for this particular problem.

In order to find *c * we need to know the actual position of the ball is at one point in time. Fortunately, the problem states that the ball starts at the origin where *x=0* so we know that:

So we plug these values into the general solution to get:

solving for *c* gives:

Therefore our *specific solution* is simply:

And we can write a simple python program to print out the position of the ball every second for 20 seconds:

*motion-01-analytic.py*

for t in range(21):
x = 0.5 * t
print t, x

which gives the result:

>>>
0 0.0
1 0.5
2 1.0
3 1.5
4 2.0
5 2.5
6 3.0
7 3.5
8 4.0
9 4.5
10 5.0
11 5.5
12 6.0
13 6.5
14 7.0
15 7.5
16 8.0
17 8.5
18 9.0
19 9.5
20 10.0

**Numerical Solution:**

Finding the numerical solution to the differential equation involves not integrating, which is particularly good if the differential equation can’t be integrated.

We start with the same differential equation for velocity:

but instead of trying to solve it we’ll just approximate a solution by recognizing that we use *dx/dy* to represent when the change in x and t are really, really small. If we were to assume they weren’t infinitesimally small we would rewrite the equations using deltas instead of d’s:

now we can manipulate this equation using algebra to show that:

so the change in the position at any given moment is just the velocity (0.5 m/s) times the **timestep**. Therefore, to keep track of the position of the ball we need to just add the change in position to the old position of the ball:

Now we can write a program to calculate the position of the ball using this numerical approximation.

*motion-01-numeric.py*

from visual import *
# Initialize
x = 0.0
dt = 1.0
# Time loop
for t in arange(dt, 21, dt):
v = 0.5
dx = v * dt
x = x + dx
print t, x

I’m sure you’ve noticed a couple inefficiencies in this program. Primarily, that the velocity *v*, which is a constant, is set inside the loop, which just means it’s reset to the same value every time the loop loops. However, I’m putting it in there because when we get working on acceleration the velocity will change with time.

I also import the visual library (vpython.org) because it imports the numpy library and we’ll be creating and moving 3d balls in a little bit as well.

Finally, the two statements for calculating *dx* and *x* could easily be combined into one. I’m only keeping them separate to be consistent with the math described above.

**A Program with both Analytical and Numerical Solutions**

For constant velocity problems the numerical approach gives the same results as the analytical solution, but that’s most definitely not going to be the case in the future, so to compare the two results more easily we can combine the two programs into one:

*motion-01.py*

from visual import *
# Initialize
x = 0.0
dt = 1.0
# Time loop
for t in arange(dt, 21, dt):
v = 0.5
# Analytical solution
x_a = v * t
# Numerical solution
dx = v * dt
x = x + dx
# Output
print t, x_a, x

which outputs:

>>>
1.0 0.5 0.5
2.0 1.0 1.0
3.0 1.5 1.5
4.0 2.0 2.0
5.0 2.5 2.5
6.0 3.0 3.0
7.0 3.5 3.5
8.0 4.0 4.0
9.0 4.5 4.5
10.0 5.0 5.0
11.0 5.5 5.5
12.0 6.0 6.0
13.0 6.5 6.5
14.0 7.0 7.0
15.0 7.5 7.5
16.0 8.0 8.0
17.0 8.5 8.5
18.0 9.0 9.0
19.0 9.5 9.5
20.0 10.0 10.0

Solving a problem involving acceleration comes next.

**Citing this post**: **Urbano**, L., 2016. Numerical versus Analytical Solutions, Retrieved February 23rd, 2017, from *Montessori Muddle*: http://MontessoriMuddle.org/ .

**Attribution (Curator's Code )**: Via: ᔥ Montessori Muddle; Hat tip: ↬ Montessori Muddle.

Posted in Calculus, Mathematics, Physics, ProgrammingNo Comments » - Tags: calculus, differential equations, motion, numerical methods, programming

“If I were to convert all of my body, my mass to energy, how much could I blow up?”

The Nukemap website tries to help answer that question.

From the Nukemap website.

However, if we use the equation E = mc^{2}, we can convert a 50 kg student into the explosive energy of the equivalent of 1,000,000 kilotons of TNT, which the newer website can’t quite handle.

**Citing this post**: **Urbano**, L., 2016. Nukemap, Retrieved February 23rd, 2017, from *Montessori Muddle*: http://MontessoriMuddle.org/ .

**Attribution (Curator's Code )**: Via: ᔥ Montessori Muddle; Hat tip: ↬ Montessori Muddle.

Posted in PhysicsNo Comments » - Tags: modern physics, physics

An excellent overview of the multitude of active theories and hypotheses–like quantum gravity, string theory–physicists are investigating to try to explain the universe.

From Theories on Everything Mapped

In the quest for a unified, coherent description of all of nature — a “theory of everything” — physicists have unearthed the taproots linking ever more disparate phenomena. With the law of universal gravitation, Isaac Newton wedded the fall of an apple to the orbits of the planets. Albert Einstein, in his theory of relativity, wove space and time into a single fabric, and showed how apples and planets fall along the fabric’s curves. And today, all known elementary particles plug neatly into a mathematical structure called the Standard Model. But our physical theories remain riddled with disunions, holes and inconsistencies. These are the deep questions that must be answered in pursuit of the theory of everything.

–Natalie Wolchover in Theories of Everything Mapped on Quanta Magazine.

**Citing this post**: **Urbano**, L., 2016. Physics: Theories of Everything (Mapped), Retrieved February 23rd, 2017, from *Montessori Muddle*: http://MontessoriMuddle.org/ .

**Attribution (Curator's Code )**: Via: ᔥ Montessori Muddle; Hat tip: ↬ Montessori Muddle.

Posted in PhysicsNo Comments » - Tags: interactive websites, modern physics, physics

Studying voltage and current in circuits can start with two laws of conservation.

**KCL: Current flow into a node must equal the flow out of the node. ** (A node is a point on the wire connecting components in a circuit–usually a junction).

(KCL: Kirchoff’s Current Law) Current flowing into any point on a circuit is equal to the current flowing out of it, A simple circuit with a voltage source (like a battery) and a resistor.

**
**
- KVC: The sum of all the voltage differences in a closed loop is zero.

KVL: The voltage difference across the battery (9 Volts) plus the voltage difference across the resistor (-9 Volts) is equal to zero.

Things get more interesting when we get away from simple circuits.

Current flow into a node (10 A) equals the flow out of the node (7 A + 3 A).

Note that the convention for drawing diagrams is that the current move from positive (+) to negative (-) terminals in a battery. This is opposite the actual flow of electrons in a typical wired circuit because the current is a measure of the movement of negatively charged electrons, but is used for historical reasons.

Based on the MIT OpenCourseWare Introduction to Electrical Engineering and Computer Science I **Circuits **6.01SC Introduction to Electrical Engineering and Computer Science Spring 2011.

**Citing this post**: **Urbano**, L., 2015. Circuit Basics, Retrieved February 23rd, 2017, from *Montessori Muddle*: http://MontessoriMuddle.org/ .

**Attribution (Curator's Code )**: Via: ᔥ Montessori Muddle; Hat tip: ↬ Montessori Muddle.

Posted in PhysicsNo Comments » - Tags: circuits, conservation, electricity, physics