(For sake of sanity, please don't turn this into a huuuuuge GTKYN!)

Here's my try - this uses Octave. I tried to write this (apart of the polynomial-fitting stuff) in C, but I "ran out steam" so to speak (maybe I should try this in Fortran or something...)

What it does? Well, it takes the ASCII values of the string, interprets that as a series of number (Y coordinate for X each coordinate 1, 2, 3...), finds a polynomial of 13th degree that fits the data, evaluates the polynomial for each X, converts results back to ASCII, and displays the string.

(Evaluation is done automatically by polyfit, stored to evald... Handy, that.)

To run, store this to a text file "helloworld.oct", and run it:

octave> source "helloworld.oct"
Hello world

Also, if you run it with "want_plotted=1;" before the source command, it plots a kewl graph for you with GNUPlot!

Final disclaimer: I'm not a mathematician (math is hard), but I know a doomed-to-fail programming approach when I see one. =)

Without further ado, here's the stuff...


# -*- octave -*-
# This is just about the most hideous and complicated way of printing
# "Hello World" I can think of for the moment...
# Feel free to abuse the idea.
# By Weyfour WWWWolf (Urpo Lankinen), 2001-02-04
1;

letters = toascii("Hello world");
[p, evald] = polyfit([1:11],letters,13);

if (exist("want_plotted"))
  plotx = (0:0.1:25)';
  polydata = [plotx, polyval(p,plotx)];

  chardata = [(1:11)',letters'];

  gset grid xtics ytics;
  gplot [0:13] [0:255] \
      chardata with points title "desired values", \
      polydata with lines title "fitted curve"
endif

disp(setstr(evald))

Note that this simple "encryption" is highly unstable if you need characters other than upper-case-only or lower-case-only... In this example, if you look at the graph that it produces, the space "yanks" the graph to a wild wave. I was unable to add the exclamation point because the curve was so curved... this sort of problems could be avoided with simple change of encoding to some other that is less varied.

Then again, the whole graph thing here is pretty... absurd. AND probably someone has patented this stuff in USA because it's so obvious and sounds cool... =)

(I really should turn the polynomial evaluation and the polyfit result coefficient floats into a nice, 300-line C program that no one really can make any sense of...)