Saturday, 15 November 2008

Basic Calculus and Vector Calculus Concepts for Computer Programmers

The MIT website outlines the basic rules of differentiation, which should be second-nature to any mathematical programmer.

It revises rules like product rule (to differentiate xln(x), breaking the product xln(x) into the sum of two products), chain rule (to differentiate sin(ln(x)) and quotient rule (to differentiate (ln(x)/cos(x)).

Programmers should also have a basic knowledge of limits. Like...what is the limit of sinx as x tends to zero? (you can guess this one from the graph). More tricky, what is the limit of sinx/x as x tends to zero? Don't know? Find out here.

Concepts of vector calculus (a.k.a. vector analysis, which has its roots in the theory of quaternions) like scalar and vector fields and grad (or "nabla"), div ("divergence") and curl should also be clearly understood and examples done. The link above also covers basic 2D and 3D co-ordinate systems (i.e. cylindrical and spherical coordinates versus cartesian and polar co-ordinates) essential in graphics programming.

An example of a scalar field would be temperature in a room, where a scalar temperature (in Kelvins say) can be associated to every 3D vector in the room. An example of a vector field would be an electrical force field where each vector has a magnitude and direction in which the force is acting.

Puzzle: is light a vector or a scalar field? Why?

No comments: