# Updated Atom Builder

#### September 5, 2014

A couple of my students asked for worksheets to practice drawing atoms and electron shells. I updated the Atom Builder app to make sure it works and to make the app embedable.

So now I can ask a student to draw 23Na+ then show the what they should get:

# Worksheet

Draw diagrams of the following atoms, showing the number of neutrons, protons, and electrons in shells. See the example above.

I guess the next step is to adapt the app so you can hide the element symbol so student have to figure what element based on the diagram.

Citing this post: Urbano, L., 2014. Updated Atom Builder, Retrieved March 27th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# Volumes of Rotation: The Disk Method: 3d with Javascript Three.js

#### March 3, 2014

Finally, relatively easy interactive 3d on the web. You can rotate and zoom into the scene. (Although it may not yet be compatible with all browsers it does work with Firefox at least).

This method uses the three.js Javascript library. Here I use it to show the volume of a rotated surface using the disk method. It’s almost identical to my calculus student’s project, except here I’m finding the volume between x=1 and x=3, using disks that are 0.5 units in height (Δx).

Since the volume of cylinder is:

$V_{cylinder} = \pi r^2 h$

where r is the radius of the cylinder.

We’re finding the volume created by a function that’s rotated around the x-axis. Using the function:

$y = -\frac{x^2}{4}+4$

The radius of each cylinder is the value of the function for that x value, so you could write the radius as:

$R(x) = -\frac{x^2}{4}+4$

Therefore the volume of each disk is:

$V_{disk} = \pi R(x)^2 \Delta x$

There are four disks and we use the function value at the far end of the disk to draw the disk so the total volume is:

$V = \pi R(1.5)^2 \Delta x + \pi R(2.0)^2 \Delta x + \pi R(2.5)^2 \Delta x + \pi R(3.0)^2 \Delta x$

Factoring out the π and the Δx gives:

$V = \pi \Delta x \left(R(1.5)^2 + R(2.0)^2 + R(2.5)^2 + R(3.0)^2 \right)$

Since Δx = 0.5, a = 1.0, and b = 3.0, we can define the number of disks as n = 4 then we can rewrite using summation formula:

$V = \pi \Delta x \sum\limits_{i=1}^n R(1.0+i \Delta x)^2$

reverting back to a and b gives the general equation:

$V = \pi \Delta x \sum\limits_{i=1}^n R(a+i \Delta x)^2$

where:
$n = \frac{b-a}{\Delta x}$

Citing this post: Urbano, L., 2014. Volumes of Rotation: The Disk Method: 3d with Javascript Three.js, Retrieved March 27th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# An Online Microscope

#### July 5, 2013

Now that I have a new set of microscopes I didn’t think I would actually need to have an online, simulated microscope to show samples. However, I thought having a series of picture that I could scroll through would be useful to illustrate microscopy concepts such as depth-of-field when I talk about them to the whole class. Once I’d created the depth-of-field simulation, I figured it would not be too much extra trouble to put in a few different magnification levels. Now I have this embeddable online microscope simulator.

It’s started off with a single fly wing as a sample, but I’ll be adding to it as I take more pictures.

Citing this post: Urbano, L., 2013. An Online Microscope, Retrieved March 27th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# Depth of Field Demonstration: On a Simulated Microscope

#### July 2, 2013

At higher magnifications, microscope lenses will only be able to focus on layers within your specimen. You could take a series of images with different focal planes and stack them together, but without a camera mounted on the microscope, getting images to line up right for focus stacking is quite the challenge. The alternative is focusing in and out until you get a feeling for the three dimensional shape of the specimen.

Since I don’t have a camera mount I’ve created an html5/javascript page that simulates focusing in and out of a sample. It’s embedded above, but a direct link is here.

You can use the knobs to the right of the image to adjust the focal plane. You should be able to see hairs on the top and bottom of the transparent wing.

Citing this post: Urbano, L., 2013. Depth of Field Demonstration: On a Simulated Microscope, Retrieved March 27th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# One Spring’s Month

#### May 10, 2013

A month in the spring can make a huge difference. Move your mouse over the image (or click the image) to see the difference between April and May on the Fulton School campus.

The full sized images can be seen here.

Note: To embed the image above use:

<iframe style=”overflow:hidden;” src=”http://earthsciweb.org/js/images/spring/spring.html” width=490 height=326 seamless />

Citing this post: Urbano, L., 2013. One Spring's Month, Retrieved March 27th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# Basic JavaScript

#### May 3, 2013

One of my students couldn’t get VPython to install and run her computer. She was running Windows 8, and I have not used Windows, much less this version of it to figure out what the problem was. This is one of the challenges with a bring your own device policy. So, instead I gave the lesson on numerical integration using javascript.

To make things easier, I create a barebones template of a webpage build around javascript (using the jquery library to make interactivity easier).

If you open the webpage file (index.html) in your browser you should see nothing but the word “Hello”. The template is blank, but it’s ready so students can start with the javascript programming right away, which a few of my programming elective students have done.

For reference, this file (basic-jquery-numeric-int.zip) uses the template to create a program that does numerical integration. Someone using the webpage can enter the limits (a and b) and the number of trapezoids to use (n), and the program calculates calculates the area under the curve f(x) = -x2/4 + x + 4.

It’s a very bare template and doesn’t have any comments, so it’s not useful unless you’re at least a little familiar with html and javascript and just need a clean place to start.

