Archive for the ‘Personal’ Category

To the crazy ones

Saturday, June 27th, 2009

Rocket science in Javascript

Tuesday, June 9th, 2009

Soon we will teach orbital mechanics to school children, stay tuned…

A small vector class for Javascript

Sunday, June 7th, 2009

I have created a small class for handling 3D vectors. It could come in handy if you ever have to do some physics or graphics on a website.

Example:

// Create two vectors
var vec1 = new Vector(1.0, 1.0, 2.0);
var vec2 = new Vector(4.0, 2.3, 5.0);

// Calculate the dot product of the vectors
var scalar1 = vec1.Dot(vec2);
console.log(scalar1); // -->16.3

// Scale vec1 by scalar1
vec1 = vec1.Scale(scalar1);
console.log(vec1); // --> x: 16.3, y:16.3, z:32.6

// Cross product of vec2 and vec1
vec3 = vec2.Cross(vec1);
console.log(vec3); // --> x: -6.519 y: -48.90 z: 27.71

// Get the L2 norm of vec3:
scalar2 = vec3.Norm();
console.log(scalar2); // --> 56.582

// Return vec3 in Spherical coordinates:
sph3 = vec3.Spherical();
console.log(sph3); // --> phi: -1.70, r: 56.58, theta: 1.059

// Calculate ((vec1 + vec2) * vec3) * scalar1
vec4 = vec1.Add(vec2).Mult(vec3).Scale(scalar1);
console.log(vec4); // --> x: -2157.40, y: -14825.50, z: 16982.90

Download here:
Vector

Please post any comments or suggestions.

Wolfram|Alpha

Saturday, May 16th, 2009

Wolfram (the guy behind Mathematica) has launched a cute little Google killer running on multiple 40 TFLOP/s supercomputers. Think of it like an expert system on top of Mathematica with a nice database of every quantifiable piece of information out there (more or less)

I tried a very important question regarding a certain kind of bird just to see if it was in any way useful to my line of work:
Get answers to the really important questions in life!