POV-Ray : Newsgroups : povray.off-topic : Memories : Memories Server Time
29 Jul 2024 14:22:35 EDT (-0400)
  Memories  
From: Invisible
Date: 19 Aug 2011 08:00:25
Message: <4e4e5059$1@news.povray.org>
As part of the drive to empty our house of useless crap, I was going 
through some of my old college work last night. Ah, the memories.

I still chuckle at my first few programming assignments. We were 
learning to use Borland Turbo Pascal 5.5 for MS-DOS. The guy teaching us 
only found out two weeks earlier that we was taking the class, so he had 
two weeks to learn Pascal out of a book. Frankly, they should probably 
have just given us that book! (Also, his name was Frank.) He wasn't 
/bad/ at teaching, but it was somewhat baffling to walk into a classroom 
and discover that I know more about the subject than the lecturer does.

The comments on my first assignment indicated that it works well, "and 
you've even added a few extra procedures you weren't asked for" (in 
other words, I factored the problem more thoroughly), "but comments are 
rather sparse". Considering that the entire source code print out was 
literally 3 pages long, there's not a hell of a lot to comment on. No 
non-obvious design decisions or tricky invariants to document. If you 
understand Pascal, the code is pretty much self-explanatory. It's a 
first-year college assignment FFS!

My second assignment is even more amusing. The actual phrase the 
lecturer used was "...the program works, but is a little overly complex 
for mere mortals like me to understand." Oh, I'm sorry, I thought you 
were supposed to be the frigging *expert* that we've all paid good money 
to be taught by! :-P

In fairness, as well as writing the code for the actual assignment, I 
did also write an entire library module that's triple the size of the 
main program, and which allows me to print nicely formatted output. (I 
forget the exact details now. I think it was just number alignment so 
all the decimal places line up.) But I put it in a separate source file 
and made it really easy to read the main program without having any idea 
how the library actually works. And I put comments in the library 
explaining what each procedure does (not that the names didn't make it 
self-evident anyway).

Then again, splitting a program into more than one module was beyond the 
scope of our course. (!) We were never taught the syntax for doing this. 
(It's not like C where you just write more files. In Pascal the main 
program source file has a different structure to library modules. You 
have to declare the public interface, for one thing...)

This experience of knowing what the lecturer is going to teach us before 
he even opens his mouth turned out to be a recurring theme of my path 
through college and university. At the time I just felt smug for being 
better at Pascal than Frank was. By the time I was in my 3rd year at 
university, I was beginning to feel frankly a little outraged that I was 
being charged vast sums of money (tens of thousands of pounds, more 
money than I will ever own) to listen to lecturers who can't speak 
English properly and/or don't have a damned clue WTF they're talking about.

(Not /all/ the lecturers were this bad, of course. But some of them were...)

In one of Frank's other classes, we learned all about binary and 
floating point. The former was of course no longer news to me. Spend 10 
years poking bytes into the control registers of the 6581 (that's the 
MOS Technology Sound Interface Device [S.I.D.] to you) and you learn a 
thing or two about binary, computers, processors, addressing modes, and 
so on. Floating point was all new to me though.

