analytics

Tuesday, May 1, 2012

Recursion notation

This is meant to be a notation for doing any operation recursively.
An example:

Or this one equals the golden ratio:
This one is pi-3:
This one is just equivalent to the usual sigma notation for adding over an index:
Anywhere you see a ... you just recurse using the index, thus it handles the job of sigma and pi, as well as the continued fractions examples. When the index runs out it just fills in the expression as it would be without the ...  For example this gives 1.6:
Even with this some continued fractions would be cumbersome, so you can combine with Lagrange's notation:
I thought of using the colon to indicate that after recursing the specified number of times the last ... is replaced with a specific value.










Elementary Parameterization of shapes made of straight lines

First I'd like to introduce this function I made that I call T(p). Here's it written out in full with a couple of graphs for different p values.
The gist of the function is that is 0 everywhere except from p-1 to p+1, where it linearly rises, peaks at a height of 1 and then falls back to 0.

It's a fairly big function but it is easy to calculate and it is made up of only elementary operations, and it's behavior is useful for a lot of applications that I can think of. Here's one example:

Suppose you have these 6 [x,y] points:
[1,1], [6,3.5], [0,3.5],[5,1],[3,5],[1,1]

You can make a function that connects each of these with a straight line between them over time. You make a parametric function:
See how x(t) is basically just T(1..6) times each x coordinate in order? And the same for y(t). Here's the graph, you can imagine if t were going from 1 to 6 it would be drawing this out animated instead of one picture.
Now I realize if each T(p) were written out instead of using this notation this function would be hideous looking but it is still an elementary parametric equation there are just a lot of elementary operations.


Sunday, April 29, 2012

Deterministic generation of normally distributed values

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.


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.

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:
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...
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.