flipCode - Tech File - Lionel Brits [an error occurred while processing this directive]
Lionel Brits
(aka Betelgeuse)
Click the name for some bio info

E-Mail: britsc@cadvision.com



   03/19/2000, Midgets, Calculus And Dirty Punks


Yo 'sup! I bring you another instalment of "The Bald and the Betelgeuse"! Those of you who frequent #flipcode will know me as Zeroping, Yo momma or 'Ack!'. Well I finally got a haircut, a laser-pointer and a bad case of the snivels. I decided to write another tech-file for all you tech-o-philes out there ;) I'm doing part II of the A+ exam on Monday (which will probably be the day before yesterday when you read this.) I wrote a program for my calculator that factors up-to degree five polynomials, which is pretty cool. Apart from that, I haven't done much coding lately (although I'm still bubbling with ideas)


Achilles and the tortoise; and immortality

Here's some calculus for those of you who find DirtyPunk's tech-files too challenging ;) If we look at the increase in life-expectancy in developed countries over the past thousand years, and we take into account the rate at which medical breakthroughs have been made in the past century, then we should be able to derive a function that models the average life-expectancy over time. L(x) = 0.001x^2 or something. We can also have a function that models our age over time A(x) = x. Now those individuals who are lucky enough to be born at the right time will notice that the slope of L(x) is greater than that of A(x), which means that as they get older, the average life expectancy will be pushed further and further so that they will never be able to catch up with it. As long as A(x) does not intersect L(x), they will always be younger than the average life expectancy. Voila!, Immortality. This only works in theory, so don't go cancelling your life insurance just yet.


GUI and other baby-words

My GUI hasn't really evolved to the point that I may brag about it. Just to update you, I've got the TGA loading almost perfect now (just need to find some decompression algos.) One problem that I'm encountering is the fact that while Windows takes care of most of my memory requirements as well as hardware interfacing, it leaves me with little room for optimisation. Each of my GUI elements have their own bitmap space to draw to, but as soon as they are resized, they require reallocation of memory. This will cause heavy fragmentation, which is hard to work around. I'm considering slapping together a compiler that reads in code that looks rather much like HTML, and exports it as assembly to NASM or something.

<data>
		GreetMessage db 'My Lame Game Challenge Entry!!!', 13, 10, '$'
</data>

<function
	id="main"
	bits="16">

		mov       dx, GreetMessage
		mov       ah, $09
		int       $21

		mov       ax, $4C00
		int       $21

</function>
Well, you get the idea :) I think this can be rather handy for OS applications, as working with large assembly files can be a real pain.


Synthetic division and 16-fingered Lilliputians

Well, I guess someone else already thought of my next idea, but I'll share it anyway. We've been using synthetic division in math quite a lot lately. Dividing (x2 + 2x + 3) by (x - 7) can be a pain sometimes. Using synthetic division:


-7  |  1   2   3
    |
    |     -7 -63 
    |___________
       1   9  66
gives us x + 9, R 66. Go ahead, try it! Now I hear you all saying "What the hell is he telling us this for!?" Well, you can use this same method to divide ordinary numbers when you can't find your calculator ;) Or when dividing numbers that are in the 10^1000 range.

In our example, we can set X = 10 and come up with:

(1x102 + 2x10 +3x1) / (10 - 7). In short, 123 / 3.

Our solution then becomes 10 + 9 + (66)/3 = 41.

123 / 3 = 41

Yay!

Well, this isn't limited to X = 10. You can use this method for hexadecimal division, X = 16, or any other base numbering system. So remember, next time you are stranded on a deserted island and you find yourself teaching math to natives who have 16 fingers, use synthetic division!.


Conclusion

Well, I'm off to play with my laser-pointer, study or code.

May the source be with you,

Betelgeuse





  • 10/18/2000 - A Coder's Insanity
  • 04/17/2000 - My Not-So Tech File
  • 03/28/2000 - EggNBeans, How Do I Love Thee? Let Me Count The Ways
  • 03/19/2000 - Midgets, Calculus And Dirty Punks
  • 02/25/2000 - Strike Two!
  • 01/27/2000 - Introduction

  • This document may not be reproduced in any way without explicit permission from the author and flipCode. All Rights Reserved. Best viewed at a high resolution. The views expressed in this document are the views of the author and NOT neccesarily of anyone else associated with flipCode.

    [an error occurred while processing this directive]