Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: m308_software
Views: 191
Kernel: SageMath (stable)

Linear Algebra with Scipy

Google some scipy tutorials. They'll be better. This worksheet is just more specialize for our 308 class

What is Scipy?

A Python stack consisting of libraries that are particularly used for STEM. We'll likely use a lot of sympy here because we're interested in symbolic calculations. But you should also know of scipy and numpy for numerical calculations.

See http://live.sympy.org/ for a live shell.

from sympy import * x, y, z, t = symbols('x y z t') import numpy as np

Echelon Forms

This is not even implemented in scipy or numpy. See https://stackoverflow.com/questions/7664246/python-built-in-function-to-do-matrix-reduction for a discussion.

A = Matrix([ [1, 2, -1, 3], [0, 1, -1, 2], [0, 0, 1, 1] ])
A.rref()
(Matrix([ [1, 0, 0, -2], [0, 1, 0, 3], [0, 0, 1, 1]]), (0, 1, 2))

Solving Linear System

A = Matrix([ [1, 2, -1, 3], [0, 1, -1, 2], [0, 0, 1, 1] ])
b = Matrix([ [1], [1], [0] ])
linsolve((A, b), [t, x, y, z])
{(2*z - 1, -3*z + 1, -z, z)}