Monday, October 10, 2011

Musical Spiral

This is fantastic!  I found this in a link off of mathpuzzle.com. 

There is so many different directions you can go with this!  I love that if you close your eyes, the music has some structure, but it mostly sounds too complicated to understand.  However, if we found a way to graph it, to represent it in another way, we could understand the complexity.  That is why representation of data and ideas is so important.  The right notation can make all the difference in the world. 

What other geometric music could be attempted?  Something that would be very simple geometrically, but complicated musically. 

Is there a three dimensional analogue?  What is the best scale to use?

My favorite is probably this one or this one.

Have fun!

Wednesday, October 5, 2011

Morpion

Remember that lame paper and pencil game kids use to play where you connected the dots?

Well, I ran into a solitaire game that was so much better than this.  Why didn't I know this game earlier!

I found it on a link at a favorite website by Ed Pegg, Jr. that I check every so often, that always has good stuff.

It is called Morpion, check it out!

Saturday, October 1, 2011

Quick Plumbing Problem

The hot water knob on the downstairs bathroom does not fit and you also had to turn it the wrong way.  So I decided to fix it.  I should have known it would develop into a whole project.

I casually took the handle off, and went to "Home-I-Depo" to replace it.  Oh my goodness.  It took forever.  This was the most complicated system to organize faucets.  For example, there might be a part named 2H-1C/H.  Are you kidding me?!?  What kind of system is that?  Anyway, eventually (R almost went crazy) I figured out that the first number is the length, the letter was the style and size of the part that goes into the handle.  The next number is the type of threading (?) and C or H or C/H stands for hot or cold or both.

The problem was that I didn't know what I had.  There were no markings on my faucet.  Anyway, after a few missed tries, and I finally got a set that seemed right.

When I went to replace it, I started to turn out the shutoff valve right under the bathtub.  As soon as I started turning the knob, it started to leak profusely.  Oh no.  This is not good.

I finished the replacement of the faucet, but now I had a bigger problem.

Let's see...

I had to replace the valve with a new one.

I went back to "Home-I-Depo" and got a $20 Benz-O-matic (propane torch) for copper sweating and a new shutoff valve.

I crawled into the crawlspace (I hate doing this), and turned off the water.

It took forever to unsolder the connections, and once it was undone, I couldn't move it anywhere.  The way it had been constructed, there was no play in the pipes, and I couldn't separate the connections.  I had to cut the pipe and work it off that way.



Eventually, I replaced the valve, but not before making a HUGE mess of solder and copper and almost burning myself a few times.  Man, I had forgotten about doing this.  I did a lot of soldering when remodeling my kitchen.  I don't exactly remember it fondly, but at least I felt the soldering joints were pretty.  My soldering looks horrible, but on the other hand, I only had to do it once!  After looking at my soldering job, I was sure that I would have to do it again.



Two things to remember for next time:

1)  Use a male-male adapter that doesn't have a stop.  That way, I can slip it on, and still fit very tight fitting.

2)  Make sure that you get all of the water out if you can, it took forever to heat the pipe when there was still water in the pipe.

3)  Try not to end up with the red handle for the cold and the blue handle for the hot.

Saturday, August 20, 2011

Trunk Board

I was driving home from my brother's house late at night.  It was cold and sleeting.  I had forgotten my cell phone but my brother's house was only 15 miles away, so I should be alright...

I was on 495 heading west when I saw flashing lights ahead.  I was trying to see what was happening when I saw a few metal bed frames in my lane and the next.  I ran over them.  There was nothing I could do.  The visibility was pretty low, and I was moving at about 80 mph.  Anyway, as soon as I hit them, I knew it did some damage.  I just didn't know what.  So I turned off the heat and the radio and I listened.  Incidentally, the cop had pulled over a truck carrying bed frames...

I was listening for any sort of trouble, but I knew it was only a matter of minutes.  I decided to go 201 to 193 to go home as opposed to 495 the rest of the way.  As soon as I got off the interstate and onto 201, I heard my tire start to thump.  So I pulled over where I could and started got out.  It was freezing and wet.  I went to my trunk (which is ALWAYS full) and started digging out the spare.  I couldn't believe my bad luck!  Since we had been celebrating something (Christmas?) I was all dressed up with my leather coat on.  I was none to happy.  I finally got the spare out, and went to get the tire off.  I jacked the car up (which was fun), and went to take off the lug nuts.  They wouldn't budge.  I worked for 45 minutes in the cold and rain eventually putting all my weight onto the crowbar.  I kicked them and cursed them.  Eventually I got them off, but I have never had difficulty like that before.

Anyway, I was so angry that I *tossed* the tire into the trunk cracking the board that makes a flat surface above the spare tire enclosure.  Great.

I got home alright, very wet and cold, though nobody ever did stop.  I guess I wouldn't either.  I big man in the dark rain wearing a black leather coat and carrying a tire-iron.

