Mathematical Functions and the Computer


Most people are familiar with the basic mathematical operations, such as addition, subtraction, multiplication and division, and their operators +, “, , and . However, within the world of the computer we use slightly different notation. While +, “, and = are the same, we use * for multiplication and / for division. Therefore, while in written equations we will see the traditional math operators used, code examples will use the programmatic operators.

Tip  

For really intensely technical reasons that are really intensely boring, division is significantly harder for a computer processor than multiplication. If you were to divide 1000 different numbers by 4, it would take noticeably longer than it would to multiply those same numbers by 0.25. Wherever possible, use multiplication instead of division.

Other functions, such as finding square roots, raising numbers to a power, have notation specific to the computer language you are programming in. MEL is no exception, and contains a variety of specific commands for most common complex math functions. Throughout this book, as with the mathematical operators, we will show both the mathematical notation and the MEL code for any mathematical equation. Unless otherwise stated, notation for any mathematical operation is the same in MEL as it is in standard mathematical notation.




The MEL Companion
The MEL Companion: Maya Scripting for 3D Artists (Charles River Media Graphics)
ISBN: 1584502754
EAN: 2147483647
Year: 2003
Pages: 101

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net