Polar Coordinates Animation

A couple quick programs (polarGraphs.py) to create animations of the drawing of functions in polar coordinates (for my pre-Calculus class).

Graph of the function: r = 4 cos(θ)

It can export as a movie (mp4 as above). W can also transform functions (using: polarToCartesianGraph.py ) from rectangular to polar coordinates (and back: you can choose the settings).

Coordinate transforms Cartesian to Polar and back again for r = 4 cos(θ)

A Note on using ChatGPT

This python program uses the matplotlib library, and, for the first time for me, I used ChatGPT to figure out the syntax for things like drawing arcs and arrows, and exporting animation files, instead of googling my questions. ChatGPT worked great, and significantly speeded up the process. It does make me wonder, however, that since these models are based off of what they’ve scraped from the internet, are they going to run create problems for themselves if people stop asking questions on places like stackoverflow and rely on AI instead. Although, this might just mean that the AI will tend to be just be a little bit behind the cutting edge and there will continue to be a need for question and answer forums.

The Center of a Triangle

Laser-cut triangles showing the incenter, centroid, and circumcenter of an obtuse (slightly) triangle.

There are a few different ways of looking for the center of a triangle. My geometry students did the section in the textbook, then made cutouts on the laser.

They got some practice designing the triangles using a vector graphics program (Corel Draw). This did require an explanation of the difference between vector and raster images, since the majority of the class was unfamiliar with the concept. Raster images are made up of a grid of pixels, while vector images have instructions for where points go and where to draw lines. Vector images are great for diagrams like these because the files can be much smaller, the lines are more precise, and you can scale them up or down without losing any of that precision.

It turned out to be very useful to have them create the shapes and intersecting lines on the computer. It was pretty easy for them to precicely measure angles and find midpoints, so they could find the center points with much more accuracy than they could on just paper.

Having the final triangle cut-outs were also interesting. The centroid–the point of intersection of lines going from the vertices to their opposite side–is the center of gravity of the triangle, which means that, if you’re careful, you can use that point to balance the cut-out triangle on the tip of a pencil.

From Simple Equations to Complex Behavior

Another excellent video from Veritasium. Starts with the logistic equation and through a series of very clear examples gets to the relationship between growth rate (r) and equilibrium population. He does go into how this graph relates to the Mandelbrot set, but the rotating graphs are a little tricky to follow. However, the discussion of the practical applications of chaos theory (at 10:35) is really nice as well.

Note:

The logistic equation:

 x_{n+1} = r x_n (1-x_n)

gives the new population (xₙ₊₁) for a given growth rate (r) and the old population (xₙ).

This makes for a fairly nice and easy programming assignment.

Calculating π

A very good explanation of how Newton applied calculus to come up with a much more efficient method of calculating pi (π). It starts with a nice illustration of the relationship between π and the area of a circle, moves explains the binomial theorem (quite nicely), and then shows how Newton generalized the binomial theorem to come up with an integral of a quarter of a unit circle. They don’t explain what a unit circle is, but that’s easy: it’s just a circle with a radius of 1.

What is Real? A Math Seminar (Prelude to Imaginary Numbers)

We had a really nice, thoughtful seminar discussion in Algebra II, with the simple question: What is real?

I did this as a lead into the topic of imaginary numbers (i = \sqrt{-1}).

The distinction between tangible and intangible objects came up pretty early in the discussion. That morphed pretty quickly with the realization that there were things that you can’t touch, like ideas and thoughts that were real as well, despite being non-physical.

Then they considered some of the more edge-wise cases, such as, are dragons real. After all, they never really existed, but are parts or real myths. That thought lead to the idea that anything that was thinkable–anything you could think of–was real.

I jumped in, near the end, to insert the idea that maybe there were things that were not real–that were imaginary–but could be useful. And that’s how I set up my lesson on imaginary numbers.

Because even if you can’t calculate the square root of -1 (no number times itself will give a negative number).

 \sqrt{-1} = ?

You can give it a name.

 i = \sqrt{-1}

And under certain circumstances:

 i \cdot i = i^2

You might find that imaginary numbers can combine to give you real numbers.

 i^2 = (\sqrt{-1} )^2

 i^2 = -1

Which means we can do a whole lot of calculations that were impossible before, making imaginary numbers extremely useful.

 \sqrt{-9} \cdot \sqrt{-4} = 3i \cdot 2i  = 6 \cdot i^2 = 6 \cdot (-1) = -6

