Math Toolkit for Real-Time Programming
Who & What
Jack W. Crenshaw, Ph.D. (Physics) wrote his first computer program in 1956 for an IBM 650. He has been working with real-time software for embedded systems ever since -- contributing several years to NASA during the Mercury, Gemini, and Apollo programs. In addition to other activities, he is currently a contributing editor for Embedded Systems Programming magazine and author of the Programmer's Toolbox column.
In Math Toolkit for Real-Time Programming, his effort is focused on describing the pitfalls of vendor-provided math libraries and providing robust replacements. In section one he gives a thorough overview of constants and the various manners in which to declare them, naming conventions, and error handling. As the work progresses, in section two, he builds a library of proven algorithms ranging from square roots to trigonometrical functions to logarithms. Did you suffer through calculus in college with a barely passing grade? Section three will teach you more about numerical calculus in a half-hour than you may have learned in three semesters.
KudosMath Toolkit is written in an easy to understand anecdotal manner. You might be tempted to think that the author was animatedly relating the history of computing square roots while having lunch with you. This method works very well and keeps what could be a rather heavy subject from becoming too much of a burden. Most chapters have historical tidbits liberally sprinkled throughout.
Even if college algebra left you with post-traumatic stress disorder, you will not have any trouble with section two. Indeed, you may find yourself intently following the author on the trail of the perfect arctangent algorithm -- much as a sleuth on the trail of a villain.
The depth of knowledge shown, and its presentation, is exceptional. The author's years of experience are evident in his self-confident writing style. You will rarely see a clearer overview of numerical calculus. QuibblesThe cover of the book states: "Do big math on small machines." This, combined with the Real-Time Programming phrase in the title, might lead one to believe that the book's primary audience is intended to be the embedded microcontroller crowd. Sadly, not so. There is very little here for the die-hard assembler programmer other than some very handy integer square root and sine routines - and these examples are in C++. Based on the cover, I would have liked to see a greater emphasis on processors lacking a floating point unit. Also, some code examples in pseudo-assembler would have been welcome, as the author chose C++ as the language of choice for all examples.
CrimesAs is so often the case nowadays, there are various typographical errors scattered throughout. This seems to be an epidemic in current technical books. Fortunately, it didn't affect the readability of Math Toolkit.
ConclusionsI believe Math Toolkit for Real-Time Programming would be a great, perhaps mandatory, addition to the bookshelf of anyone that is involved in writing code that has a heavy math component. Other than the somewhat misleading cover, I cannot find anything truly negative to say about this work. Congratulations are in order to Mr. Crenshaw on a job well done.
The book also includes a CD-ROM of all example source code. In reality, to get the best benefit from the book, you should mostly ignore the CD-ROM and work through the examples. To quote the author: "Never trust a person who merely hands you an equation."
Table of Contents
- Getting The Constants Right
- A Few Easy Pieces
- Dealing with Errors
- Fundamental Functions
- Getting the Sines Right
- Arctangents: An Angle-Space Odyssey
- Logging in the Answers
- Numerical Calculus
- Calculus by the Numbers
- Putting Numerical Calculus to Work
- The Runge-Kutta Method
- Dynamic Simulation
- Appendix A: A C++ Tools Library
I received a review copy of this book from the publisher. Thus, my loyalties and opinions may be completely skewed. Caveat Lector.
You can purchase Math Toolkit for Real-Time Programming from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Back in the day, a book like this would have been a real life saver for those of us slugging it out with brain-damaged operating systems (e.g. MS-DOS). From things like MIDI sequencers to guidance systems, the need for real-time speed was a real issue.
However, with the the maturity of operating systems, many of them now include device drivers, APIs, objects and other goodies that insulate the average programmer from the hassle of issues like latency. So my question is, other than good academic study, would it pay for the rest of us to spend the $$ on such a book?
Though I admit, having to write my share of real-time apps back in the day has me curious enough to put the book on my wishlist.
--- have you healed your church website?
I remember when having a solid math background was de reguire for a programmer. Of course, I'm talking the mid 80's, engineering school and Fortran, so I'm kind of krufty.
I wonder how much better could we be if coders knew basic math, if they know how those little bitty chips actually computed the sine of something instead of assuming it works. We would probably have rock solid operating systems without all the glitzy GUI stuf..
How does the book compare to the classics: Numerical Recipes, The Art of Computer Programming, etc?
I remember when having a solid math background was de reguire for a programmer.
And I remember when being able to spell the words they used was de rigueur for anyone with an education.
I'm surprised to see it posted on /., though, because he's pretty harsh towards the gaming community. In fact, he says near the beginning that game-related technology in CPUs (MMX and so forth) is taking away much-needed brainpower from research that should be reaching towards making chips do more math per unit time (not to mention driving up production costs for toy-obsessed, joyless loners). He calls for an immediate end to the pandering that Intel et al do to get into the pocketbooks of the socially-inept, technology pseudo-elite and wants real reform in the area of empowering science.
Powerful stuff.
I wonder how much better could we be if coders knew basic math, if they know how those little bitty chips actually computed the sine of something instead of assuming it works. We would probably have rock solid operating systems without all the glitzy GUI stuf..
Huh? What's the use of sine in an OS besides to draw glitzy GUI stuff?
Funny this topic should come up. I just did a 'Store Locator' for the company I work for (I'm the IT Manager, belive it or not). All I have is your basic HS diploma, and in creating the search, I realized I don't know a damn thing about sine and cosine. I don't know how they're used, or how they're applied. I have a feeling that they're somehow related to geometry (which makes sense, seeing I have to get a distance between two points on a curve - the earth), but I'm not sure.
Sure, it's probably taken me longer to write this post, than it took to find the php code I used as a basis for the search, but how much math is REALLY needed overall?
I slept through school, I did really bad, all because I felt it was worthless. I did feel that my business class, business law, and basic Algebra has been useful. But overall, it wasn't worth my time. Hell I had a physics teacher who'd pick on me because I was flunking (it's amazing what good test grades + 0 homework does to you), but I just found physics interesting - jeez, it was only HS. I was testing the waters, not padding my GPA. I believe that's what's HS is FOR.
And if you KNOW what you want to do (I knew I wanted to fix/program computers when I played on my Apple ][ in 6th grade), what the hell is college for?
The ease of the internet sure hasn't helped my perception.
Am I the only one?
"I can't give you a brain, so I'll give you a diploma" - The Great Oz (blatently stolen sig)
When I went for my Comp Sci bachelor's I was amazed at how many math-phobics there were in my Comp Sci classes. As part of earning the degree you had to take 4 specified math classes (Calc 1 & 2, Linear Systems, Probability). You only had to take one more math class to get a minor in mathematics, Calculus 3.
Now I've always been big on math but I was kind of surprised at how few people were willing to take a single class to earn a full-fledged minor.
The Forth literature contains many examples of high-performance hardware-integer-math-only routines. A core feature of most Forth algos is rescaling to a power of two space at the start of the algo and from it at the end. This allows bit shift operators to do their stuff. It can take non-trivial fiddling to rescale algorithms - hence, it's nice to just look them up.
Unfortunately, it's tricky to find Forth books these days.
That's a shame, because along with Smalltalk, Lisp and APL, I think Forth is one of the "mind expanding" languages all programmers should at least experience, instead of just deciding C/Java/C++/VB is the one true language.
And noone but engineers would be able to use the os. ;-)
Wait! We're back in the early 80's again! =-)
/.Mattsson - My native language is not English, so please don't whine over linguistic errors. (That's lame anyway...)
I don't know of other programs, but I know at the University of Waterloo (where I am a computer science student), we must take quite a lot of math courses, ranging from linear algebra, calc, classical algebra, combinatorics & optimization and statistics. The math content for the CS program is very high, and in the end you get a BMath degree.
Maybe this is different at other schools (well, actually I know it is at most, most don't do nearly as much math), but I would hope not. I think to be a solid programmer a solid math background is a requirement.
oh, and btw, for anyone nitpicking, UW now offers a BCS program, as well as the typical BMath Honours CS. The BCS seems to offer a bit more flexibility, so BCS students may not choose to take 'as much' math.
The reason Santa is so jolly is that he knows where all the bad girls live.
A year (or so) ago I attended a lecture given by Guy Steele (of Lisp/Java/ Crunchly fame) on his proposal to alter how IEEE floating point numbers are mapped to real numbers. It quickly flew over my head, but gave a great insight into the whole field. Steele then had a fair old "discussion" with the one person in the audience whose head hadn't been overflown (sic), as there was plainly still much controversy left in this area. On trying to do some "why didn't I get this stuff at college" reading, I found there wasn't a great deal of literature.
The reviewer's concern that coprocessor-less systems should be covered is valid, but I'm not sure going as far as assembly is necessary. For example, I once had the privilige of reading through Hitachi's libm implementation for their H8 series microprocessor/microcontroller (one would be generous to call H8 a 16-bit system, and ungenerous to call it an 8-bit system). With one small exception (I think the cos table lookup) the whole thing was in (quite readable) C, and (at least for basic libm stuff) performance was perfectly acceptable. For didactic purposes, a C (or sane C++) implementation would be the thing one would want to find in a book - I get very annoyed at embedded books where the examples are written in asm for the author's favourite (obscure) microcontroller.
## W.Finlay McWalter ## http://www.mcwalter.org ##
Is this Crenshaw the same guy who wrote that compiler tutorial, the mini-epic that lasted a decade? His aim was to guide budding compiler writers in the direction of creating a native Pascal compiler. His style was lucid, informative yet friendly. I think timothy's words, "self-confident" aptly describes it. I'd recommend anyone to the works of Crenshaw and I agree, his knowledge of the subject areas is always superb.
Pete
We would probably have rock solid operating systems without all the glitzy GUI stuf..
And we do have those today... if that's what you need. And we also have glitzy GUI-based OS's for the people that need them.
But you seem to be drawing a very bizarre conclusion in the first place. Are you saying that coders that don't know basic math tend to develop GUI-based operating systems?
And how deep do you want to go? Even if you think you know how the chip works, well... you're really just assuming that all those registers and address lines are working by magic. But if you really want to understand how those itty bitty chips work, then you have to know how transistors work, what their slew rates are, how flipflops work, and you have to be able to describe how charges move across a PN junction for all of the above to work. And to know that you'd need an understanding of how the doping compounds affect the behavior of your semiconductor crystals in the first place.
Embedded != Assembly coding.
To be honest, a lot of embedded coding is done with C or C++ these days. I've been following Crenshaw's articles in Embedded Developer magazine for years now. He explains a lot of what they try to teach in college Calc, etc. in simple, practical terms, and reduces it to usable algorithms.
I'd probably buy the book and add it to my shelf.
I am not merely a "consumer" or a "taxpayer". I am a Citizen of the State of Texas
Lets write a compiler! is a good tutorial. I wouldn't have wanted to try and follow it as he was writting it (Some chapters are many years apart!), but these days you can easily read the whole thing (If you don't mind the fact that its writting in Pascal and targets the 68000 CPU).
As you say, the style of writing is warm and friendly, and he takes his time to properly explain the concepts. A very good writer.
But to get a job writing computer graphics software, or audio processing, or designing any sort of embedded hardware, knowledge of advanced math is required. The people who want to do this kind of work pursue higher educations, and if they enjoy what they're doing then that's great, too.
Karma: Bored. (Thinking about resurrecting the "Anyone else is an imposter" joke.)
I'd agree with the former poster that the industry would be MUCH better off if programmers actually had a clue how to:
A) Create superb programs
B) Fix them
and
C) Put some thought into the design so that others can use-, understand and change it easily.
not
Just hack something up and yell 'FINISHED!' when it seems to run "Good enough".
I graduated as a Math/CS double major from Drake University, where almost all CS majors also got a Math degree because the CS prereqs covered all but 3 of the Math prereqs. It has actually helped me enormously as a programmer to know math: in the past month, I've needed transformation matrices, sine/cosine stuff, and a bunch of other things that, granted, could have been lifted verbatim from Google groups, but it's often faster (and the code is better) if I just do it myself.
That's it. For those who want the quick link for the Let's Write a Compiler, right here (http://compilers.iecc.com/crenshaw/.) I really hope that Crenshaw might write again about compilers. I agree with the Pascal and 68k part -- they're old, and even some of the approach taken by the tutorial is probably not up to speed with modern practices. But hey, at least it gives a good historical account.
Pete
I've been programming since 1968, and very little had anything to do with math. People give me the same line, wow, I'm no good with math, I couldn't program, and don't believe me when I say computers add and subtract, multiply once in a while (array subscripting usually), and hardly ever divide.
Scientific or engineering programming, they need the math because they are math programming. The rest, forget it, maybe you add some numbers for a shopping cart, multiply for sales tax, but programming has little use for math.
I learned long ago that when an 8 bitter needs trig functions, you use a look up table generated externally.
Infuriate left and right
As for the title, I agree it's a bit misleading. The book has pretty little to do about real-time (in fact nothing, as far as I could see). What it really should be called is "Computer arithmetic and a little of numerical methods for dummies". This book will help you understand how to write your own libm, and give you some ideas for more advanced tasks, but that's about it.
For me, who didn't know much of this stuff, it was very interesting. It will probably not save you that course in numerical algorithms (which I for one haven't taken), but even then, it will probably contain some interesting tidbits you didn't know.
On the other hand, if you have years of experience in writing computer math routines, it will probably quickly become dull, but that's true about anything you already know.
And if you KNOW what you want to do (I knew I wanted to fix/program computers when I played on my Apple ][ in 6th grade), what the hell is college for?
Good luck getting your next programming job without a degree, cuz I'll be right there outshining you. (which isn't hard if you don't even know what sine represents...)
But don't bother getting a degree or anything, I like having the competition be clueless.
It's not that trading raw power against development costs is unreasonable where that choice exists - far from it - but rather that hand-waving away questions of efficiency on the assumption that God (or Moore's Law[1]) will provide is a sure recipe for the sort of bloated and near-unmaintainable messes that are so common today. A Mbyte here, a Mbyte there, an assumption that the compiler will find and optimize the invariant components of loops... if you're not careful these all start adding up to measurable numbers "why is this so s l o w . . .")
[1]And, of course, one can always paraphrase Parkinson's Law for IT: programs and data expand to fill the processor power and storage available.
Well, that sounds a bit belittling. I think building networks (I'm beyond admin, I just do EVERYTHING - including PBX) can be just as difficult as programming, and you get the same rewards.
I don't really grind out anything. Hell, I put up a TV antenna last summer, and hooked up the security cameras to a linux box for motion detection around xmas. I'd much rather be doing 90 different things, than concentrate on programming in 'X'..
Maybe I should have left out the 'Manager' part :) (I'm just the only one here.)
Then again, maybe I AM that good, and you're all just jealous! muhuhuhahaha! :)
"I can't give you a brain, so I'll give you a diploma" - The Great Oz (blatently stolen sig)
How did you write the search function? Did you come up with an alorgithm on your own? Did you use a prewritten, off-the-shelf search routine?
Note that I'm not making judgements here, I'm just underscoring the point that there are some jobs that require certain knowledge, and others that don't.
And FYI (so you can impress your coworkers and/or significant other <g>): The sine of an angle refers to the y-coordinate of the point at which a line drawn from a starting point at that angle would intersect with a circle of radius=1 drawn around the starting point.
Karma: Bored. (Thinking about resurrecting the "Anyone else is an imposter" joke.)
I won't bash you like some of the other replies to your post, nor will I give you hope that you can advance past a limited set of jobs in the IT industry.
College (esp for computer engineering and CS) fundamentally teaches you:
1. How to solve problems
2. A toolset (ie math, algorithms) to go about solving those problems
True, you may not ever use calculus, but as a computer scientist you will use matrix theory because it is the best way to solve some problems.
This is not only for scientific/research either. If you try to write anything performance related, you'll have to use higher math. Computer science ain't easy.
Let me stress again that college teaches you about your subject matter and how to solve problems for it. You can come up with this stuff by yourself, in my experience only a tiny percent working without a college degree will ever accrue enough to offset what they missed in college.
Why, o why must the sky fall when I've learned to fly?
What came out as a belittling tone probably slipped through because I know that colleges around the country are churning out graduates with BSes in Information Technology or similar majors, all of whom are going to be going after YOUR JOB. Now it sounds like you've got a good mind and a good head start in the IT world so I wouldn't be too worried, but just know that your field isn't going to be getting any less competitive.
Cheers!
Karma: Bored. (Thinking about resurrecting the "Anyone else is an imposter" joke.)
Bn.com has this book listed at $49.95. Amazon has it for $34.97
Save your self some money!
I'm definetly a fan. Getting +5 on a troll like that is really a work of art.
Keep on the good work.
Thanks for not bashing, and please don't think I'm attacking when I say this but:
If anything was learned from this post, it's that there are a lot of PROGRAMMERS who read Slashdot. IMHO, Programming in itself is a limited set of jobs in the IT industry.
Let me stress again that college teaches you about your subject matter and how to solve problems for it. You can come up with this stuff by yourself, in my experience only a tiny percent working without a college degree will ever accrue enough to offset what they missed in college.
You post sounds depressing, but don't worry about me, I'm all set (maybe I'm even in that small percentage). Maybe I'll go back to college when my kids are teenagers. I'll still be less than 40. :)
Yes, I did EVERYTHING early - against the grain, thankyouverymuch
"I can't give you a brain, so I'll give you a diploma" - The Great Oz (blatently stolen sig)
As a biz-app programmer, I am bothered by too much attention given to floating point math and not enough to decimal math. A decimal-centric approach would give better results for monetary calculations, because any truncation and rounding are at decimal (base-10) boundaries instead of base-2 boundaries. It gives results more like one expects doing it by hand on paper, which shapes most peoples' perceptions of what they expect (and the customer is always right, even if they are boneheads).
The only library I know that supports it is the BC-library sometimes used with PHP. (Well, I guess you could say that COBOL has such also.) It actually uses strings to hold the results so that there is no machine-based limitation on precision size. Plus, that improves its cross-language use since almost everything supports dynamic strings these days.
(Not the fasted approach I suppose, but most biz apps are not math intensive anyhow. Most code is devoted to comparing strings, codes, and ID's and moving things around from place to place. IBM used to include decimal-friendly operations in its CPU's. Those days seem gone for some reason, yet biz apps are still a huge domain.)
Table-ized A.I.
For what I've seen, I think they're mostly programmers and MCSE's. That's not too damaging to me. For practial, in-house purposes, I can pickup whatever I need programming-wise. I completely understand I won't be programming games, or advanced simulations any time soon (Hell, you can find my pitiful posts on wine-devel about trying to get FoxPro running.. rick@v a leoinc). But those positions always seemed like a small percentage of the market as a whole. Everybody needs a network, internet access, firewalls, phones - infrastructure. It just seems like a bigger target to me.
Fortunately for me, most people I run into are sorely lacking on what I would lump together as basic infrastructure.
(but at this moment, I have to put php aside,so I can figure out an EDI issue with FoxPro) I love having so many different things. How many EDI people know PC's? Networks? The consultant who interviewed me for this job didn't know many, so here I am!
Ok.. enough of the ego-boosting stuff for now :)
Personally, I think experience can replace college. You just have to be resourceful, and create a resume that shows it. I think I did a good job doing that.
Now, Social Skills OTOH....It would have been good for me to live in a dorm for a few years. I dormed weekends with my girlfriend - which got me to where I am today, family-wise :)
So maybe it wouldn't have been such a good idea to live in a dorm :P
"I can't give you a brain, so I'll give you a diploma" - The Great Oz (blatently stolen sig)
Software midi?
Mr. Crenshaw is also the author of the popular Let's Build a Compiler series of articles a while back.
These articles don't go into a lot of the complicated stuff that's involved in modern compiler design-- Crenshaw keeps it simple, keeps it straightforward, and still produces a working (if not optimizing) compiler by the end of the second or third article.
No, it won't let you code a C compiler that will beat the pants off of gcc or Borland's latest offering, but the end result is pretty useful.
May I be the first to say, that is a sad Math minor. You should at least need to get to Number Theory or Algebra and Real Analysis to qualify for a Math minor. Those five classes are (or should be) requirements for any science course, including Comp Sci.
Fortran programmer...oh yeah. Array math for life!
it's de rigueur not de reguire. In french, i sound like e and e sounds like uh.
FWIW, There's a lot of people out there who don't think too much of numerical recipes: http://math.jpl.nasa.gov/nr/
Interesting at my university you can't earn a minor by choosing courses that overlap in different programs... well this is in Finland.
For example my current major is theoretical computer science and one of my minors is pure maths. Many courses in discrete math are part of both programs, but I have to choose which program I want to include these courses in. So if I take all courses in discrete math and I include them in my major, I get no credits for them to my minor, so I still have to study a minimum of 20 credits of math...
Anyway I've noticed myself that most comp sci students study only the math they have to i.e. Single/Multi Variable Calculus, Complex Analysis, Linear Algebra, Algebra, Set Theory, Logic, Graph Theory, Combinatorics and Probability. Almost no one takes further courses about the theory of generating functions, stochastic processes, mathematical logic, set theory or basic analysis like topology , measure theory, functional analysis etc.
Also few people study the theory of real-time systems or the theory of parallell and distributed systems still most of them have to code multithreaded programs when they've got their M.Sc. and start working as programmers. Most just choose a few practical courses about these subjects and ignore the theory.
When I have, I've never needed anything beyond what I could find in a textbook or online in less than 5 minutes.
Heck, I've practically never even had any reason to use floating point math over that period of time.
Sure, there are lots of areas where you do need maths beyond what you can pick up from a book in 5 minutes, but there are far more where maths is irellevant.
Beyond basic algebra, maths is just another set of domain knowledge that you'll need to aquire to do particular types of software development, not something that is an inherent requirement in order to be a good coder.
For those who don't support Slashdot's Amazon embargo, here's their link to the book. Not only are they selling the book for $35, they have 25 sample pages, including the entire index and the first half of the first chapter. (And no, I'm not in Amazon's affiliates program and don't make a dime if you buy the book using the link that I provided, as a quick glance at the URL will prove.)
:wq
It will depend really on what you call yourself. I am an engineer and I have been programming for almost 25 years however my background is definitly skewed towards scientific programming. You can even see it in the sequence of programming languages that I learned over my career:
BASIC->FORTRAN->ASSEMBLER->PASCAL->C->LISP->XLISP- >C++->JAVA
I don't call myself a programmer, but an engineer who programs. This is because you will notice there are some importand tools missing from the above list. Things such as PERL which we know that every real programmer would have in their toolbox.
"player 4 hit player 1 with 0 stroms"
I think this prepared us pretty well for what would be a more theoretical-type CS career (i.e. not just going to work as a programmer or web developer, but also continuing on to your masters or PhD).
Some of the ideas the department was real big on was proving correctness, for example, by induction. Instead of giving you a compiler and API and saying here, do this, they made you write it out and actually write a proof about why/how your program works (now imagine people actually doing that, for their OS's CreateProcessEx function!).
Your code may do the job, but does it do the job efficiently? And if it didn't, how would you know?
I changed majors from CS to Mathematics halfway through because I realized that programming is easy; you can always learn a new language or a new technique by picking up the appropriate O'Reilly book on the subject. But writing good programs -- programs that are robust, that scale well, that do as much as possible as quickly as possible -- is really applied math. And math is hard.
You simply have no idea how much you don't know, and with the attitude you have, you probably never will.
The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
Funny, I'm someone with a lot of mathematical training (Ph.D. in Applied Math) but only a few courses in computer science. Somehow, I've managed to pick up a humungous amount of CS along the way, things like algorithm design and analysis, designing and coding industrial-strength C/C++ libraries and applications (yes I get paid for this), high-performance computing, OpenGL coding to roll my own volume visualization apps, doing all of my own unix system administration, setting up all of my own hardware...I've always thought that the best way to become really good at coding and software engineering is to first get a degree in mathematics. If you can do that, the rest is easy.
(Okay, I am a bit biased; I'm a college math professor, and in addition I do a lot of research and consulting related to numerical computation).
All is Number -Pythagoras.
Holy crap! Who would do assembly because they like it? As Brian Fellows would say, "Thats CRAZY!"
A year (or so) ago I attended a lecture given by Guy Steele (of Lisp/Java/ Crunchly fame) on his proposal to alter how IEEE floating point numbers are mapped to real numbers. It quickly flew over my head, but gave a great insight into the whole field.
Steele is God. He also invented Scheme, wrote the original Common Lisp manual, co-wrote with Harbison a classic reference manual for C, and wrote parallel languages for the Connection Machine.
On trying to do some "why didn't I get this stuff at college" reading, I found there wasn't a great deal of literature.
This is widely considered a good introduction.
But what kind of programs? Like another poster said, math isn't really involved in the mainstream too much anymore. The dealer locator is the only thing that has made me think of anything math related in quite a while.
I also didn't spell out my duties. While the inital post may be directed at programmers, how many programmers are directly affected by math? I don't just program, and my programming isn't very intense. I've taken ONE week-long C++ crash course, and that's it. While I still haven't done anything in C++, I've done things in FoxPro, C, PHP, Perl - simple stuff. Want an example of what I've done? www.havokmon.com/stuff. Little blurbs. Nothing major. I didn't need advanced math, and yes, they apply to my job :)
How do I compare with the rest of the industry? I don't know. I have NOT worked for a company that produces applications. I have worked for companies that produce their OWN applications. The only app I know of that had any intense math in it, was a 'sales tool'. You could visually zoom in on any locations on a US map, and get population, sales density, and some other figures. I'm SURE that required heavy math. But that's one app out of MANY.
You make a good point, and I understand where you're coming from. But IMHO, database knowledge is much more important. If you want to know if it's efficient, you watch it execute. If it seems fast enough, it's fast enough. Remember the 90/10 theory. I learned a long time ago (from Netware server performance, actually) that spending 90% of my time trying to tweak out 10% more performance really isn't worth it in the end.
Now, if you're talking embedded systems, or console game programming - ok. But otherwise there are WAY too many constantly changing variables to try and tweak stuff over 90%.
YMMV :)
"I can't give you a brain, so I'll give you a diploma" - The Great Oz (blatently stolen sig)
How many EDI people know PC's? Networks?
:-)
Almost everybody in the EDI field sort of stumbled their way into it accidentally.
I used to be the primary EDI guy where I worked a few years ago, but I haven't touched it since. I think I can still look at an unparsed 850 (X12) transaction set and tell you what's on it without thinking about it, and writing a program to parse all those nested loops is pretty fun. I can probably belch out a 997 FA after chugging a pint of beer. That would impress a very small number of people, unfortunately.
But I also know a lot about PC's (served time doing desktop support) and a little networking.
-CausticPuppy "Of all the people I know, you're certainly one of them." -Somebody I don't know
But by "math" the reference is almost always to calculus.
But math is not just calculus.
Math includes (and this is a MINIMAL list :
- algebra Every program using symbols to represent things that might vary is using algebra. Algebra isnt just manipulating big expressions to find values of x and y - it is really about using names to refer to values. (For example x=y+1 is fundamentally an algebraic expression.
And there's more - check out Glassner's "Digital Image Synthesis", or Knuth's "Art of Computer Programming", - find places where mathematics is not mentioned. Let alone such things as wavelets, the Mandelbrot set, grammars, text (or UI) layout, automata (and on, and on, and on...). I can show you a very hard mathematical problem (which I'm still working on) based on an algorithm you all know, but that is often coded incorrectly.boolean logic Using logical expressions and understanding what they do is just the predicate calculus. Using logic languages (prolog primarily) is, well, logic.
Linear Algebra Try to program more than minimal graphics without linear algebra.
The structure of numbers computing square roots and the like. This kind of computing also typically involves calculus and its relatives
Calculus many parts of computational mathematics, including things like square roots, sin/cos and the like. Also, finding tangents and normals to surfaces which is a big part of reflection models in graphics. The logic involved is also used in the analysis of algorithms.
logical reasoning Every time someone writes a loop or a recursive function, they are essentially using mathematical induction (albeit informally). Propagation of pre/post conditions (not just in procedure calls, but on the statement to statement level is also logical reasoning (and informal proofs).
Fourier analysis Fourier analysis is essential in image manipulation (including compression), graphics in general, Most algorithms involving sound processing also rely on fourier analysis
Graph Theory Where doesn't graph theory show up? Dependency graphs, path algorithms of all sorts. Trees are graphs. Garbage collection involves graph theory. Programs are (on several levels) graphs. The internet as a network is a graph. Websites are graphs (and it can be interesting and revealing to look at them as such).
Number Theory Cryptography!
If you're not doing any of these things, you may be programming, but you're probably not programming well.
Juris Hartmanis said (half jokingly) in his Turing Award lecture that "Computer Science is the engineering of mathematics" I think its about as good a definition as any I have ever heard.
If all programmers new math there would be too much competition for those of us who do, not to many H1 - B's that can do physics simulation, stocahstic analysis etc., I'm glad an old dude can still find a niche in the post dot-com apacolypse. Mark
It's pretty easy to see that the author is a heavy follower of the KISS philosophy.
You mean he wants to rock and roll all nite and code every day? Sweet!
KISS rulez, Man!
GMD
watch this
Hehe, I'm coming from the opposite direction: A little BASIC on a TI99/4a, a little Apple ][ hardware install, a little PICK navigation to FDISK and boot to my games on my mom's PC, hardware, networking, OS...
At this point, my next 'advanced' task is to write a replacement shipping EDI application. Java I hope, but I don't see any advanced math coming into play. You know what's really scary, sometimes I forget (like now) what you call the base of a number, without the decimals. Is that an integer? Pretty bad, but I haven't needed it. I can't even remember what I used in my C++ class last month.. Not an int, a float? ah well.
Maybe when I get to OpenGL programming, which I assume may require algorythm design, I'll go take some math classes :) But I don't see that day coming any time soon.
At this point, with advanced math, I'm like Sean Connery in 'Indiana Jones and the Last Crusade',
"I wrote it down so I wouldn't HAVE to remember".
"I can't give you a brain, so I'll give you a diploma" - The Great Oz (blatently stolen sig)
Well, see, I'm a database guy too. I split my day pretty much equally between SQL and PHP. A lot of people may not consider that "real programming." I do, and in fact I've done some pretty heavy-duty scientific application programming in that past, and I'm here to tell you, I use my math skills just as much now as I did then. Because I don't just write queries and interfaces; I write them with absolutely fanatical attention to detail, and I subject everything I put up on my company's server to the kind of rigorous scrutiny I learned in set theory and algorithm analysis classes. And as a result, it works, and it works well, and on the rare occasions that something doesn't work as well as it should, I know how to fix it. The bigger applications get, the less meaningful the 90/10 theory really is -- for very big applications, a whole of bunch of seemingly trivial speed and scalability tweaks add up to big improvements down the road.
The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
I used this book as one of the references for my Game Developer Conference course on "Faster Math Functions", and the book is good but has holes. Crenshaw's style shows his crusty old engineer roots at times - his coverage of Mininax polynomials is way behind the times and he seriously needs to get into Mathematica or Maple as his basic high-precision tool.
Work by Tang on combatting destructive cancellation in range reduction, the new semi-table based exponant and log methods, Intel's research into using Estrin's Method based SIMD for evaluating polynomials or Muller's book on Elementary Functions are beyond Crenshaw's experience, and it shows. This is a homebrew book rather than an introduction to the state of the art. More information at SCEA R&D Website.
Jack should just about be a household name. When Apollo 13 went berserk, NASA dusted off some calculations of trajectories that he had previously done (he was no longer working for NASA) and used one of them to bring the astronauts back.
You're doing the modern-day equivalent of ditch digging. Ditch diggers have never needed much education. If you're bright, you'll get by. That hasn't changed in 1000 years.
I'm not saying this to pick on you; I'm trying to make a point that a lot of folks regularly overlook: the nature of unskilled work has changed over the years.
75 years ago writing algorithms to be implemented by machines was a big deal, and it took a great deal of education to be able to deal with the sort of abstraction required. People who did it were able to command quite a bit of money.
Today, children can do many of the basic ``web development'' and ``system administration'' tasks by the time they're old enough to be legally employed. Do you really think that's skilled work? 100 years ago, those same kids would have been bobbin-tenders in a Manchester spinning mill.
I think that getting some more education would probably go a long way to make your life better, and might make you a more interesting person. It probably won't help you in your present job, but it might help you get a better one.
Here's a free hint for code monkeys: If your only value to your employer is your skill at the currently trendy programming language, you can be replaced by a 16 year old, and probably will be when the programming language of the day changes. If you want to have some respect, and some security, become skilled in some field such as physics or engineering (or chemistry, or mathematical genetics, or anything which is HARD). Let the coding be the tool which lets you do what makes you valuable to your employer, rather than the only value you can provide.
A free trig lesson:
Draw a right triangle, with the right angle on the right, and one point up, and the third point to the left. Look at the angle on the left. For that angle, the length of the side opposite to it divided by the length of the side opposite the right angle is a constant, HOWEVER BIG THE TRIANGLE IS. That's right, the ratio is determined only by the angle, not the lengths of the sides. If you know the length of one side and two angles, you know all there is to know about the triangle.
See what I've been reading.
hehehe I think you oversimplified what I do based on the little PHP I posted. I would be an expensive ditch digger. But that doesn't change my opinions.
I liken IT to being a mechanic. You've basically said I can rotate my tires and change the oil, the same thing anybody with a car should KNOW how to do. While that's true in the real world (I'm not much of a mechanic, I spend all my time at a computer!), I'm more like your Dealer's lead mechanic, who's been doing this for 15 years.
Sure the new guys may not know much about carbs, just like your new collge grads can't move TSRs to upper memory without using Quarterdeck products, but that doesn't disqualify the experience of the lead mechanic. Just because the lead mechanic doesn't know every detail of the engine, as much as the original designer at GM would, doesn't mean his position is in jeopardy.
I think this whole slew of posts is based on perspective. I'm in the middle (lead mechanic), and you guys are doing the engine design at the parent company. From your position, it's critical, but I don't see the point (unless I want to get into engine design).
There was a nice troll about competing with me for a programming position. That's a perfect example: I don't want a programming position. I have what I need now, a little of everything. I wear all the hats. I just wanted to know if others were at my perspective. Maybe everyone else just likes to concentrate on one area.
Maybe I have ADD, because I can't do that :)
The trig lesson is nifty, but because I have no use for that information, I'll forget it instantly (kinda like the physics stuff). Thanks anyways.
If you want to have some respect, and some security, become skilled in some field such as physics or engineering (or chemistry, or mathematical genetics, or anything which is HARD). Let the coding be the tool which lets you do what makes you valuable to your employer, rather than the only value you can provide.
I have yet to work anywhere that thinks that way. I'm not challenging you, but employers I've worked for (two major, I admit) haven't found that necessary. Credit Card processing, and manufacturing/distribution, just don't have a need for heavy math. If you WANT something hard, that you haven't listed, learn how credit card processing works. It's not an easy path to follow.
Personally, I don't need the respect. Only having to work 40hrs a week (because I've made everything work, and people aren't changing things out from under me), and going home to my kids is all I need.
Hell, the fact that I'm 28, have 3 kids, married my HS sweetheart, and Manage IT (even for a small company) with a HS diploma is enough anti-"the way you're supposed to do it" for my own personal ego trip. (And I don't have school loans, nya nya :P)
"I can't give you a brain, so I'll give you a diploma" - The Great Oz (blatently stolen sig)
nobody measures angles like that
"The cover of the book states: "Do big math on small machines." This, combined with the Real-Time
Programming phrase in the title, might lead one to believe that the book's primary audience is intended to be the embedded microcontroller crowd"
No, it would lead one to believe this is for the real-time crowd. Embedded isn't synonymous with real-time.
Lord Kelvin put it best (though the notebooks of Lazarus Long come darned close):
Anyone who doesn't know at least some basic math and statistics is a sucker for all the fallacies pushed by advertisers, politicians, and groups with an agenda. And once you've done your Google search for a formula to plug and chug, how do you test it if you don't know enough math to really understand it?
"I'm Brian Fellowes" - Parrot
"That bird is a liar!" - Brian Fellowes
I'm a senior computer science major with a minor in math and minor in physics. I am going to grad school next year. I'm trying to do undergrad research that incorporates CS and physics, and that would be nice in grad school too.
I don't this stuff because it will get me a better job when I get out. I don't study this stuff because I want a career. I study this stuff because I like doing it.
If you still need a decent integer square root algo, check out this page. I used the mborg_isqrt2 variant on that page as a starting point for writing my highly optimized Intellivision version for SDK-1600. My optimized version takes about 600 - 700 cycles for a 16-bit square root, on a machine where most operations take 6 to 8 cycles. (The version I was replacing took 4000 - 10000 cycles.)
This book looks like it might be interesting to me. Here at work, we had our own math expert, but he's retired (or semi-retired). We've contracted with him to do math libraries, and that works for now. But what about 10 years from now? There's a lot of subtlety in some of these algorithms (it's not always just as easy as whipping through a Taylor series expansion), so it's probably time someone in our group started learning. :-)
--JoeProgram Intellivision!
I guess that post came across sounding a little meaner than I intended. I do think it needs to be said that working with computers isn't necessarily ``high-tech''. At the beginning of the industrial revolution, mechanics were ``high-tech'', and well paid. By the middle of this century, they were poor, uneducated louts. That same change is already starting to happen in the computer/IT field. It sounds as if you are a manager, and that's certainly not ditch digging, but it really doesn't take much more education. That's what my rich uncle tells me, anyway, and he should know. He did it for years, without education. But he's very bright. It sounds as if you are, too, and you'll be fine, as long as you never have to look for a similar job with no credentials. My uncle got some education after he retired, and he's very happy he did. It made his life better, even though it never made him a dime. I've gotten some education, and I think it's made me poorer but happier.
I aimed that free clue at the folks who think that Java (or tomorrow's trendy language), alone, is a meal ticket. They're the ones who are going to be replaced by a teenager, or an Indian contractor. Easy come, easy go. I'm certainly glad that you have a better job than that. Folks who rely only on coding skills are in trouble, and that will never change, boom or bust.
See what I've been reading.
What's sad is that discrete math isn't really taught in public school. (At least, it wasn't when I was in school.) One day, I found a Discrete Math textbook at the local library in the 'For sale, $0.25' bin. I opened it up and thought "Oh my goodness, this is a programming and algorithms book!" To my mind, 'math' had always meant either calculation (symbolic or otherwise, your typical Algebra and Calculus), or geometry and proofs. While geometric proofs may border on discrete math, they really seem different to me. They're not algorithms.
Discrete Math branches into useful concepts such as graph theory (you couldn't do network routing successfully without it!), some of the basics of sorting, and so on. Basically, it was the math of "machines" -- that branch of mathematics which concerns itself with stepwise algorithms. Djikstra's algorithm (least cost path through a weighted graph), Prim's and Kruskal's algorithms (minimum cost spanning trees) were all in there. I thought the book was great.
And, of course, not a single line of code in it. (At least, not in any computer programming language.) But I still thought of it as a programming book.
--JoeProgram Intellivision!
As the author of a great deal of high-performance graphics software in the last decade, I've done my own substantial amount of research into squeezing performance out of math routines and algorithms. In general, beside slowness, my biggest complaint with standard math libraries is that they rarely include a sincos() function, or reciprocal square root.
I have a page on my website detailing a few of my numerical tricks in C++, and will be interested to compare my approaches with those of Mr. Crenshaw when I receive his book. Any comments are welcome...
Weeks of coding saves hours of planning.
Real-time and going fast are two totally different problems.
Satellite controllers may need real-time programming - there's physical stuff moving, and if a signal needs to be responded to in the 100ms before the bird turns another degree, you need hard real-time. But there's nothing that a bank does that needs real-time, unless the device in an ATM that hands out the cash is really badly designed. Yes, you need to know that the customer has taken the cash out of the slot or that the receipt-printer's finished, but if you find out 100ms late some of the time, it isn't going to hand out the wrong amount of money, it's just going to be slightly later drawing the next screenful of customer interaction. Some of their stuff needs to get high volumes of work done quickly, but that's a throughput problem, not a real-time problem, and you might get better throughput if some of the transactions have wait their turn rather than preempting other ones.
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
Building quality furniture can also be just as difficult and just as rewarding. If that's your thing then great. The point is that substituting experience for college works for some fields, quite well in fact, but don't expect to ever work for Nasa to calculate trajectories, or to whip out some code for wavelet coefficient shrinkage method for compression, or whatever... not that it sounds like you would ever want to do any of those things. If more CS people took math seriously maybe we'd have a free version of mathematica, but instead we have about 50 different email programs, and what seems like a new web browser every couple of months, and exactly 1 program to calculate and plot the coefficients from a best basis search in 3D via OpenGL. PS I had to program some Runge-Kutta cruft in college...
I agree that coprocessor-less system coverage would be advantageous - especially for those who are coding for micros. And you're right on about the annoyance factor when people given code examples in some abstract, and out dated, micro.
However, I do think that going down to a low level language is necessary due to the fact that the low level processes can be exposed, and accounted for, in the coding samples. Let's face it, we could all code mathematical algorithms (say for encryption) that run like dogs, not understanding why there are such significant performance hits. But supplying asm and high level language code side by side can be very beneficial - especially in topics where there isn't much helpful info like this one.
I guess it's horses for courses, but it's just my preference.
We just get the business requirements from the customer and translate it to working software, and as long as I've worked (not much though - somewhat more than 2 yrs), we don't need maths to work.
This may not be the case for developers who work on system programming, scientific products, etc.
So finally it boils down to what kind of work you're doing. Software engineering is not a small field - it spans almost every aspect of our life.
(Anyway, regardless of my work, I'm very much interested in math algos, and this book is on my wishlist.)
~ Sam
That is NOT CS. Computer Science does not teach you how to do Unix system administration or how to set up your hardware. It teaches you general principles, and at good universities, the formal underpinnings. Mathematics happens to come in very handy in this, so that's why CS should include math, although calculus (integrating, complex numbers) is IMHO less important to CS than discrete math (algebra, graph theory), probability calculus and some statistics.
So you might be able to do some high-performance computing, but I would like to see you write some parallel algorithms to distribute a work load over several interrelated processors without them locking up or design a compiler. That's the part you don't pick up installing Linux. Then again, it's also the part most of the slashdot crowd doesn't know either...
"...have rock solid operating systems without all the glitzy GUI stuf[f]"
Without that glitzy stuff you wouldn't have had an industry the size it is today, and you wouldn't have had the enormormous amounts spent on r&d. Look at all the fantastic projects that have come out thanks to the sums floating around - Intels Itanium cpu:s wouldn't have been here at all, just to name one high-sum-project.
Clue: Anything with the word "science" in the name, isn't. Computer science is the bastard offspring of two disciplines, primarily mathematics with a little bit of engineering, and is only interesting when a particular problem intersects one of the two. (Cryptography is one example, belonging largely to mathematics.) The whole of the "pure" part of computer science, i.e. the part where it intersects no other discipline, could be completely described in a fairly small paperback book.
An awful lot of "professional" programmers, even those with computer science degrees, hate math. Unfortunately, they also aren't any good at it. That's why we have the current flood of crapware saturating the market. If they'd take the same amount of time working through a system by hand as mathematicians do, and/or designing and implementing it properly the way engineers do, the incidence of security holes and bugs would drop to zero.
A mathematician who sat down and scribbled something out in a couple of days and submitted it to a mathematical journal for review would get laughed out of the community when (not if) a flaw was found. (Hell, after _twenty years_ of hard work, Wiles' proof of FLT had a flaw in it when he released it.) An engineer who sat down and designed a bridge ex vacuo in a couple of months would kill a lot of people, get immediately and successfully sued for incompetence, stripped of whatever professional license he had and would most likely die penniless and broken, particularly if he disregarded the prevailing design methodologies of his profession. Yet programmers routinely churn out crap. (Before you get up in arms, think about how much crappy software there is in the market today. Who do you think writes it?)
Computer science ought rightly to be taught as what it is, a subset of mathematics, rather than as a separate discipline. Programming proper needs to be relegated to what it is - a skill whose mastery is denoted by some form of professional certificate, _not_ a degree - and completely divorced from computer science in general. As taught today, a CS program seems largely to consist of programming language classes (C/C++/Java/Perl/HTML, feh/etc.), which is completely ass-backwards. This among other things needs to change in order to get the programming industry producing quality products.
-SD
I am Chaos. I am alive, and I tell you that you are Free. -Eris
-Kevin
Now I think we're getting into personal preference. Personally, I have worked at and with large companies who have to hire that way merely because of their size and popularity. When you get into those larger companies, your role becomes much smaller (Of course that depends on what rung you're on). Then you get into typical "What the HELL are they doing up there?" mode, and all you can do is follow orders.
I can't do that anymore, I have to set the pace. Small companies are where it's at. Sure the pay may not match up to big corporations, but we close at 4:30 SHARP. It's common for me to have to lock up at 4:45, because I'm the last one there. 11:30 on Fridays, so I can go 'moonlighting' in the afternood. No overtime, week off at xmas, I'm the boss, I do everything IT, and I can watch my kids grow up.
What more could anyone ask for? (No, I don't think we'll be going under anytime soon, if you go workout, odds are good your see our stuff. You might even wear it.
I've realized this whole thread is probably useless (and definately biased), there are only 150 comments, mostly all Math/Algorythm people. I haven't heard from any infrastructure people, on how important Math classes/college are to building networks, firewalling, and security in general. I guess it goes to show how flawed surveys are. You only hear from those who want to participate and, in this case, those who are interested in the base subject.
"I can't give you a brain, so I'll give you a diploma" - The Great Oz (blatently stolen sig)
Ahem, "some" high-performance computing includes of course SMP code (using pthreads) and cluster computing, via PVM. I have designed algorithms and written industrial-strength commercial code that does both. It was fun! The general principles of CS are pretty straightforward, and follow naturally from mathematics.
As far as compiler design goes, I certainly haven't designed my own, but I do know how existing compilers work (you can't do high-perf computing without knowing that).
The point of my post was that everything from "insalling linux" to designing and implementing parallel high-performance code and understanding compiler design is not very hard to pick up on your own if you already know a lot of mathematics.
All is Number -Pythagoras.