After many dollars (actually the tire was still under warranty), I had a new tire, but the trunk was not very functional.    Until today!

Here is a before picture of the board:
After a trip to "Home - I - Depo" (as R says), $15, and a few hours, this is what I got:


Two things to note.

1) I put in (or really just couldn't find one cheap 4x4 plywood piece) a hinged joint right where spare tire ends.  This is nice because it gives me some extra storage space.

2) I had to grind off the screws that protruded from the other side of the hinge.  I really thought this was going to be a problem, but it turned out to be easy.  Also, R really liked the sparks that flew during the grinding.
All better!

Wednesday, February 16, 2011

MathJax

To get equations that just work on your site, go to http://www.mathjax.org/.

On those pages, there are several options, since it is a very flexible program, but the simplest is to copy the following text into your blog template or webpage:

<script type="text/javascript" src="http://www.mathjax.org/mathjax/MathJax.js">
    MathJax.Hub.Config({
        extensions: ["tex2jax.js"],
        jax: ["input/TeX", "output/HTML-CSS"],
        tex2jax: {
            inlineMath: [ ['$','$'], ["\\(","\\)"] ],
            displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
        },
        "HTML-CSS": { availableFonts: ["TeX"] }
    });
</script>

I found this after a much longer search than I thought at the configuration webpage.  Now what they actually have for the source is "path-to-MathJax/MathJax.js" and encourage you to get your own copy.  However, I don't have a place to put the downloaded mathjax stuff, so I just used theirs.  I don't think this is what they really want, but I didn't see a way around it.

There are lots of LaTeX commands you can use, here is a list

For example, this just works

$$\frac{1}{1+\frac{1}{1+\frac{1}{1+\frac{1}{1+\frac{1}{1+\frac{1}{1+\ldots}}}}}}$$

Wednesday, February 9, 2011

Barcodes!

For some crazy reason, I wanted to make barcodes.  I have no real reason why.  I guess I wanted to be able to read barcodes, or make a reader for barcodes.  So in order to do that I need to be able to make them.

Of course there are TONS of barcode systems.  Some are very tempting, but one of the simplest seems to be Code 128.  This is used fairly often, and it seemed pretty robust.

Barcodes are basically set up with a few bars in the front to tell you which part of 128 you are using (A, B, or C), then individual characters come along.  Each character is 6 stripes long starting with black and alternating.  Varying the thickness of the stripes will give you each character.  So, for example, "A" is 111323, that is, 'a black stripe that is 1 unit wide, a white stripe that is 1 unit wide, a black stripe that is 1 unit wide, a white stripe that is 3 units wide, a black stripe that is 2 units wide, a white stripe that is 3 units wide.  Look at the animation below



The end of the bar code is a check number and a stop character that is 7 bars long and unique.  Here is the chart that I used from Wikipedia



There are multiple ways to encode a message, so I just used code B throughout.  There are Shift keys so that the following character is in the shifted language.  Also, you can encode '12' as a '1' followed by a '2' or as a single character '12'.  I wonder if I could make something so that given a message it would give me the simplest barcode... hmm...

Anyway, I encoded messages using just column B using Mathematica.

I first changed a string like "Hello World" to its list of black and white bar notation using









So now I can try "Hello World"

 


encode uses another function to find the check number


This is not too important, and I won't go into it.  Basically, it calculates another character based on all of the characters in your text.  This is a standard way of know when you got the right answer when you are reading it.  Just do a quick check.

Then I plot it (with a bunch of rectangles)

I only plot black rectangles because that is all I need to plot.

Here are some examples


Note that whatever the message is, it always starts with 211214 and always ends with 2331112.

Next, on to the barcode reader!

Wednesday, February 2, 2011

More envelopes than a post office!


I wish I had more time to explore this. I found a passing comment in S. V. Meleshko's Methods for Constructing Exact Solutions of Partial Differential Equations about envelopes of curves. I will get to his statement at the end. Basically suppose we have a family of curves like the blue ones below




This is an example of a one parameter family of curves. Specifically, I made this by finding lines where the intercepts always add to 10,
 $$y(x,a)= \frac{a - 10}{a} x + 10 - a.$$
This begs the question of finding the envelope of the family of curves shown in black in the figure. What is the equation that describes the envelope? How do we find it?


I have always been fascinated by these types of curves ever since I did a string art project in middle school. I wondered, as I do now, what types of curves you could produce.


This has been addressed before in various places, and I gather that the topic used to be quite common in Calculus courses.  However, in case you don’t see it right away, here is a way to obtain the envelope. 

Let’s fix $x$. Now for this $x$, say $x_0$, we have a relation between $y$ and $a$ through the equation for a curve in the family.  We can think of the envelope as an extremum of the relationship between $y$ and $a$. Illustrating this graphically, if we consider the intersection of the vertical line $x_0$ and our family of curves $y(x_0,a)$, then as we scan through $a$, we will see that there are special points where the intersection point reaches a maximum.  This can be seen in the animation below (right click on the image below and select 'open in a new tab').




As we scan through $a$, we can see the intersection point (in red).  When it slows down and changes direction, this is a point of the envelope.


This is exactly $g(x_0)$. We can then describe the envelope equation as
$$g(x) = y ( x, a_{*} (x) ) $$
where $a_{*}(x)$ is found by finding the extremum of $y(x,a)$ with respect to $a$. Thus $a_{*}(x)$ is the solution to
$$\frac{\partial y(x,a)}{\partial a}=0.$$
For our case explicitly, the solution is
$$g(x)=10 \pm 2 \sqrt{10} \sqrt{x} + x.$$
A graph of these two curves can be seen in black in the first figure.

Note also from the way we have written the envelope that every point of $g(x)$ necessarily lies on a specific curve in the family of curves. This means that at each point a particular curve from our family is tangent to the envelope. Likewise, we also know that the envelope is tangent to one of our curves in the family. This is a good thing to recognize because from this we may construct a differential equation. We know that
$$g(x) = \frac{a_{*}-10}{a_{*}} x + 10 - a_{*},$$
$$g'(x)=\frac{a_{*} - 10}{a_{*}}.$$

From this, we may eliminate $a_*$ to obtain a differential equation for $g(x)$. In this case we get
$$g'(x)(10-x+x g'(x))=g(x)(g'(x)-1).$$
This is a nonlinear, first-order differential equation.  The solution for this differential equation is then the envelope function. If we plug the envelope in, we find that it is, in fact, a solution.

The interesting point is that the two branches of the envelope are not the only solutions! All of the curves in the family are also solutions to this nonlinear differential equation. Since it is not a linear differential equation, there is not a uniqueness or existence theorem. We can see that the one parameter family of curves satisfies this equation since they satisfy the equations that the differential equation was derived from.  I was just shocked that a family of lines could satisfy such an unruly differential equation.

Oftentimes we are confronted with a nonlinear differential equation where we are excited when we are able to get one solution to the problem. This is an example of an infinite number of solutions to a complicated looking differential equation. But most (an infinite number) of the solutions are just straight lines!

The converse of the above is actually easier to prove and we take it out of Meleshko (not the proof -- although it is not hard).  He says it in passing, and for two dimensional surfaces.  Basically, he says (on page 9) that if you have a family of curves that is a solution of a differential equation, then the envelope is also a solution!  Amazing!


Anyway, I know this is too long for anyone to read, but I will end with some interesting families of curves and their envelopes.


Here is a family of lines with sin waves on top
 $$y_{1}(x,a)= \frac{a - 10}{a} x + 10 - a + \sin(10 x).$$





Here is a family of exponentials
$$y_{2}(x,a) = a e^{\frac{x}{a}}$$




Here is a family of gaussians
$$y_{4}(x,a) = a e^{-(x-a)^2}$$



Here is another family of gaussians
$$y_{5}(x,a) = \frac{1}{\sqrt{\pi} a} e^{-\left(\frac{x}{a}\right)^2}$$



Here is one where I was playing with lines again
$$y_{5}(x,a) = \frac{a^2 - 1}{a} \left( \frac{x}{a}+ \frac{1}{2} \right) - a$$



Two and three dimensions should be fairly straightforward to do (although I have not).  What I would like to do is to be able to go backwards.  I have played enough to make a

Conjecture: any reasonable curve can be an envelope to a family of lines.

I want to make this explicit, but that is a topic for another day.

Sunday, January 16, 2011

Numbers for R

I want to give my son R a head start on numbers and the best way I could think of to do that was to show him that there is a pattern to the series of numbers that keeps repeating. He knew 1 through 10, so I decided to make him a rectangular array of digits so that he could see the pattern.Here each number has its own color. That way you can see the regular pattern. If you start on the left and move down the column, you get the first 10 numbers as usual. The advantage of seeing it in a rectangular array is that when you go across the top row, you also see the first ten numbers, but with 0's after them. I hoped this would be clear to him.

The only problem is that, for whatever reason, the numbers from 11 to 19 do not follow the same convention as the numbers from 20 - 99. I don't know why. I was considering changing them for R's sake. I would call them "Ten - e - one", "Ten - e - two", etc. Then he would see the structure right away with the disadvantage that it is nonstandard. My wife S vetoed this. Oh well.

That brings up an interesting question (at least to me). Where do the words "Twenty", "Thirty", etc. come from. My initial uneducated guess is that they are shortened versions of "Two - ten" and "Three - ten". But I don't know. Does anyone know the answer to this?
Powered by MathJax