# An Equation for Happiness

#### August 8, 2014

An interesting article by some researchers from the University College in London describes the equation they constructed and tested that predicts happiness.

A key part of the equation is that it relates happiness to the difference between people’s expectations of rewards and the actual rewards.

… we show that emotional reactivity in the form of momentary happiness in response to outcomes of a probabilistic reward task is explained not by current task earnings, but by the combined influence of recent reward expectations and prediction errors arising from those expectations.

— Rutledge et al., 2014. A computational and neural model of momentary
subjective well-being
, in PNAS Early Edition.

Citing this post: Urbano, L., 2014. An Equation for Happiness, Retrieved May 29th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# The Math of Music

#### June 10, 2014

Mark French has an excellent YouTube channel on Mechanical Engineering, including the above video on Math and Music. The video describes the mathematical relationships between musical notes.

Given the sequence of notes: C, C#, D, D#, E, F, F#, G, G#, A, A#, B, C.

Let the frequency of the C note be f0, the frequency of C# be f1 etc.

The ratio of any two successive frequencies is constant (r). For example:

$\frac{f_1}{f_0} = r$

so:

$\frac{f_1}{f_0} = \frac{f_2}{f_1} = \frac{f_4}{f_3} = \frac{f_{12}}{f_{11}} = r$

We can find the ratio of the first and third notes by combining the first two ratios. First solve for f1 in the first equation:

$\frac{f_1}{f_0} = r$

solving for f1,

$f_1 = f_0 \; r$

now take the second ratio:

$\frac{f_2}{f_1} = r$

and substitute for f1,

$\frac{f_2}{f_0 \; r} = r$

which gives:

$\frac{f_2}{f_0} = r^2$

We can now generalize to get the formula:

$\frac{f_n}{f_0} = r^n$

or

$f_n = f_0 \; r^n$

where,

• n – is the number of the note

From this we can see that comparing the ratio of the first and last notes (f12/f0) is:

$\frac{f_{12}}{f_0} = r^{12}$

Now, as we’ve seen before, when we talked about octaves, the frequency of the same note in two different octaves is a factor of two times the lower octave note.

Click the waves to hear the different octaves. The wavelengths of the sounds are shown (in meters).

So, the frequency ratio between the first C (f0) and the second C (f12) is 2:

$\frac{f_{12}}{f_0} = 2$

therefore:

$\frac{f_{12}}{f_0} = 2 = r^{12}$

so we can now find r:

$r^{12} = 2$

$r = \sqrt[12]{2}$

Finally, we can now find the frequency of all the notes if we know that the international standard for the note A4 is 440 Hz.

Mark French has details on the math in his two books: Engineering the Guitar which is algebra based, and Technology of the Guitar, which is calculus based.

Citing this post: Urbano, L., 2014. The Math of Music, Retrieved May 29th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# Parabolic Trajectories

#### February 7, 2014

The post below was contributed by Michael Schmidt, our math teacher.

Layered image showing the ballistic path of the green ball thrown by two middle school students. Image by Michael Schmidt.

Parabolas can be a daunting new subject for some students. Often students are not aware of why a parabola may be useful. Luckily, nature always has an answer. Most children realize that a ball thrown through the air will fallow a particular arch but few have made the connected this arch to a parabola. Wonderfully, with a little technology this connection can be made.

With Ms. Hahn’s Canon SLR, I had some of my students throw a ball around outside and took a series of quick pictures of the ball in flight. Since my hand is not very steady, I took the pictures and used the Hugin’s image_stack_align program to align each photo so I could stack them in GIMP.

Within GIMP, I layered the photos on top of each other and cut out the ball from each layer then composed those onto one image. Careful not to move the ball since our later analysis will be less accurate. The result will look something like the following:

Now that there is an image for student to see, we can determine the ball’s height at each point using their own height as a reference. We can then use this information to model a parabola to the data with a site like: http://www.arachnoid.com/polysolve/ .

For the more advanced student an investigation of the least-squares algorithm used by the site may be done.

Now, once we have an expression for the parabola, students can compare how fast they sent the ball into the air.

Citing this post: Schmidt, M., 2014. Parabolic Trajectories, Retrieved May 29th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# Analyzing the Motion of Soccer Ball using a Camera and Calculus

#### March 13, 2013

Animation showing the motion of the ballistic motion of a soccer ball.

If you throw a soccer ball up into the air and take a quick series of photographs you can capture the motion of the ball over time. The height of the ball can be measured off the photographs, which can then be used for some interesting physics and mathematics analysis. This assignment focuses on the analysis. It starts with the height of the ball and the time between each photograph already measured (Figure 1 and Table 1).

