Monthly Archives: May 2020

Singular weather decomposition

The topic this week is the Singular Value Decomposition. In class, I talked about an example using weather data; we’ll walk through that example again here. The basics Given a matrix A, A.singular_values() returns the singular values of A, and A.SVD() gives the singular value decomposition. There’s a wrinkle, though: Sage only knows how to compute […]

Posted in Uncategorized | Leave a comment

Plotting Differential Equations

(I am continuing to use a Jupyter notebook, as in the previous two posts.) CoCalc (Sage) will solve systems of linear differential equations with constant coefficients exactly. (In fact, it will solve a fairly wide range of differential equations either exactly or numerically.) It can also plot the results. For example, to solve the system […]

Posted in Uncategorized | Leave a comment

Fourier Series

(I’m continuing to use a Jupyter notebook, as in the last post, Least Squares.) Sage has some rudimentary support for Fourier series, as part of the “piecewise-defined function” class, but it seems to be very slow and very flaky. Let’s implement our own. To make things run reasonably efficiently, we’re going to have Sage do […]

Posted in Uncategorized | Leave a comment

Least-squares

For fun this week, I’ll use Jupyter notebooks inside Sage, which you create like this: To turn on pretty output (typesetting), type %display typeset. As far as I know, Sage does not have a built-in method to find a “least-squares solution” to a system of linear equations. The description of a least squares solution to […]

Posted in Uncategorized | Leave a comment

Dot Products and Orthogonality

These computations are easy in Sage, with some quirks. Dot products v=vector([1,2,3]) w = vector([1,1,1]) v.dot_product(w) v*w v.norm() Testing whether sets are orthogonal, orthonormal The easiest way to test whether a set of vectors v_1, …, v_k is orthogonal is: Create a matrix A=[v_1 … v_k] with the vectors as its columns. Compute A^T*A, the […]

Posted in Uncategorized | Leave a comment
Skip to toolbar