Monthly Archives: September 2013

best two inventions

forget language, fire, the wheel, writing, mathematics, agriculture, music, electricity, penicillin, fashion or computers.

the best two inventions of humans are, in this order, the bed and the shower. period


i need to buy a new laser pen. you know, one of those you use during presentations or reviews to point in the projection screen. but i don’t want it for presentations or reviews. i am giving them a very different use.

i’m a night person. i work best during night, when my brain is fresher and the world is silent (during mornings i can only process basic stimuli, respond in monosyllables, crawl myself to work, and hope they don’t notice i am not really there). when i’m not working i am still a night person, cause that’s when i am sharper and most awake. interestingly enough, it is at night too when the weirdest creatures of the city emerge to take the streets. and in those nights that i am home myself and i hear the night fauna growl, laugh, vociferate, discuss, sing, fight, and when do it for a long time somewhere by my apartment, that’s when i employ my red laser pointer.

because… there’s nothing like switching all the lights off, go to the window behind the curtains, and from the anonymity point the laser at their head or face (if there’s two people), or to their chest (if there’s only one drunk individual alone). when they notice their reactions are diverse, but generally it is freaking out, screaming, and start running away from the red dot which, of course, i make sure follows them for a while.

and it’s not that drunk people annoy me really, i don’t mind them much in fact. it’s just that it cracks me up seeing them shitting their pants. it’s the mischievous side of me i guess?

i need to buy a new laser pen.

mathimage #34: distances

Distance is an important concept. In its most simple form, distance measures how far apart two points are. Depending on the definition of “far apart”, distances take different forms.

If the length of a straight line connecting the two points is chosen as a measure of distance, then one ends creating the geometry as the Greek knew it – the same geometry architects and engineers use still today. However, one can measure distance also as “time”: for example, May and April are close, but May and November are far apart. More weirdly, distances sometimes can wrap: and so, while floor 1 and floor 12 are very far apart in a 12 story building, 1 and 12 are very close to each other in a watch. Lastly, distances not only can wrap, but can curve beyond the straight line as well, that’s why airplanes going from Europe to America do an arc. Distances can be taken in anything that can be measured and sorted in some order. For example, you can take distances of political philosophies, as in liberals and democrats are closer to each other than liberals and republicans are.

In general, in mathematics at least, the shortest path between two points is not necessarily the straight line, and the definition of distance is flexible and can be changed on demand. When doing so, things that are defined in terms of distance obviously change. It’s like seeing things with different glasses. For example, circles are one such thing that changes when the definition of distance changes. A circle is the points which are at an equal distance from a reference “center” point. When the shortest distance between two points is defined as the length of the straight line connecting then, one gets the shape of a circle that we all are used to. However, when one defines other metrics of distance, the circles change shape and become more like squares, or stars.

This quick mathimage of this week (which I made during dinner, hah!) shows exactly that: cool and warm colored circles for which the definition of distance has been modified, which makes the circles change shape, from rounded squares (if that makes sense), to stars. The size of the “circles” is driven by animated noise, so the whole structure moves in a funny way (press “play” to see it moving).

a geometric interpretation for the quadratic equation

I just discovered one of those gems. It was right there, a bit hidden, a bit shy. But it was so cute! See:

Given a quadratic polynomial , you surely know how to solve the equation from school. Most probably you memorized it:

But you can make a very cool geometrical interpretation out of it – that when solving the quadratic (or cubic) equation what we are really doing is looking for a rectangle (or a box). I had never seen it until last night when I was thinking of and toying with quadratic and cubic equations.

To see it, lets first note that in the case of the quadratic we are looking for two solutions/roots (which we’ll call r and s), meaning we can write our quadratic function as too. Now, if we multiply distributively, group the terms by powers of x and match those to the coefficients of the original equation, we get that

So, one could interpret that we are looking for a rectangle with sides r and s with area c and perimeter -2b. To find what the geometrical interpretation is for the famous quadratic equation solution, we can start by looking at the discriminant . This is clearly telling as to take b, ie, the segments r and s, and form a square with them, then substract four rectangles of size c or rs:


The remaining rectangle in the center is the discriminant (b² – 4c, “one square of side b minus 4 rectangles c“). We are interested in its side , because we have to add half its length to the central point b/2 of the segment r+s to reach r and s for = (r-s)/2.

In the case of the cubic equation similar things happen. When we rewrite f(x) as and we multiply and group terms, we arrive to:

which sort of tells us that the solution to the cubic is actually a box with sides r, s and t that add to -b, that has a surface area of 2c and the same volume as a cube -d.

dog god

whenever i have a dog i’ll call her God (i know dogs are “it” in english, but i refuse to not employ “him” or “her” with them). i’ll call her God for a few reasons.

first, because “god is just “dog” read backwards. second, because both dog and god seem to be the best friend of man (only that one of them is imaginary). third, because it must be hilarious walking her in a park full of people and shouting aloud “goooooood, listen to me, come heeeeere!!! ” when she runs away.

