Quantcast

Posts tagged with excel

The Cauchy distribution (?dcauchy in R) nails a flashlight over the number line

http://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Number-line.svg/1000px-Number-line.svg.png

and swings it at a constant speed from 9 o’clock down to 6 o’clock over to 3 o’clock. (Or the other direction, from 3→6→9.) Then counts how much light shone on each number.

*

In other words we want to map evenly from the circle (minus the top point) onto the line. Two of the most basic, yet topologically distinct shapes related together.

image

You’ve probably heard of a mapping that does something close enough to this: it’s called tan.

http://www.calculatorsoup.com/images/trig_plots/graph_tan_pi.gif
Since tan is so familiar it’s implemented in Excel, which means you can simulate draws from a Cauchy distribution in a spreadsheet. Make a column of =RAND()'s (say column A) and then pipe them through tan. For example B1=TAN(A1). You could even do =TAN(RAND()) as your only column. That’s not quite it; you need to stretch and shift the [0,1] domain of =RAND() so it matches [−π,+π] like the circle. So really the long formula (if you didn’t break it into separate columns) would be =TAN( PI() * (RAND()−.5) ). A stretch and a shift and you’ve matched the domains up. There’s your Cauchy draw.

In R one could draw three Cauchy’s with rcauchy(3) or with tan(2*(runif(3).5)).

*

http://www.calculatorsoup.com/images/trig_plots/graph_tan_pi.gif

What’s happening at tan(−3π/2) and tan(π/2)? The tan function is putting out to ±∞.

I saw this in school and didn’t know what to make of it—I don’t think I had any further interest than finishing my problem set.

File:Hyperbola one over x.svg

I saw as well the ±∞ in the output of flip[x]= 1/x.

  • 1/−.0000...001 → −∞ whereas 1/.0000...0001 → +∞.

It’s not immediately clear in the flip[x] example but in tan[x/2] what’s definitely going on is that the angle is circling around the top of the circle (the hole in the top) and the flashlight of the Cauchy distribution could be pointing to the right or to the left at a parallel above the line.

Why not just call this ±∞ the same thing? “Projective infinity”, or, the hole in the top of the circle.

http://upload.wikimedia.org/wikipedia/commons/8/85/Stereographic_projection_in_3D.png




multiplicities of freedom demonstrates Chaos Theory in Excel. If he filled in more initial values, you would see a thick bar—like a picture of white-noise.

Butterflies flapping their wings in Vermont to change the wind in Hangzhou?
A drop of water on Jeff Goldblum’s hand taking a very different path down depending on random parameters?
Or—as in multiplicitiesoffreedom's picture—like a hashing function, the codomain being a highly-discrepant reordering|shuffle of the domain?

I found a paper on Chaos Theory as a metaphor for Institutional Economics and I just couldn’t help but play around with the equations inside. (Like the methodology of inst. econ)

For those who want to play around with the logistic map in R as well as Excel, do:
require(fNonlinear)
?lorentzSim
y = logisticSim()
plot(y, col=rgb(.1,.1,.1,.75) )

multiplicities of freedom demonstrates Chaos Theory in Excel. If he filled in more initial values, you would see a thick bar—like a picture of white-noise.

a chaotic process (logistic map) generated & drawn in R
white (Gaussian) noise

  • Butterflies flapping their wings in Vermont to change the wind in Hangzhou?
  • A drop of water on Jeff Goldblum’s hand taking a very different path down depending on random parameters?
  • Or—as in multiplicitiesoffreedom's picture—like a hashing function, the codomain being a highly-discrepant reordering|shuffle of the domain?


I found a paper on Chaos Theory as a metaphor for Institutional Economics and I just couldn’t help but play around with the equations inside. (Like the methodology of inst. econ)

For those who want to play around with the logistic map in R as well as Excel, do:

require(fNonlinear)
?lorentzSim
y = logisticSim()
plot(y, col=rgb(.1,.1,.1,.75) )


hi-res




Seriously … why don’t maths classes use computers? Excel, simple Python scripts, Mathematica / Sage, everything beyond the TI-83. Kids could be creating totally sweet visuals instead of cribbing formulae. And thinking instead of copying.

I can say from my experience teaching that giving kids some real data and having them muck around with it for an hour, was better than an hour of my lectures. (And guess what, they understood lecture better after they’d looked at real data.)

Why, why, why, why, why is maths education so bad?




Easiest way to start imagining four-dimensional things is by numbering the corners of a 4-cube.
First realise that the eight corners of a cube can be numbered "in binary" 000—001–010–100—110–101–011—111. Just like the four corners of a square can be numbered 00–10–01–11. (And just like the sixteen corners of a tesseract can be numbered as above.)
(Yes, there are combinatorics connections. Yes, there are computer logic connections. Yes, there are set theory connections.)
So the problem of comprehending higher dimensions reduces to adding more entries to a table. You can represent a 400-dimensional cube in Excel—and do calculations about it there, too.
PS How many connectors come out of each point?
PPS R generates the tesseract even easier than Excel:
> booty=c(0,1) > expand.grid(booty,booty,booty,booty,) #rockin everywhere
   Var1 Var2 Var3 Var4
1     0    0    0    0
2     1    0    0    0
3     0    1    0    0
4     1    1    0    0
5     0    0    1    0
6     1    0    1    0
7     0    1    1    0
8     1    1    1    0
9     0    0    0    1
10    1    0    0    1
11    0    1    0    1
12    1    1    0    1
13    0    0    1    1
14    1    0    1    1
15    0    1    1    1
16    1    1    1    1

Easiest way to start imagining four-dimensional things is by numbering the corners of a 4-cube.

First realise that the eight corners of a cube can be numbered "in binary" 000—001–010–100—110–101–011—111. Just like the four corners of a square can be numbered 00–10–01–11. (And just like the sixteen corners of a tesseract can be numbered as above.)

(Yes, there are combinatorics connections. Yes, there are computer logic connections. Yes, there are set theory connections.)

So the problem of comprehending higher dimensions reduces to adding more entries to a table. You can represent a 400-dimensional cube in Excel—and do calculations about it there, too.

PS How many connectors come out of each point?

PPS R generates the tesseract even easier than Excel:

> booty=c(0,1)
> expand.grid(booty,booty,booty,booty,) #rockin everywhere

   Var1 Var2 Var3 Var4
1     0    0    0    0
2     1    0    0    0
3     0    1    0    0
4     1    1    0    0
5     0    0    1    0
6     1    0    1    0
7     0    1    1    0
8     1    1    1    0
9     0    0    0    1
10    1    0    0    1
11    0    1    0    1
12    1    1    0    1
13    0    0    1    1
14    1    0    1    1
15    0    1    1    1
16    1    1    1    1

hi-res