Figure 1. Height of a thrown ball, measured off a series of photographs. The photographs have been overlaid to create this image of multiple balls.

Table 1: Height of a thrown soccer ball over a period of approximately 2.5 seconds. This data were taken from a previous experiment on projectile motion.

Photo Time (s) Measured Height (m)
P0 0 1.25
P1 0.436396062 6.526305882
P2 0.849230104 9.825317647
P3 1.262064145 11.40310588
P4 1.674898187 11.30748235
P5 2.087732229 9.657976471
P6 2.50056627 6.191623529

# Assignment

1. Pre-Algebra: Draw a graph showing the height of the ball (y-axis) versus time (x-axis).
2. Algebra/Pre-calculus: Determine the equation that describes the height of the ball over time: h(t). Plot it on a graph.
3. Calculus: Determine the equation that shows how the velocity of the ball changes over time: v(t).
4. Calculus: Determine the equation that shows how the acceleration of the ball changes with time: a(t)
5. Physics: What does this all mean?

Citing this post: Urbano, L., 2013. Analyzing the Motion of Soccer Ball using a Camera and Calculus, Retrieved May 29th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# Learning Matricies by Programming a Matrix Solver

#### May 14, 2012

One of my pre-Calculus students convinced me that the best way for him to learn how to work with matrices was for him to program a matrix solver. I helped him create a Gaussian Elimination solver in Python (which we’ve been using since last year).

Gaussian Elimination Matrix Solver by Alex Shine (comments by me).

from visual import *

'''The coefficient matrix (m) can be any sized square matrix
with an additional column for the solution'''
m = [ [1,-2,1,-4],[0,1,2,4],[2,3,-2,2]]

'''Convert the input matrix, m (which is a list) into an array'''
a = array(m,float)
print "Input matrix:"
print a
print

'''Get the shape of the matrix (number of rows and columns)'''
(r,c) = a.shape

rs = (1-r)

'''Solve'''
for j in range(r):

print "Column #:", j
for i in range(r):
if a[i,j] <> 0:
a[i,:] = a[i,:] / a[i,j]
print a
print

for i in range(rs+j,j):
if a[i,j] <> 0:
a[i,:] = a[j,:] - a[i,:]
print a
print

print "Solution"
for i in range (r):
a[i,:] = a[i,:] / a[i,i]
print "Variable", i, "=", a[i,-1]

print
print "Solution Matrix:"
print a


The code above solves the following system of equations:


x - 2y +  z = -4
y + 2z =  4
2x + 3y - 2z =  2



Which can be written in matrix form as such:

$\left[ \begin{array}{ccc}1 & -2 & 1 \\0 & 1 & 2 \\2 & 3 & -2 \end{array} \right] \left[ \begin{array}{c}x \\y \\z \end{array} \right] = \left[ \begin{array}{c}-4 \\4 \\2 \end{array} \right]$

You use the solver by taking the square matrix on the left hand side of the equation and combining it with the column on the hand side as an additional column:

$\left[ \begin{array}{cccc}1 & -2 & 1 & -4 \\0 & 1 & 2 & 4\\2 & 3 & -2 & 2\end{array} \right]$

This is entered into the program as the line:

m = [ [1,-2,1,-4],[0,1,2,4],[2,3,-2,2]]


When you run the above program you should get the results:

>>> ================================ RESTART ================================
>>>
Input matrix:
[[ 1. -2.  1. -4.]
[ 0.  1.  2.  4.]
[ 2.  3. -2.  2.]]

Column #: 0
[[ 1.  -2.   1.  -4. ]
[ 0.   1.   2.   4. ]
[ 1.   1.5 -1.   1. ]]

[[ 1.  -2.   1.  -4. ]
[ 0.   1.   2.   4. ]
[ 0.  -3.5  2.  -5. ]]

Column #: 1
[[-0.5         1.         -0.5         2.        ]
[ 0.          1.          2.          4.        ]
[-0.          1.         -0.57142857  1.42857143]]

[[ 0.5         0.          2.5         2.        ]
[ 0.          1.          2.          4.        ]
[ 0.          0.          2.57142857  2.57142857]]

Column #: 2
[[ 0.2  0.   1.   0.8]
[ 0.   0.5  1.   2. ]
[ 0.   0.   1.   1. ]]

[[-0.2  0.   0.   0.2]
[ 0.  -0.5  0.  -1. ]
[ 0.   0.   1.   1. ]]

Solution
Variable 0 = -1.0
Variable 1 = 2.0
Variable 2 = 1.0

