Wednesday, September 30, 2015

more polynomial grid division

The most visited post on this blog describes how to divide polynomials using the grid method, also known as the generic rectangle or reverse tabular method. I realize that people who are looking for instruction in such matters may not be not idlers or casual readers of math blogs - they are likely serious people who are preparing lesson plans, doing homework, or otherwise looking to divide some polynomials. So I thought it would be nice to provide a little more on this topic, and hopefully help out a bit. If you are among these folk, I recommend that you start with the original post, and then read over these additional examples. Also, things will make better sense if you have practiced multiplying polynomials using grids.

In a future post, I'm planning to outline another method of polynomial division that I call the backwards reverse tabular method, which gives a power series as a result, instead of a polynomial quotient and remainder. Following through on the backwards reverse tabular method requires an infinitely long grid, so I am saving it for when I have more time.

example 1

Let's try this one:

Before you start, you should know what sort of things to expect. Since we are dividing a third degree polynomial (the dividend) by a first degree polynomial (the divisor), the quotient is going to be a second degree polynomial (degree is 3 - 1) with a possible remainder of degree zero (the remainder will have a degree less than the divisor). The grid you are going to need will be a 2 (divisor degree + 1) by 3 (quotient degree + 1)  grid.

We are thinking of division as the reverse of multiplication. The question we are asking is: what quotient (across the top) do we need to multiply by the divisor (the far left column) to get the dividend (what gets filled in the table)?

In step 1, we put the highest term of the divisor in the first cell of the second row (or the first interior row, depending on how you are counting them). What do we need to fill in at the green circle so that when we multiply we get what is already in the grid? The answer is shown in step 2. In step 3 we fill in the additional cells of the grid that result from multiplying the value that we just put in the top row. We get a second degree term - but we know we don't want any of those (there are none in the divisor), so we put a value in on the diagonal that will cancel it out (step 4, below).  

The process repeats itself for the second column (step 5), and eventually the third (step 6), until you have nothing left to fill in (step 7).