Then there were the lessons on logic gates. (You had to know what they 
are. You weren't required to know what to do with them or why they 
exist.) Again, old news to me, having already spent years playing with 
physical 7400 chips. Taking a harddrive apart was fun though. (And 
probably ****ing expensive, I should think. This is the era when "4 gig 
drives don't grow on trees".)

And then there were the Quants lessons. ("Quantitative Methods") This, 
as best as I can tell from my lecture notes, was simply an orgy of 
mathematics. It's all in the bin now, but I skimmed through pages and 
pages of statistics, polynomials, linear algebra, fractal geometry, 3D 
graphics, Polish reversed lists, chaos theory, cryptography, sound 
synthesis, and God-only knows what else. I should note that only about 
half of this stuff is directly related to anything in the syllabus. The 
other half is just me doodling while bored in class. (Something that 
DJK, our lecturer, seemed to actively encourage.)

I actually found the sheets of paper where I first performed the 
derivation of the binomial theorem from first principles. You cannot 
simply /tell/ me that (A + B)^2 = A^2 + 2AB + B^2. I have to know /why/ 
this is true. And why is it that (A + B)^3 isn't A^3 + 3AB + B^3? There 
must be a pattern. And damnit, I'm going to find it.

This apparently involved drawing a grid:

   +------+---+
   |      |   |
   | A^2  |AB | A
   |      |   |
   +------+---+
   |  AB  |B^2| B
   +------+---+
      A     B

I think you can see where this leads. Next I drew the same thing, but in 
3 dimensions. That took me a bit longer. After that, I wanted 4 
dimensions, but was forced to abandon geometry and simply shift algebra 
by hand. The final expression may be small, but some of the intermediate 
terms are quite large, and it's easy to make mistakes as you repeatedly 
copy and manipulate the terms step by step.

After laboriously tabulating the expansions up to (A + B)^9, it became 
quite obvious what the general pattern was. But what the hell are the 
coefficients? Where do they come from? It took at least another hour of 
shifting algebra around and scrutinising my work before I discovered 
that collecting like terms caused the coefficients to be computed in a 
way exactly matching the definition of Pascal's triangle.

DKJ offhandedly told me that I had discovered "the binomial theorem". 
Consulting the library, I learned that this little puzzle had been 
solved over a century ago. AND FOR NEGATIVE EXPONENTS! >_<

This again is a typical experience in mathematics. Any problem which you 
can imagine has either been solved several hundred years ago, or else is 
impossible to solve. There are no easy unsolved problems. I had the 
feeling of being in the centre of a field of ideas, looking at all the 
familiar, well-known stuff. All the new, unknown stuff would be at the 
far reaches of the field, involving problems so complicated I wouldn't 
even understand the language.

The first time we were in the computer lab, DKJ got us to graph some 
trivial polynomials which supposedly represented various things. (E.g., 
rather than give has a data set representing the company's monthly 
income, he would think up a cubic off the top of his head and get us to 
tabulate and graph that - an easy task for Excel.) I of course was 
bored, and so I ended up graphing my standard incantations. The harmonic 
expansion of various waveforms. The chaotic behaviour of the logistic 
and lambda maps. And so forth. As I recall, it caused quite a stir among 
the chavs I shared a classroom with. For five minutes.

I recall on another day, we had one formula which yields the company's 
income for each month, and another that yields the expenses for each 
month. We were using this to understand the concepts of profit, loss, 
break-even, etc. This was a classroom exercise, so everybody sat 
laboriously tabulating these formulae by hand.

Obviously, I immediately realised that I could directly tabulate the 
company's monthly profit simply by subtracting one formula from the 
other, simplifying the algebra, and then tabulating that. But then DKJ 
wanted us to compute the profit growth rate. I duly tabulated the first 
few months of profit and computed the difference between consecutive 
rows. But I couldn't help feeling that there ought to be a /pattern/ to 
the results.

After about 15 minutes of experimentation, I managed to successfully fit 
a quadratic curve to my data. Literally, I had a formula that produced 
the exact same numbers as the curve I was laboriously tabulating. And 
it's the damnedest thing: the coefficients of this new formula seemed to 
be /related/ to the original formula. Well, it seemed obvious to me that 
such a relationship /should/ exist, but what exactly was its nature?

While everybody else continued the tabulation of growth rate that I had 
long since finished by halving my workload, I picked formulae at random, 
tabulated their growth, and tried to fit curves to them. This is quite a 
lot of work, and I never did figure out exactly what the relationship 
was. At this point, DKJ came over and informed me that I had just 
invented differential calculus, and showed me the general formula for 
the derivative of any polynomial.

I remember being quite suspicious of the perfect constants in the 
expression. "Is that really 3? Or is it 2.986 or something?" No, it's 
*exactly* 3. Needless to say, I went and found a book which explained 
all this in far more detail than the 5 minute conversation I had in 
class, and now I understand /why/ all of these beautiful patterns are so.

While sorting through all this paperwork, there was one assignment I 
felt compelled to keep. The assignment, quite simply, was to write a 
program to "do graphics". Literally, any sort of program you write which 
produces pretty graphics is OK. While DKJ was explaining on the board in 
excruciating detail how to draw a simple rotating square, I was typing 
away at my computer, which I had already got drawing a rotating 
wireframe 3D cube.

It was around this time I was playing with complex numbers. For years 
I'd been baffled by the descriptions telling me that the Mandelbrot 
formula is z := z^2 + c, but the formula is /also/ x := x^2 - y^2 + a, y 
:= 2xy + b. Clearly z = x + yi and c = a + bi. But how do you get from 
one formula to the other? It made no sense, and nothing anywhere 
explained it.

One fateful day, I tried applying the binomial theorem to (x + yi)^2 + 
(a + bi). The result is obviously x^2 - 2xyi + y^2i^2 + a + bi. If you 
replace i^2 with -1 (for that is its defined value), you get x^2 - 2xyi 
- y^2 + a + bi. And if you gather all the terms containing i in one 
group and all the others in another, you get x^2 - y^2 + a and 2xyi + 
bi. Divide the latter through i and its 2xy + b.

Suddenly, it clicked. (No, not my spine!) I spent the rest of the day 
deriving complex arithmetic from first principles. Perhaps the single 
most significant moment was in class the next day. I wrote out the 
Taylor series for exp(yi). Replacing i^2 with -1, I discovered that all 
the terms now alternate between negative and positive. And between real 
and imaginary. And collecting all the reals and all the imaginaries, I 
was shocked to find myself looking at the Taylor series for the sine and 
cosine functions.

At which point DKJ informed be that Euler figured that out almost 300 
years ago. Damnit! >_<

Following our lecture on Polish reversed lists, I wrote a small Pascal 
interpreter. It takes a String containing a Polish reversed list, and 
executes it. You can only include purely real constants and the variable 
names "A", "B", "C", "D" and "Z". The values of these variables are 
passed as arguments to the interpreter function. The interpreter 
executes the expression, and returns the result. It even correctly 
handles complex exponents. (Although they would have to be variables.)

Using this, I added to my graphics assignment a fairly large collection 
of fractal types. I don't think I ever got as far as implementing 
Dijkstra's shunting algorithm (to turn normal algebra into Polish 
reversed lists). But I implemented the usual Mandelbrot and Julia 
fractals, with multiple colouring options (escape time, Z-magnitude, 
epsilon cross, binary decomposition, etc.) And also several other 
fractal types; cubic Mandelbrot, lambda, logistic, lambda-exp and 
lambda-sin.

