Subscribe to Make Magazine Today!

helloworldgraph 20080402 Poromenos hello world curve

Take a peek at this curve. If you take the rounded y value for every integer x from 0 through 11, you’ll have yourself the ascii values for the string “Hello world!”.

Well, I have a computer architecture exam in six hours and can’t be bothered, so I figured I would realize a lifelong dream of mine, and make a program that prints “Hello world!” using curve fitting techniques. Enlisting the help of a good friend with numerous mathematical papers under his belt (ostensibly because he could not afford a tighter belt), MATLAB and a longing for procrastination, we embarked on this perilous journey. After many, many hours of fitting and discarding data, I can finally present to you my masterpiece.

It’s 12 characters summed from 10 sines and cosines:

96.75 - 21.98*cos(x*1.118) + 13.29*sin(x*1.118) - 8.387*cos(2*x*1.118) + 17.94*sin(2*x*1.118) + 1.265*cos(3*x*1.118) + 16.58*sin(3*x*1.118) + 3.988*cos(4*x*1.118) + 8.463*sin(4*x*1.118) + 0.3583*cos(5*x*1.118) + 5.878*sin(5*x*1.118)

Poromenos’ blog has the full Python script which evaluates and renders the famous words. Hands down, this is the best math to happen to me all day.

Printing “Hello world!” using curve fitting techniques

blog comments powered by Disqus

Related Supplies at Maker Shed


Get every new post delivered to your Inbox.

Join 28,860 other followers