Fred Sampedro

Welcome to my website

This website was a personal project I developed when I was a Computer Science student in my free time. I was interested to learn how to code a personal website with plain html/css and basic javascript and cgi scripting.

Currently, I do not have time to update this website. You can contact me at and visit my updated profiles in:

Frederic Sampedro ResearchGate profile

Frederic Sampedro GoogleScholar profile

Frederic Sampedro LinkedIn profile

Mind-blowing code

Sometimes one reads a piece of code like:

float InvSqrt(float x) { union { float f; int i; } tmp; tmp.f = x; tmp.i = 0x5f3759df - (tmp.i >> 1); float y = tmp.f; return y * (1.5f - 0.5f * x * y * y); }

And stares at it while the following catalytic succession of descripting adjectives occur: odd,useless,curious,interesting,elaborated, magic, brilliant.

The code is a faster way of computing 1 / sqrt(x) More info here.

Einstein's Brain

After meeting some of his outstanding relations, formulas and theories in some courses (specially photonic devices), I'be been reading about Einstein. This man definitely deserves an entry here.

Einstein    Just like Leonard Euler appears in lots of classical mathematical contexts such as analysis,number theory,graph theory, applied mathematics,physics,astronomy,logic... Einstein is present in lots of modern physics areas: thermodynamic fluctuations,statistical physics, general and special relativity,photons,wave-particle duality and theory of critical opalescence among others.

  Probably one of the best books I've ever read is an Euler biography, Euler: The Master of Us All. I'm currently searching for an Einstein's one written in the same style.

So one immediately notes that something in his mind was different from anyone else's. It is quite curious to find out that his mind was indeed distinct. It seems that his brain has some significant differences with the classical one. Check this link.

It was really curious to met Einstein again in an anatomy course! When I least expected it!


Quite a few without posting here. I've been watching more of the most visited courses at the extremely hooking ocw MIT website:

18.06 Linear Algebra

18.03 Differential Equations

18.085 Computational Science and Engineering I

5.60 Thermodynamics & Kinetics

7.012 Introduction to Biology

I must admit they are not as Walter Lewin or Donald Sadoway lectures but Eric Lander really made me feel the genetics in all its glory. I've currently changed my virtual source of knowledge to academicearth where I'm following a classical Anatomy course with Marian Diamond, as I finally started my Biomedical Engineering Degree this semester.

I must blame Mac OS X as three of my macbook santa rosa arrow keys are not working for a firmware update issue. When programming, I need to attach a USB keyboard in order to use the arrow keys. This is not acceptable in Apple, I could understand it in any free package like Ubuntu (where I decided to stop updating when after spending almost a month till I got all my hardware working), but it really dissapoints me in a Mac OS X environment.

bless $internet

One cannot stop watching MIT lectures on science and technology:

18.02 Multivariable Calculus

6.002 Circuits and Electronics

6.046J / 18.410J Introduction to Algorithms

I'm currently changing my target to chemistry,biology,bioengineering lectures because as soon as I can I will pursue a biomedical engineering degree.

I really recommend this course:

3.091 Introduction to Solid State Chemistry

The guy is hilarious and always ends the lecture talking about some up-to-date topic related to the chemistry that has just taught.

I recently discovered which is really another source of interesting material on the net. I specially liked:

Jeff Hawkins on how brain science will change computing

Kwabena Boahen on a computer that works like the brain

Physics works!

If a student says "I find physics boring and dull", it simply means only one thing: they had a bad teacher. Any good teacher can turn physics into something absolutelly spectacular. (Walter Lewin)

Some weeks ago I discovered on youtube probably the best set of physics lectures ever. Walter Lewin makes you feel the physics. There are three courses available which you can find in the following links:

8.01 Classical Mechanics

8.02 Electricity and Magnetism

8.03 Vibrations and Waves

I'm now finishing 8.03 and I must admit those lectures have hooked me.

The power of regex

perl -le 'print "PRIME" if (1 x shift) !~ /^1?$|^(11+?)\1+$/' 1234

This amazing perl one liner (posted by Abigail at comp.lang.perl.misc) uses a regex to check whether the number passed as argument(in this case 1234) is prime.

It shows too things: First,the amazing power of regex in general, and in particular backreferences and backtracking. And second, the fabulous mind-blowing examples that arise in perl culture due to the TMTOWTDI philosophie.

Barcelona perl mongers ( at in IRC) showed and explained it to me, and then I started reading Mastering Regular Expressionsi(Jeffrey E.F.Friedl) to try to get into this powerful weapon, which provides both a practical tool and can act as a brain catalyst.