Linearizing an Exponential Function: Radioactive Decay

Using this data for the decay of a radioisotope, find its half life.

t (s)A (g)
0100
10056.65706876
20032.10023441
30018.18705188
40010.30425049
5005.838086287
6003.307688562

We can start with the equation for decay based on the half life:

   A = A_0 (\frac{1}{2})^\frac{t}{\lambda}  

 
where:
 A = \text{Amount of radioisotope (usually a mass)}  A_0 = \text{Initial amount of radioisotope (usually a mass)}   t = \text{time}  \lambda = \text{half life}  

and linearize (make it so it can be plotted as a straight line) by using logarithms.

Take the log of each side (use base 2 because of the half life):

  \log_2{(A)} = \log_2{  \left( A_0 (\frac{1}{2})^\frac{t}{\lambda} \right)} 

Use the rules of logarithms to simplify:

 \log_2{(A)} = \log_2{ ( A_0 )} + \log_2{  \left( (\frac{1}{2})^\frac{t}{\lambda} \right)}   

  \log_2{(A)} = \log_2{ ( A_0 )} +  \frac{t}{\lambda}  \log_2{   (\frac{1}{2}) }      

 \log_2{(A)} = \log_2{ ( A_0 )} +  \frac{t}{\lambda}  (-1)   

  \log_2{(A)} = \log_2{ ( A_0 )} -  \frac{t}{\lambda}       

Finally rearrange a little:

  \log_2{(A)} =  -  \frac{t}{\lambda}  +  \log_2{ ( A_0 )}      

  \log_2{(A)} =  -  \frac{1}{\lambda} t +  \log_2{ ( A_0 )}       

Now, since the two variables in the last equation are A and t we can see the analogy between this equation and the equation of a straight line:

 \log_2{(A)} =  -  \frac{1}{\lambda} t +  \log_2{ ( A_0 )}        

and,

   y =  m x +  b       

where:

   y = \log_2{(A)}        

   m =  -  \frac{1}{\lambda}        

   x = t       

   b =  \log_2{ ( A_0 )}        

So if we draw a graph with log₂(A) on the y-axis, and time (t) on the x axis, the slope of the line should be:

   m =  -  \frac{1}{\lambda}        

Which we can use to find the half life (λ).

Radioactive Half Lives

Since we most commonly talk about radioactive decay in terms of half lives, we can write the equation for the amount of a radioisotope (A) as a function of time (t) as:

  A = A_0 (\frac{1}{2})^\frac{t}{\lambda} 

where:
 A = \text{Amount of radioisotope (usually a mass)}  A_0 = \text{Initial amount of radioisotope (usually a mass)}   t = \text{time}  \lambda = \text{half life} 

To reverse this equation, to find the age of a sample (time) we would have to solve for t:

Take the log of each side (use base 2 because of the half life):

  \log_2{(A)} = \log_2{  \left( A_0 (\frac{1}{2})^\frac{t}{\lambda} \right)} 

Use the rules of logarithms to simplify:

 \log_2{(A)} = \log_2{ ( A_0 )} + \log_2{  \left( (\frac{1}{2})^\frac{t}{\lambda} \right)}   

  \log_2{(A)} = \log_2{ ( A_0 )} +  \frac{t}{\lambda}  \log_2{   (\frac{1}{2}) }      

 \log_2{(A)} = \log_2{ ( A_0 )} +  \frac{t}{\lambda}  (-1)   

 \log_2{(A)} = \log_2{ ( A_0 )} -  \frac{t}{\lambda}      

Now rearrange and solve for t:

 \log_2{(A)} - \log_2{ ( A_0 )} = -  \frac{t}{\lambda}      

 -\lambda \left( \log_2{(A)} - \log_2{ ( A_0 )} \right) = t      

  -\lambda \cdot \log_2{ \left( \frac{A}{A_0} \right)}  = t      
 

So we end up with the equation for time (t):

  t = -\lambda \cdot \log_2{ \left( \frac{A}{A_0} \right)}         
 

Now, because this last equation is a linear equation, if we’re careful, we can use it to determine the half life of a radioisotope. As an assignment, find the half life for the decay of the radioisotope given below.

t (s)A (g)
0100
10056.65706876
20032.10023441
30018.18705188
40010.30425049
5005.838086287
6003.307688562