Citing this post: Urbano, L., 2013. Basic JavaScript, Retrieved March 27th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# Programming Numerical Integration with Python (and Javascript)

#### April 20, 2013

Numerically integrating the area under the curve using four trapezoids.

I gave a quick introduction to programming for my calculus class, which has been working on numerical integration.

Numerical integration is usually used for functions that can’t be integrated (or not easily integrated) but for this example we’ll use a simple parabolic function so we can compare the numerical results to the analytical solution (as seen here).

With the equation:

$f(x) = -\frac{1}{4} x^2 + x + 4$

To find the area under the curve between x = 1 and x = 5 we’d find the definite integral:

$Area = \int_{_1}^{^5} \left(-\frac{x^2}{4} + x + 4 \right) \,dx$

which gives the result:

$Area = 17 \frac{2}{3} = 17.6\bar{6}$

For numerical integration, we break the area of concern into a number of trapezoids, find the areas of all the trapezoids and add them up.

We’ll define the left and right boundaries of the area as a and b, and we can write the integral as:

$Area = \int_{_a}^{^b} f(x) \,dx$

The left and right boundaries of the area we’re interested in are defined as a and b respectively. The area of each trapezoid is defined as An.

We also have to choose a number of trapezoids (n) or the width of each trapezoid (dx). Here we choose four trapezoids (n = 4), which gives a trapezoid width of one (dx = 1).

The area of the first trapezoid can be calculated from its width (dx) and the height of the two upper ends of the trapezoid (f(x0) and f(x1).

So if we define the x values of the left and right sides of the first trapezoids as x0 and x1, the area of the first trapezoid is:

$A_1 = \frac{f(x_{_0})+f(x_{_1})}{2} dx$

For this program, we’ll set the trapezoid width (dx) and then calculate the number of trapezoids (n) based on the width and the locations of the end boundaries a and b. So:

$n = \frac{b-a}{dx}$

and the sum of all the areas will be:

$\displaystyle\sum\limits_{i=1}^{n} \frac{f(x_{i-1})+f(x_{i})}{2} dx$

We can also figure out that since the x values change by the same value (dx) for every trapezoid, it’s an arithmetic progression, so:

$x_{i-1} = a + (i-1) dx$

and,

$x_{i} = a + i \cdot dx$

so our summation becomes:

$\displaystyle\sum\limits_{i=1}^{n} \frac{f(a+(i-1)dx)+f(a + i \cdot dx)}{2} dx$

Which we can program with:

numerical_integration.py

# the function to be integrated
def func(x):
return -0.25*x**2 + x + 4

# define variables
a = 1.          # left boundary of area
b = 5.          # right boundary of area
dx = 1          # width of the trapezoids

# calculate the number of trapezoids
n = int((b - a) / dx)

# define the variable for area
Area = 0

# loop to calculate the area of each trapezoid and sum.
for i in range(1, n+1):
#the x locations of the left and right side of each trapezpoid
x0 = a+(i-1)*dx
x1 = a+i*dx

#the area of each trapezoid
Ai = dx * (func(x0) + func(x1))/ 2.

# cumulatively sum the areas
Area = Area + Ai

#print out the result.
print "Area = ", Area



And the output looks like

>>>
Area =  17.5
>>>


While the programming is pretty straightforward, it was a bit of a pain getting Python to work for one of my students who is running Windows 8. I still have not figured out a way to get it to work properly, so I’m considering trying to do it using Javascript.

# Update

The javascript functions for numerical integration:

function numerically_integrate(a, b, dx, f) {

// calculate the number of trapezoids
n = (b - a) / dx;

// define the variable for area
Area = 0;

//loop to calculate the area of each trapezoid and sum.
for (i = 1; i <= n; i++) {
//the x locations of the left and right side of each trapezpoid
x0 = a + (i-1)*dx;
x1 = a + i*dx;

// the area of each trapezoid
Ai = dx * (f(x0) + f(x1))/ 2.;

// cumulatively sum the areas
Area = Area + Ai

}
return Area;
}

//define function to be integrated
function f(x){
return -0.25*Math.pow(x,2) + x + 4;
}

// define variables
a = 1;		// left boundary of area
b = 5;		// right boundary of area
dx = 1;		// width of the trapezoids

// print out output
alert("Area = "+ numerically_integrate(a, b, dx, f));


This is a demonstration of a full html file that uses the function, and should work in any modern browser (download files: numerical-integration.zip).

# Update 2

I've added the above javascript code to the embeddable graphs to allow it to calculate and display numerical integrals: you can change the values in the interactive graph below.

Citing this post: Urbano, L., 2013. Programming Numerical Integration with Python (and Javascript), Retrieved March 27th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.

# Graphing Polynomials

#### March 24, 2013

Try it. You can change the order and coefficients of the polynomial. The default is the second order polynomial: y = x2.

I originally started putting together this interactive polynomial app to use in demonstrating numerical integration, however it’s a quite useful thing on its own. In fact, I’ve finally figured out how to do iframes, which means that the app is embeddable, so you can use it directly off the Muddle (if you want to put it on your own website you can get the embed code).

This app is a rewritten version of the parabola code, but it uses kineticjs instead of just HTML5 canvases. As a result, it should be much easier to adapt to make it touch/mouse interactive.

Citing this post: Urbano, L., 2013. Graphing Polynomials, Retrieved March 27th, 2017, from Montessori Muddle: http://MontessoriMuddle.org/ .
Attribution (Curator's Code ): Via: Montessori Muddle; Hat tip: Montessori Muddle.