Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Programming Books Media Book Reviews IT Technology

Math Toolkit for Real-Time Programming 153

oxgoad writes "Need a closed-form algorithm to derive square roots? Stymied by strange and scary results from your favorite compiler's math library? Math Toolkit for Real-Time Programming by Jack W. Crenshaw attempts to shed some numerical light. Read on for the goods." Oxgoad's review continues below.
Math Toolkit for Real-Time Programming
author Jack W. Crenshaw
pages 466
publisher CMP Books
rating 8
reviewer oxgoad
ISBN 1929629095
summary A casual discussion of algorithms ranging from abs to numerical calculus.

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.

Kudos

Math 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.

Quibbles

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. 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.

Crimes

As 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.

Conclusions

I 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

  1. Getting The Constants Right
  2. A Few Easy Pieces
  3. Dealing with Errors
  4. Fundamental Functions
  5. Getting the Sines Right
  6. Arctangents: An Angle-Space Odyssey
  7. Logging in the Answers
  8. Numerical Calculus
  9. Calculus by the Numbers
  10. Putting Numerical Calculus to Work
  11. The Runge-Kutta Method
  12. Dynamic Simulation
  • Appendix A: A C++ Tools Library

Disclosure

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.

This discussion has been archived. No new comments can be posted.

Math Toolkit for Real-Time Programming

Comments Filter:
  • by Anonymous Coward on Thursday October 10, 2002 @10:29AM (#4423696)
    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.
  • by jasonditz ( 597385 ) on Thursday October 10, 2002 @10:32AM (#4423708) Homepage
    If this book is done entirely in MIXAL I'm buying it!
  • by ubermuffin ( 39292 ) on Thursday October 10, 2002 @10:41AM (#4423763) Homepage
    Not to nitpick here, but if you honestly wanted to "squeeze every last bit of math power out of the CPU", would you really be writing Perl scripts?

    Just wondering...

    -ubermuffin
  • by Havokmon ( 89874 ) <rick.havokmon@com> on Thursday October 10, 2002 @11:29AM (#4424184) Homepage Journal
    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? Google: PHP MYSQL dealer locator

    :)

    A couple minutes of going through results granted me a simple:

    $sql = "select zipcode.zip_code, sqrt(power(69.1*(zipcode.lat - $lat1),2)+ power(69.1*(zipcode.lng-$long1)*cos(z ipcode.lat/ 57.3),2)) as dist, $dealer.* from $dealer LEFT JOIN zipcode on " ;

    $sql = $sql . " $dealer.zip = zipcode.zip_code where sqrt(power(69.1*(zipcode.lat - $lat1),2)+ power(69.1*(zipc ode.lng- $long1)*cos(zipcode.lat/57.3),2))

    So, no, I didn't have to sit down and figure out how to account for the curvature of the earth, and other things I'd consider 're-inventing the wheel'.

    As for the sine explanation.. That makes sense.. Now I'm going to have to go look up how it's applied.

  • by Anonymous Coward on Thursday October 10, 2002 @01:39PM (#4425449)
    Holy crap! Who would do assembly because they like it? As Brian Fellows would say, "Thats CRAZY!"

Happiness is twin floppies.

Working...