Solution Matrix:
[[ 1. -0. -0. -1.]
[-0.  1. -0.  2.]
[ 0.  0.  1.  1.]]
>>>


Be aware that:

• The code is designed to take any size of matrix.
• The matrix you put in can not have any zeros on its diagonal, so some manipulation is often necessary before you can use the code.

Other notes:

• The negative zeros (-0) that show up especially in the solution matrix may not look pretty but do not affect the solution.
• The code imports the vpython module in the first line but what it really needs is the numpy module, which vpython imports, for the arrays.

The next step is to turn this into a function or a class that can be used in other codes, but it’s already proved useful. My calculus students compared their solutions for the coefficients of a quadratic equation that they had to solve for their carpet friction experiment, which was great because their first answers were wrong.

A calculus student uses the matrix solver. Mr. Shine is now trying to convert the solver into an iPhone app.

Citing this post: Urbano, L., 2012. Learning Matricies by Programming a Matrix Solver, Retrieved May 29th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# Draining a Bottle Part 2: Linearizing Equations when you have to

#### May 3, 2012

Yesterday we used calculus to find the equation for the height of water in a large plastic water bottle as the water drained out of a small hole in the bottom.

Perhaps the most crucial point in the procedure was fitting a curve to the measured reduction of the water’s outflow rate over time. Yesterday, in our initial attempt, we used a straight line for the curve, which produced a very good fit.

Figure 1. The change in the outflow rate over time can be well approximated by a straight line.

The R2 value is a measure of how good a fit the data is to the trendline. The straight line gives an R2 value of 0.9854, which is very close to a perfect fit of 1.0 (the lowest R2 can go is 0.0).

The resulting equation, written in terms of the outflow rate (dV/dt) and time (t), was:

$\frac{dV}{dt} = -0.0035 t + 3.9113$

However, if you look carefully at the graph in Figure 1, the last few data points suggest that the outflow does not just linearly decrease to zero, but approaches zero asymptotically. As a result, a different type of curve might be a better trendline.

# Types of Equations

So my calculus students and I, with a little help from the pre-Calculus class, tried to figure out what types of curves might work. There are quite a few, but we settled for looking at three: a logarithmic function, a reciprocal function, and a square root function. These are shown in Figure 2.

Figure 2. Example curves that might better describe the relationship between outflow and time.

I steered them toward the square root function because then we’d end up with something akin to Torricelli’s Law (which can be derived from the physics). A basic square root function for outflow would look something like this:

$\frac{dV}{dt} = a \sqrt{t} + b$

the a coefficient stretches the equation out, while the b coefficient moves the curve up and down.

# Fitting the Curve

Having decided on a square-root type function, the next problem was trying to find the actual equation. Previously, we used Excel to find the best fit straight line. However, while Excel can fit log, exponential and power curves, there’s no option for fitting a square-root function to a graph.

To get around this we linearized the square-root function. The equation, after all, looks a lot like the equation of a straight line already, the only difference is the square root of t, so let’s substitute in:

$x = \sqrt{t}$

to get:

$\frac{dV}{dt} = a x + b$

Now we can get Excel to fit a straight line to our data, but we have to plot the square-root of time versus temperature instead of the just time versus temperature. So we take the square root of all of our time measurements:

Time Square root of time Outflow rate
t (s) t1/2 = x (s1/2) dV/dt (ml/s)
0.0 0 3.91
45.5 6.75 3.52
97.8 9.89 2.94
140.9 11.87 3.52
197 14.04 3.21
257 16.05 3.01
315.1 17.75 2.81
380.1 19.50 2.53
452.9 21.28 2.23
529.6 23.01 1.92
620.7 24.91 1.69
742.7 27.25 1.45

We can now plot the outflow rate versus the square root of time (Figure 3).

Figure 3. Linear trend relating the outflow rate to the square root of time. The regression coefficient (R2) of 0.9948 is better than the simply linear trend of outlfow rate versus time (which was 0.9854).

The equation Excel gives (Figure 3), is:

$\frac{dV}{dt} = -0.1395 x + 5.21$

and we can substitute back in for x=t1/2 to get:

$\frac{dV}{dt} = -0.1395 \sqrt{t} + 5.21$

# Getting back to the Equation for Height

Now we can do the same procedure we did before to find the equation for height.

First we substitute in V=πr2h:

$\frac{d(\pi r^2 h}{dt} = -0.1395 \sqrt{t} + 5.21$

Factor out the πr2 and move it to the other side of the equation to solve for the rate of change of height:

$\frac{dh}{dt} = \frac{-0.1395}{\pi r^2} \sqrt{t} + \frac{5.21}{\pi r^2}$

Then integrate to find h(t) (remember$\sqrt{t} = t^{1/2}$) :

$\int \frac{dh}{dt} dt = \int \left( \frac{-0.1395}{\pi r^2} t^{1/2} + \frac{5.21}{\pi r^2} \right) dt$

gives:

$h = \frac{-0.1395}{(3/2) \pi r^2} t^{3/2} + \frac{5.21}{\pi r^2} t + c$

which might look a bit ugly, but that’s only because I haven’t simplified the fractions. Since the radius (r) is 7.5 cm:

$h = -0.000526 t^{3/2} + 0.029 t + c$

Finally we substitute in the initial value (t=0, h=11) to solve for the coefficient:

$c = 11$

giving the equation:

$h = -0.000526 t^{3/2} + 0.029 t + 11$

Plotting the equations shows that it matches the measured data fairly well, although not quite as well as when we used the previous linear function for outflow.

Figure 4. Integrating a square root function for the outflow rate gives a modeled function for the changing height over time that slightly undermatches the measured heights.

# Discussion

I’m not sure why the square root function for outflow does not give as good a match of the measurements of height as does the linear function, especially since the former better matches the data (it has a better R2 value).

It could be because of the error in the measurements; the gradations on the water bottle were drawn by hand with a sharpie so the error in the height measurements there alone was probably on the order of 2-3 mm. The measurement of the outflow volume in the beaker was also probably off by about 5%.

I suspect, however, that the relatively short time for the experiment (about 15 minutes) may have a large role in determining which model fit better. If we’d run the experiment for longer, so students could measure the long tail as the water height in the bottle got close to the outlet level and the outflow rate really slowed down, then we’d have found a much better match using the square-root function. The linear match of the outflow data produces a quadratic equation when you integrate it. Quadratic equations will drop to a minimum and then rise again, unlike the square-root function which will just continue to sink.

# Conclusions

The linearization of the square-root function worked very nicely. It was a great mathematical example even if it did not produce the better result, it was still close enough to be worth it.

Citing this post: Urbano, L., 2012. Draining a Bottle Part 2: Linearizing Equations when you have to, Retrieved May 29th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# Jupiter and Venus in Conjuction

#### March 18, 2012

Venus (brighter) and Jupiter.

Jupiter and Venus have been sitting near the western horizon, shining so brightly that even I have noticed them. Phil Plait explains with some back-of-the-envelope math, why Venus is brighter even though it’s smaller than Jupiter. It’s a nice example of how a little math can do a great job explaining how the world (and others) works.

Citing this post: Urbano, L., 2012. Jupiter and Venus in Conjuction, Retrieved May 29th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# Gravity, the Electromagnetic Forces, and the Inverse Square Law

#### January 21, 2012

Calculating the forces between two charged particles (electric force), two magnets (the magnetic force), and two masses (the gravitational force) require remarkably similar equations. But, while electricity and magnetism are directly related (that’s why it’s called electromagnetism), gravity is its own fundamental force. Yet they all depend (inversely) on the square of the distance between the two objects creating the force, so they’re all said to obey some form of the inverse square law.

# Gravitational Force (Fg)

The force exerted by two masses on one another is:

$F_g = G \frac{m_1 m_2}{d^2}$

where:

• G is the gravitational constant (6.67300 × 10-11 m3 kg-1 s-2
• m1 and m2 are the masses of the two objects attracting one another.
• d is the distance between the two objects.

# Electrical Force (Fe)

The force exerted by two electrically charged objects on one another (like a proton and an electron), is:

$F_e = K \frac{q_1 q_2}{d^2}$

where:

• K is the electrical constant, sometimes called Coulumn’s constant (8.9876 × 109 N m2 C-2
• q1 and q2 are the sizes of the charges (in Coulumbs) of the two objects attracting one another.
• d is the distance between the two objects.

# Magnetic Force (Fm)

The force exerted by two magnets on one another, is:

$F_m = \mu \frac{p_1 p_2}{d^2}$

where:

• μ is a constant, (a little simplified)
• p1 and p2 are strengths of the magnetic poles of the two objects attracting one another.
• d is the distance between the two objects.

The magnetic force is a little more difficult to give a single equation for, because you need to factor in the shape of the magnets.

# Inverse Square Laws

In addition to gravity, electric, and magnetic forces, light (which is electromagnetic radiation) and sound also obey inverse square laws.

Citing this post: Urbano, L., 2012. Gravity, the Electromagnetic Forces, and the Inverse Square Law, Retrieved May 29th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.