It looks like we are blocked now - we would like to keep filling in the grid so that it matches up with the dividend, but we have run out of cells: we'd like to complete the diagonal for the linear term (step 8, below). So, let's just add in the one cell we need  (step 9) - this will display the remainder, since there will not be any place to put a corresponding term in the top quotient row. [Not everyone includes the remainder on the grid, but I think it's a good idea to put it there, off to the side.]

We can now read the whole problem and its solution from the grid:

example 2

You may be forgiven if you believe this method might not work with divisors of higher powers. So lets try a sixth degree polynomial divided by a third degree polynomial.

Our dividend (degree 6) divided by our divisor (degree 3) will give us a quotient (degree 6 -3 = 3) and possibly a remainder (its degree less than that of the dividend, so less than 3). Our grid will be 4 (degree of divisor + 1) by 4 (degree of quotient + 1). Its a good idea to include a row of zeros for the missing linear term in the divisor (otherwise the diagonals will be messed up, and the grid will be harder to work with). Here is what you will start with:

Remember: Each upward sloping diagonal sums to a term in the original dividend, and you fill in cells in the second row to make this sum work out. The top row elements are chosen such that the multiplication works, and other cells down a column are just the result of filling in the grid by multiplication. In this case, we end up having to add 3 additional cells for the remainder:

It's easier than it first appears to be. Time for one more?

example 3

Apologies for the errors in the original version of this post. If you find any mistakes, please let me know. Thanks!

Friday, September 18, 2015

two star patterns

Here are a couple of star patterns inspired by the examples and explanations given by Craig Kaplan on his Computer Graphics and Geometric Ornamental Design page. Both were done in GSP using rough approximations of the precise methods that Craig describes there.

Monday, September 14, 2015

decorative fusings of the dodecagon

In the middle of playing around with various tiles and patterns, I lucked onto a post from Alex Bellos from back in February, in which he gives instructions for some decorative geometric constructions. He suggests dusting off a geometry set to implement them, but I found GSP worked nicely.

If you start with the line AB and follow Alex's instructions, you'll end up something like the above. Hiding what we want to hide, and mapping A and B onto the other corners of the square using an iteration will give you something that looks very close to his finished product.

In more decorative versions, the edges that extend out weave together in a braided fashion, producing an even more striking effect. But it was one of the later examples from the post that I was more interested in, as it seemed to show a more general method of using overlapping regular polygons (in this case, regular dodecagons) to produce decorative patterns. In one example, the dodecagons intersect at the midpoints of their sides at 90 degree angles:

I found that having the dodecagons intersect at the midpoints of their sides at 30 and 60 degree angles produces another interesting pattern.

If instead of intersecting at midpoints, we intersect the dodecagons at vertices, we can get other patterns. Here's one where the dodecagons have the smallest of overlaps.

Overlapping a little more, you get a pattern that you can make from a standard set of pattern blocks.

Still with a greater overlap, you can make a nice rosette.

And this pattern below has dodecagons overlapping in two ways (a bit hard to see the second):

Well, that was fun. Any other decorative patterns from overlapping dodecagons? I'll finish off with that dodecagon rosette pattern around a dodecagon.

Wednesday, September 9, 2015

geometric mean and sieve

We usually think of the mean of two numbers a and c as their average b = 1/2(+ c). Another way to think of b is that it is the number that makes a, b, c an arithmetic sequence, so b is more properly called the arithmetic mean of a and c. Similarly, we can find the geometric mean of two numbers, a and c. This time, b will be the number that makes a, b, c into a geometric sequence. The geometric mean of two numbers a and c is given by b = sqrt (* c).

Here is a construction for the geometric mean of two numbers that uses a parabola in an interesting way: 
  1. Graph the parabola y = x^2.
  2. Plot the points a and c on the y axis: let A be (0,a) and let C be (0,c).
  3. Draw a line through A parallel to the x axis - the point where it touches the parabola's positive arm is A'. Do the same for C - the point where it touches the parabola's negative arm is C'.
  4. Draw the line through A' C'.  The point where this line crosses the y axis is B = (0, b), where b is the geometric mean of a, c.

This construction of the geometric mean can be used to create a geometric prime sieve. Usually, we visualize the sieve of Eratosthenes on a number chart. Starting with 2, w cross out all the multiples of 2 (except for 2 itself): these numbers are clearly not prime. Then we continue with the first number that we did not cross out, 3, and cross out all its multiples (except for 3 itself)... if we continued indefinitely we will cross out all composites, leaving only primes behind (we have woven a sieve that only lets the primes fall through). Practically, if we are hunting for primes less than n, we only need to go as far as crossing out multiples of primes up to sqrt(n).

Here is how we can construct a similar prime sieve using a parabola - the geometric mean construction can help you see why we are able to hit all the composites.

1. Graph the parabola y = x^2.
2. Plot the points on the parabola obtained from x = -2, -3, -4, ...

3. Plot x = 2 on the parabola. Draw lines from this point on the parabola to each point drawn in step 2. The y-intercepts of these lines are the multiples of 2.

4. Plot x = 3 on the parabola. Draw lines from this point on the parabola to each point drawn in step 2. The y-intercepts of these lines are the multiples of 3.

5. Continue the process for x values that are not among the multiples found in previous steps.The numbers on the y axis, greater than 1 that are not touched by the constructed lines are the primes left behind by the sieve.

Tuesday, August 25, 2015

simple fun with R

I'm in the process of learning about the programming language R, and thought a nice way to get started would be to play with a few simple examples of things I've previously posted about. You can take any of these examples and try them out yourself by copying the code right into an in-browser R environment like R-fiddle.

The two baby R examples here make use of some of the built in math functions in R (sin, cos, and sqrt), and illustrate the vector-based approach that R takes. In R, instead of iterating using a while or for loop and applying functions to individual values, many functions are 'vectorized' so you can provide a whole vector of arguments to a function and it will do the iterating for you. Hopefully you will see what I mean in the examples below.

Example 1: Lissajous figures

R provides a number of ways of creating vectors - ordered collections of a single data type. One way to create a vector that is just a sequence of the form n, n + 1, n + 2, ... k is to use the colon notation n:k. Here (example 1a) some basic raw input the (vector t) has a scaling factor f applied to it. When you multiply a 'scalar' (actually, in R this is a one-element vector) by a vector, the scalar is applied to each element of the vector (as you might expect) to produce a new vector. Something a bit less expected is that functions like sin() are vectorized - if you provide a vector as an argument, they will produce a vector of the same size as a result, and the contents of the returned vector are what you would expect to get from applying the function to each element.

The plot() function is flexible - when a single vector is provided (example 1a) it will plot the ordered pairs (x, y) using elements of the vector as y values against x values inferred from each element's position in the vector (its index). When two vectors are provided (example 1b), the first vector provides the x values, and the second the y values (generally, R implements some 'recycling' behavior when the two vectors are not of equal length but the length of one is a multiple of the other). Finally, the plot() function offers some additional arguments for formatting the output.

 A very different "synthetic" approach to drawing lissajous figures can be taken in Geometer's Sketchpad, as mentioned here.

Example 2: Phyllotaxis spirals

Something that takes getting used to: sqrt(t)*cos(t) is not merely the multiplication of two numbers, it is the position-wise multiplication of two vectors (lists of numbers): t is a vector, sqrt(t) is a vector made up of the square roots of the elements of t, cos(t) is a vector made up of the cosines of the elements of t, and sqrt(t)*cos(t) is a vector made up elements obtained by multiplying the ith element of sqrt(t) by the ith element of cos(t). This is not the normal 'mathematical' way of multiplying vectors, but it is consistently used throughout R to achieve its distinctive vectorized programming model.

There are some older posts on drawing spirals like this in Fathom and Tinkerplots (see here), and also in Processing (see here).

FWIW, these simple examples are on github - maybe more will join them later.