I read in a book about Floyd-Steinberg error distribution dithering. Now 
remember, we're talking about the era where one of my assignments 
actually asked me about the differences between MGA, CGA and EGA. (For 
you youngsters: That's what we had *before* VGA.) We all did our 
graphics work in VGA mode. So, 16 hard-coded colours available. So I 
went ahead and wrote an FS dithering algorithm, and then adapted my 
Mandelbrot renderer to generate images in 24-bit colour and then dither 
them into 4-bit colour. The results at 640x480 were... well, grainy. 
(Plus I think I had a bug somewhere. The algorithm never worked 
/exactly/ right.) But it was still kinda neat.

I actually /sold/ the code for the Mandelbrot fractal to Graham. Not for 
very much money. And, actually, I didn't give him any code. I just sat 
next to him and told him what steps had to happen, and he coded it. I 
can still remember the conversation. "Now run that loop for every 
pixel." "Wow, for EVERY PIXEL?" "Yep. Now you know why it's so slow!" 
(Mine of course did fancy tracing operations to speed it up...)

My rotating cube went on to acquire hidden line removal. *ahem* OK, 
back-face cull. Which took some considerable research and discussions 
with DKJ to get right. Finally I discovered that it wasn't working 
because it /actually matters/ what order you list the coordinates in. 
O_O Once I fixed that, it worked much better. I then went on to add 
surface illumination calculations, using a simple point source and Phong 
lighting. (Each surface is one flat colour.) With only 4 shades of grey 
to play with, it didn't look so hot. But it was quite neat animated.

I vaguely recall that I did implement something with /real/ hidden line 
removal, but I don't know if it made it into my assignment. I'll have to 
read the sources.


animated spirals and so forth. Needless to say, I got a Distinction for 
that. (The highest mark possible.)

It still makes me chuckle that I enrolled for a computing diploma and I 
spent two terms learning how double-entry accounting works. I've got 
Sage printouts and everything. (That's Sage for MS-DOS, mind you.) I 
still remember the login password. It was "letmein".

Then there's heaps of stuff about the relative merits of Ethernet verses 
Token Ring verses something else. As far as I can tell, that's a format 
war that has long since been won my Ethernet. Does *anybody* still use 
token ring? How about ATM, is that still used?

(Come to think of it, *all* of the networking stuff at college was done 
by Novel Netware. Now there's a name I haven't heard in a long time...)

There was one assignment called "computers in society". I didn't 
actually read the assignment, but the lecturer's comments were amusing. 
"A wonderful, almost poetic report. I would be delighted to receive 
writing of this calibre in my professional life." He then goes on to 
offhandedly mention that I didn't actually cover all of the required 
aspects. And yet, I got a Distinction? LOL!

I briefly flicked through the report I wrote. Obviously produced with MS 
Word 6. One sentence has been highlighted and the guy wrote next to it 
"beautiful!" The sentence reads:

   "The computer is to information as the power loom is to fabric."

Aside from that, the report isn't well written at all. The tone is very, 
very informal. Like, if you imagine being given a topic, and just 
monologuing about it to your friend off the top of your head, 
videotaping that, and then rearranging the sentences into a more 
coherent order with a word processor... that's what I wrote. 
Distinction. Heh, well I guess it *is* only college...

Also: If you think my spelling is bad *now*, you have literally no idea 
how abysmal it used to be! (E.g., I can spell "abysmal" now. :-P ) And 
that was when I was a teenager, obviously.

Some of the lecturer's comments weren't so friendly. (Actually, some of 
them weren't legible at all. That has to be some kind of fail, right 
there!) Deanna wrote something about "Task A shows technical brilliance, 
however task B is still not acceptable, even on this second attempt, and 
even though I told you which research sources to use. This just isn't 
good enough Andrew. You simply must improve in this area."

Oh? Oh really? You think so? Do ya? Yeah? Well let's see how you like my 
SHREDDER!!! Muhuhuhuh!!! Take THAT, Selby! Yeah, you like that?! Not so 
smug *now*, are we? Now that your acidic little smartypants voice has 
been minced into a thousand tiny pieces. EAT METAL!!! >:-]

Ahhh. To quote H. Granger, "that felt good".

In summary, all the assignments to do with programming computers or 
solving equations gave me exemplary marks. Everything else brought me 
dismal failure. A pattern that was to be repeated at university, come to 
think of it. Well I guess that's tomorrow's tidying task.

I'm particularly proud of the grade I got for my second programming 
module at uni. I got a D for that. (On an A - F scale.)

You see, due to the faculty secretly moving the notice board and not 
bothering to tell me about it, I missed all of my exams that term. Every 
single one of them. And that meant I failed all my modules and had to 
retake them.

Well, all except one. You see, for my programming module, my coursework 
grades were *so* damned awesome that I actually PASSED THE MODULE 
OUTRIGHT WITHOUT EVEN TAKING THE EXAM. And not only did I pass, I got a 
D. Not an F. Not an E. But a D. Without even sitting the exam. I'm *that 
good*, bitch! ;-)

And then there was that database class. The one where Ian says "There 
are various levels of normalisation. I mean, you've got 2NF, 3NF, 4NF 
and even higher ones. But generally, you only really need to worry about 
Boyce-Codd normal form, which says, ANDREW..."

I stand up from my seat in the front row and enunciate "...every 
determinate must be a candidate key..."

"...thank you Andrew. Now as you can see[...]"

That was a feel-good moment. When even the lecturers know you're a 
damned walking encyclopaedia. ;-)

...and now I'm feeling all nostalgic about the long-lost days when I 
could just sit in a corner reading about Gaussian elimination or 
something while the lecturer blathers on about the role of middle 
management or whatever. I could do crazy math stuff, and people would be 
*impressed* and stuff. My college notes are literally a fermenting sea 
of equations. Serious work mixed up with doodles and advanced math. I 
have nobody to impress anymore. :'{

(Although... I wonder how much of the praise I received was actually 
justified. Especially at college, when I was in a class full of chavs 
who went out and got drunk *every day*. They'd be hung over for the 
morning classes, and mildly drunk for the afternoon ones. Is it any 
wonder the lecturers though I was brilliant?)



Go on, admit it. You thought this was going to be about SRAM vs DRAM, 
didn't you? :-P


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.