Applications of Linear Algebra and Multivariable Calculus
These pages present the example applications of the content covered in 8BA060: Linear algebra and multivariable calculus.
Week 1A: Fitting a curve to data points.
Consider three data points : and . We fit a (non-linear!) polynomial relation of the form,
Noting that the terms scale linearly with their respective unknowns (). We can setup a system of linear equations,
An echelon form of the augmented matrix is,
The solution ( and ) for the parabola is thus; , and ,
We may visually verify in Octave/Matlab.
% Plot function for -2 < x < 2.
fplot (@(x) 0.5*x.^2 + 0.5*x, [-2, 2], "linewidth", 2, 'red');
hold on
% data points
scatter ([-1, 0, 1], [0, 0, 1], 'filled');
Polynomial fit with a free variable
Reconsider the three data points : and . Lets try to fit a polynomial relation of the form,
The linear system now reads,
with an echelon form of the augmented below having three (underlined) pivots for four unknowns, indicating one free variable.
The solution is: , the free variable: , and . For , we obtain the previous parabolic solution. Using Octave, we may plot the solution for some some selected values of .
fplot (@(x) 0.5*x.^3+0.5*x.^2, [-1.1, 1.1], 'linewidth', 2,'red')
hold on
fplot (@(x) x.^3+0.5*x.^2-0.5*x, [-1.1, 1.1], 'linewidth', 2,'green')
fplot (@(x) -0.5*x.^3+0.5*x.^2+1*x, [-1.1, 1.1], 'linewidth', 2,'magenta')
scatter([-1,0,1],[0,0,1], 'filled')
Thank you Gaussian elimination! for helping me to find these solutions.
Week 1B: Projection for computer graphics
Parallel projection
Technical drawings are often presented using various “side views” of an object via a so-called orthographic projection. Here a point in three-dimensional (3D) space () is transferred to 2D screen-space coordinates, . A simple projection onto the plane is obtained by the linear map.
Since the matrix is already in echelon form we can directly conclude that this is onto but not one-to-one. Its kernel is 1D and given by , with .
Perspective projection
A projection that better mimics our perception of the world is the so-called perspective projection. This is a linear map that is popular in graphics applications, and it is also given by a matrix transformation,
Here the coefficients encode the camera tilt angles and the is the translation of the camera. The final screen-space coordinates are then computed in a separate step, the so-called perspective division which causes far-away objects, with large distance , to appear smaller,
or
Thank you linear transformations! for all the nice computer graphics.