analytics

Wednesday, March 20, 2013

Finding the number of integer points on a curve

I found this function that works very well for indicating whether a number is an integer or not:

It evaluates to 1 if a number is an integer and something close to 0 if a number is not.
For instance:
f(.999999)~=0.00002+.00001I
f(1)=1
f(1.000001)~=0.000004

So you can see the transition from near 0 to 1 is very close to the integer in question. 

I think this function could be useful in a lot of situations but here is just one example. Suppose you want to know how many integer points there are on a circle on a grid like so:

you simply:

This is just plugging the equation for the circle into the function I described, and it outputs:
12 + 3*10^-30

So very close to 12. 

Indeed there are 12 integer points that lie exactly on the circle:




Monday, March 11, 2013

Extruding a polynomial


I happened to wonder whether you could take any polynomial like for example:

and write it like this, as linear factors multiplied and summed:

As it turns out with this polynomial it was possible, I just set the two equal at 20 different points and solved for the 20 variables...

And the coefficients are:

I found it interesting that all of these coefficients are real numbers, I'm not sure if it's ever necessary to use imaginary numbers or not. I called it extruding the polynomial because it reminds me of the way steel can be shaped by squeezing it through an aperture, in this case a linear factor aperture :). 

You might wonder why I didn't try to make z:
Maple wasn't able to solve this one even with so many less variables...



Saturday, March 9, 2013

Map from planar graph

I'll describe the steps I took below this picture...


Step 1: start with a planar graph
Step 2: Plot the midpoints of every line connecting points of the graph
Step 3: Connect midpoints that are connected to the same vertex of the original graph, also draw new lines around vertices on the outside of the graph. to those midpoints. This will leave some regions without a vertex from the original graph inside, color those black....
Step 4. Draw lines from the vertices of the black regions to their centroid. 
Step 5. These new lines in addition to those you had drawn around the outside of the graph complete the map. 

Tuesday, March 5, 2013

Solving a 2d heat map progression over time

Starting with the idea that the fundamental solution to the heat equation with one variable is:
\Phi(x,t)=\frac{1}{\sqrt{4\pi kt}}\exp\left(-\frac{x^2}{4kt}\right).
I've derived this equation for a kernel about the point (a,b) on the plane where M is the peak magnitude, k is a constant that depends on the material, and t is of course time.

As a check consider this kernel based around the point (0,0) with k=1 and t=1 and an initial peak of 4, one would expect the integral over the whole plane would be equal to 4 because heat can not be created or destroyed....
A graph at that point in time is:
Now I imagine that the heat over the plane starts off as a function T(x,y) let's say it is this function:
So we have a dome of heat.

I'm imagining that the amount of heat from every point on this function spreads according to the kernel and is integrated like so:
The amount of heat at point (x,y) is the sum of all the kernels of heat around every other point on the plane.
M in the equation is T(x,y) and (a,b) is anywhere within the square (v,w) (p,q)...

So if k is 1 and t is 1 and T(x,y) is the function given, then:


which Maple still can't solve for the general (x,y) so we would have to look at a particular x,y like -3,2
In my original plot some of the temperatures were negative. 

So anyway this gets pretty computationally expensive as you solve for every point on some grid of (x,y) values, but in the end you would have an approximation of the heat map after t seconds. 


Continuous matrix multiplication

I thought of this, consider two functions in x,y like for example these:

The first matrix is defined over an x range of -10..10 and the second over a y range of -10..10, so I figured as long as these match then with this formula:

We can do a continuous analogue of matrix multiplication. The height of each function at every point is the value of each matrix in each of it's infinite cells. Then the formula given sums the product of each item in the row in the first matrix with each element in the column in the second matrix just as you would with regular matrix multiplication.

The result:

I'm sure that there is an identity function for this operation, but I'm not sure if or what for example a function that rotates the original function after multiplication would look like...



Sunday, February 24, 2013

Oscar thoughts and Historical Fantasy

Oscar thoughts: 1) I think they should move all the behind the scenes stuff like best production, best cinematography, best musical score, best original song, best costume design, best special effects, etc... to the ceremony they do the night before about the other technical stuff and then they could spend more time on some of the important things that always feels rushed like best foreign film, best documentary, best short film, and add a couple like best comedy, best action film, i don't know what else. 2) Does Seth McFarlane have split personalities or something, it's hard to believe that's the same guy that does Family Guy 3)A couple of the commercials were pretty good, that like 10 part commercial about the zombie unicorns was cool I get tired of seeing the same commercial every commercial break, so it's nice to see one that tells a whole story. The long awaited sequel to the Grey Poupon commercial was funny.

 I thought of some more categories that would be good, best historical drama, best biographical movie alternatively best movie based on a true story, best love story, most faithful adaptation of a novel, best big budget movie...

Best totally made up story set during a serious time like the holocaust or when there was slavery that shows things the way you would think they might have been or end the way you would really want them to instead of how they actually were. Quentin Tarentino would have won that the last two years and who knows maybe the next few lol.

Not to pick on Quentin Tarentino there have been thousands of movies fitting that exact description, U-571, Tombstone, Life is Beautiful, any war movie made in the 50's of which there must be a thousand alone, Gladiator, Spartacus, I guess all the movies based on the Bible, etc....

I thought maybe it would be called "historical fiction" but it says in the wikipedia article that that includes "with due attention paid to historical setting and fidelity" whereas the genre I'm talking about has way more artistic liberty.

"historical fantasy" maybe would be good



**I was trying to see how blogger handled copying and pasting facebook comments I made , not very well it turns out...



Thursday, February 21, 2013

Drorrings


I've been trying to learn how to draw, these are the ones I've done so far in chronological order...