oh no no nooooo

When in a meeting or gathering, and you get up the sofa or move a bit and the rubbing with it makes a noise that sounds like a fart, and then you desperately try moving and doing the noise again so it gets clear to everyone that it wasn’t a fart, but you miserably fail at reproducing it…

Yep, so unfair. But funny nevertheless!

mathimage #33: woods

I sketched a forest last two days. Yes, I spend two sessions on this one (3 hours each!!), far more than usual. It has been mainly a fight against the web browser, more than the maths or the art. Basically, I wanted to add a lot more detail, but every time I would extend my formula by any little bit, the web browser would crash. So in the end I had to give up, simplify things, and leave only the essentials in the image. No room for better scenography, for example. Still, it turned out being a pretty cute mathimage. How wouldn’t it, forests with fireflies and mushrooms are always cute.

About the maths: the trees are cylinders with an exponential radius (to make them thicker at the base), plus vertically stretched heavy noise. The ground is a plane plus some noise plus exponentials near the trees. The mushrooms are spheres scaled down vertically. The set dressing is pretty repetitive and regular as I said (you can see that if you click and rotate the view), I had no room to make it organic or work on grouping.

Probably, the more interesting bits are the occlusion signal, which is fully procedurally painted (no rays casted nor distance functions evaluated), and the key light. For the key light, I did the most awful of the tricks ever… Please don’t judge me for it, but… the key light changes direction across the scene. Basically, the foreground is lit from a different direction than the background. These two lighting directions smoothly blend into each other based on the distance to the camera. It’s as if light was bending over space (hi Einstein!). I know… I’ll one day go straight to the hell of computer scientists and burn there in (procedural) fire forever.


a bit more criticizing about this wonderful place that i love, in the form of a joke (borrowed from my cousin):

Somewhere in the US, after a thorough examination…
– So, doctor, is it serious?
– Do you have money?
– No
– Yes

(third world problems in a so called first world nation)

may be they are just dreaming

some people claim they can take control over their dreams and drive them to their pleasure.

i wouldn’t totally discard that possibility, but still their assertiveness makes me smell they are being fooled by their own dream. for example, what if they just had dreamed they were under control. or even better, what if random things might have been waved normally in their dream without any control from their part whatsoever, and that only a posteriori when they think of what they dreamed they construct the delusional sense of control they never had?

i have two reasons and facts for me to be skeptical: first, it is of humans nature (and evolutionary interest) to detected and see causality everywhere, even where there isn’t (prove – we have religions). second, we still think too high of ourselves and our abilities to act consciously.

lack of inuition for units

over here there seems there’s a tendency to not measure things with units but by comparisons to other objects. crazy, i know! but yeah, the truth is that hearing things like “the crater was big like two football stadiums” or “elephants are as heavy as trucks” is pretty common.

i wonder if this strategy of replacing measures with comparisons is the result of some people’s inability to use units comfortably. could it be they never developed an intuition for measures and sizes and units? that would render them measure-illiterate, and that’s why they would be resorting to comparisons, just like in ancient civilizations? i’m just trying to make sense of the facts. but in any case, i am tempted to claim that this (joke of a) measurement system they have in place here is part of the problem.

now, today i found the gem of the gems in this regard, written somewhere in the internet: “it was as heavy as a sixteen-pound bowling ball”. which blows my mind. because, apparently, the “it was as heavy as sixteen pound” wasn’t concise and intuitive enough…

for some reason it reminded me of that quiz adults back home do to mock young kids or “Captain Obvious” sort of people , that reads “which color was the white horse of Santiago?”. Only that this time it’s not really a quiz to mock anybody, but part of how things actually work here. i’m still confused about it all.

mathimage #31: oldschool recipe

When you take any shape (say, a sphere) and you apply a transformation to it, and you fold/branch it, and then keep doing it (in theory forever), chances are you get fractal. You know this if you played with IFS fractals and Julia sets back when they were popular in the 90s. The recipe works in almost all forms, including a rotation and translation (transformation) followed by an absolute value mapping (folding/branching):

I made this one last night, relatively quickly, for I faked almost everything that has to do with lighting: there are no shadow rays, occlusion or indirect lighting going on. Orbit traps are used instead for surface coloring and occlusion darkening.

compact and not too asymmetrical

Hm, after some simplification, the cubic power of a quaternion becomes:

q^3 = q·(4·q_x² – {3,1,1,1}·|q|²)

(where the 4-way products here are component wise multiplications), or in other words,

vec4 quaternionCube( in vec4 q ) { return q * ( 4.*q.x*q.x - vec4(3.,1.,1.,1.)*dot(q,q) ); }

which is surprisingly compact, and not as asymmetrical as one would expect perhaps.

Also, it seems to be generalizable to complex numbers, z^3 = z·(4·z_x² – {3,1}·|z|²), and to reals as well.