I thought of this way to generate a series of numbers with a normal distribution without using any random numbers. First of all consider the numbers 10*pi, 100*pi, 1000*pi, etc... if you consider just the decimal part of each of these they vary uniformly between 0 and 1. *This hasn't been proven but it is believed to be true* Also consider 10*e, 100*e, etc.. with the same notion in mind. I wrote a floor function previously that I'll be using for this post. Then all that remains is plugging those for the two variables U and V into the box-muller transform.
Now my final equation is:
The values for t=1..10:
0.5426654684
0.9042166471
-.2031938572
.1624766993
0.6677675887
0.4311350734
-.1788312781
0.8176724812e-1
-.4680815243
1.275914647
...
it could generate numbers forever but I believe they will tend to a normal distribution. Either that or pi and e aren't as random in their decimal digits as they seem, either way I find it interesting.
analytics
Sunday, April 29, 2012
Monday, April 23, 2012
Square Map
This map, as best I could preserves every border between states but as you can see every border is an integer length. You can check with this map:
I have the feeling it's always possible to do this no matter the map but I haven't thought of an easy proof yet.
I have the feeling it's always possible to do this no matter the map but I haven't thought of an easy proof yet.
Sunday, April 22, 2012
2nd order interpolation
You start with a collection of heights or intensities that you want to find an equation for:
You find an interpolation for each row:
Notice the 3 equations are of a similar form but they differ in the coefficients. My idea is to interpolate the 3 related coefficients in the y direction. Like the *x^2 coefficents are -3/2, 1/2, -7/2 so we can find the equation in y that produces those 3 values where we want them to occur on the y axis...
Then for the other 2 coefficents...
Then make one big equation substituting the equations in y for the coefficients of the basic formula:
You find an interpolation for each row:
Notice the 3 equations are of a similar form but they differ in the coefficients. My idea is to interpolate the 3 related coefficients in the y direction. Like the *x^2 coefficents are -3/2, 1/2, -7/2 so we can find the equation in y that produces those 3 values where we want them to occur on the y axis...
Then for the other 2 coefficents...
Then make one big equation substituting the equations in y for the coefficients of the basic formula:
That's the same equation I got doing it the other way in yesterday's post!
This goes smoothly through the specified grid of z values.
Friday, April 20, 2012
Quadratic surface fitting
At one time I came across the need to do something like, say I had these 9 z values like heights on a map...
The 3 equations end up being:
For points (-1,-1),...(1,1)
What I want is some function in x and y that matches these heights. Today I thought of the way to do that. First, interpolate and find the three quadratic equations one for each row. Maple can do this with the polynomial interpolation command.The 3 equations end up being:
Now the trick I use to link these 3 equations together smoothly is I think, I would like the first equation to be valid when y=-1, and not when y=0 or y=1. I can interpolate the 3 points (-1,1),(0,0),(1,0) and multiply the first equation by that curve, and similarly for the other two:
Then I can make the whole equation by adding the 3 equations in x each multiplied by their corresponding y equation:
it simplifies to:
(You might have to click and zoom in to have a look)
The graph is:
Examining it is does go through the 9 points smoothly. I think a similar method will work for any number of points producing a corresponding equation in x and y, the highest power being the number of points in one row minus one.
Tuesday, April 17, 2012
Non-algorithmic floor and ceiling functions
It's always kind of annoyed me when you need just the first digit of a decimal or you want to round up to the next whole number that you always seem to have to use floor or ceiling functions that you can't use ordinary techniques with because they are sort of outside of usual calculus. So anyway I came up with these conversions:
Floor(t) = t-u(t) where u(t) =
You see, if your t = something like 4.673, at that point this function equals .673, so you just subtract that and get your floor value.
Then there's the Ceiling function or round up,
Ceil(t) = t+U(t) where U(t) =
They are kind of messy but at least it gives you the power of floor and ceiling without stepping outside of calculus.
* One caveat is that the function is undefined at the exact whole numbers. I guess it depends on how you define floor whether the floor of 4.0 would be 3.0 or 4.0 but with these equations putting in whole numbers is equivalent to a divide by 0.
*If you look on wikipedia you can see the equations that led to these equations, they are the result of an infinite sum of sin waves (you have to scroll a ways down under "Series Expansion),
http://en.wikipedia.org/wiki/Floor_and_ceiling_functions
but they don't mention that that infinite sum has a closed form and the problem they mention of the whole numbers giving a value halfway in between doesn't come up, these are instead undefined there.
Floor(t) = t-u(t) where u(t) =
You see, if your t = something like 4.673, at that point this function equals .673, so you just subtract that and get your floor value.
Then there's the Ceiling function or round up,
Ceil(t) = t+U(t) where U(t) =
They are kind of messy but at least it gives you the power of floor and ceiling without stepping outside of calculus.
* One caveat is that the function is undefined at the exact whole numbers. I guess it depends on how you define floor whether the floor of 4.0 would be 3.0 or 4.0 but with these equations putting in whole numbers is equivalent to a divide by 0.
*If you look on wikipedia you can see the equations that led to these equations, they are the result of an infinite sum of sin waves (you have to scroll a ways down under "Series Expansion),
http://en.wikipedia.org/wiki/Floor_and_ceiling_functions
but they don't mention that that infinite sum has a closed form and the problem they mention of the whole numbers giving a value halfway in between doesn't come up, these are instead undefined there.
Subscribe to:
Posts (Atom)