analytics

Monday, December 7, 2015

Faster method than Newton-Raphson

This will be considering a replacement of the Newton-Raphson method for better performance changing:
to:

First recall that the Newton-Raphson method started as a generalization of the Babylonian method for finding square roots... I'll start the same way by showing this method speeds up finding square roots...

Starting with a reasonably close approximation to the square root of N such as the closest perfect square, one can first use this formula where x is the estimate.



For example with an N of 61, we can chose x to be 7 because 7^2=49 is close to 61 and then:






Now recursively use the formula again:






Which is very close to the square root of 61 compare:


After 2 iterations it's already accurate to 9 decimal places! Two iterations of the Newton Raphson method with the same initial conditions only correctly estimates 3. In fact it is better than 3 iterations of Newton-Raphson by a couple of decimal places...There are 7 arithmetical steps per iteration of this method and 5 for Newton-Raphson, so two iterations of this method take 14 arithmetic steps and get a better result than when Newton-Raphson takes 15 arithmetical steps, and Newton-Raphson would need 20 arithmetical steps to improve upon two iterations of this method... I think the difference becomes more marked when extreme accuracy is needed or when just the amount of accuracy that this method gives over Newton-Raphson is needed... And of course when very many of these calculations are needed...



So for another example if f(x) is 2*e^(x)-3 starting with a guess of .5 and doing two iterations we get:

That is very close to the actual root of:
Three iterations of Newton's method only correctly gets 5 decimal places right for more arithmetic...


Wednesday, December 2, 2015

Possible commutative pairing function

My conjecture is that given a,b positive integers:

is a positive integer unique to the pair a,b except for exchanging a and b...

I tried proving it a few different ways but really I don't know why it seems to work. I looked at many examples where it holds and usually there are 3,6,9, or 12 solutions over the integers but except for a,b and b,a one of the two integers is always negative...  Maybe the proof is simple, if 12 is the most solutions there can be and you know two solutions will both be negative integers, and 8 will have 1 negative and 1 positive integer, that only leaves two to be positive, but I wasn't able to get to that... Maybe also there's an argument from the symmetries that have to exist, I don't know...
For 3,4 the solutions are:




Friday, November 27, 2015

Distribution decomposition with normal curves

The formula I found to decompose a distribution into normal components, similar to how the Fourier transform decomposes a wave into sine and cosine components is:
Where n is the number of points to be interpolated... So if we know the value of the distribution say at x=1, 2, and 3 we evaluate the above with n=3 and those values for x1, x2, x3:

Now we can evaluate the above at each of x=1,2,3, with our y values of let's say .9, .7, and .8 respectively, and solve:
Now we can plot the solution:


Sunday, November 22, 2015

Preference Wheel on the complex plane

This example is for giving a person the task to rank their 3 favorite choices out of 10 possible choices labeled alphabetically... The data is as follows:

The above data means the first person chose their favorite to be choice e, their second favorite to be choice d, and their third favorite to be choice b... And the second person chose their favorite to be choice i, and their second favorite to be choice g, and their third choice was b... Etc...

So I thought to make a preference chart where a person's 3rd favorite always comes halfway between their first and second favorite on a circle... First I solved these equations:



In complex numbers on the unit circle this is saying the variable in the right hand side of each equation is the point on the circle halfway between the two variables on the left hand side around the circle... And the last equation a=1 is to disallow rotational symmetry we set one variable to equal the real axis...

There were quite a few solutions, but most were trivial that all the variables equal 1 or 0 or all real number solutions, the two interesting ones are mirror images across the real axis, one of them is:


Which plotted on the unit circle is:
And see that it encodes the information perfectly for example that f is halfway around the circle between j and e, when two variables are equal the halfway point is either equal to either or on the opposite side of the circle..

So once plotted the question is can we extrapolate that someone who listed, for example, a and e as their first two favorites, which was not information given, will usually like h as a third choice... I'll have to find a real dataset to statistically determine whether that is the case or not...

Thursday, November 19, 2015

Multidimensional projections on 2d plane

For 3 dimensions you can imagine that A,B,C are your 3 dimensional axes turned in such a way that looking at them they appear like this:
Define a point P on the plane to be P=a*A+b*B+c*C, with a,b,c values from the sliders...

Then we can look at all the ways to fix 2 of the sliders at 1 or 0 and move the 3rd, and tracing the paths they make gives:
Which is the "shadow" or projection of the 3d cube on the plane...

Now what if we have four orthogonal axes, so that their projection on the 2d plane looked like this:
We can define P to be P=a*A+b*B+c*C+d*D
There are a lot of ways to hold all but one of the sliders fixed at 1 or 0 and move the other one, doing so traces this onto the plane:
This is the projection on the plane of a 4 dimensional cube! 

Monday, November 16, 2015

Knowing SSA of triangle find other 2 angles approximately without inverse trig functions

This is for when you know 2 sides and an angle of a triangle and you want to find the other 2 angles approximately without using inverse trig functions...
The formula is:
In addition it gets 45-45-90 and Equilateral triangles exactly right! The 180-C can of course be replaced with pi-C when working in radians... There might be a kind of 3 variable Cauchy series that this uses averages of the first two terms of, I'll have to look further...

Saturday, November 14, 2015

Simple point in polygon test

I've seen a few ways to test for whether a point is in a convex polygon or not that necessitated using inverse trig functions, but this one is all easily calculated the distance functions can be left without taking the square root and just comparing distance-squared instead...
R and L are exactly the points you get when you rotate he line AB 90 degrees around it's midpoint... I think the nice thing is how the reasoning might extend to 3d convex polytopes with L and R making a line orthogonal to each face...