# Geometry

For the Geometry topics we will not be using any new python command nor function. It will be important to know how to work with matrices easily. Check out the Matrices in Sympy page in the ALGEBRA section if you need to refresh something.

## Useful functions

Here is a collection SymPy functions that can be useful for working with geometric objects.

• columnspace(): Returns a list of column vectors that span the space generated by the columns of a matrix.
• linear_eq_to_matrix(list_of_eq, *symbols): Returns the $A$ and $b$ matrices of a set of linear equations.

📝 Example: Get the system matrices of the system: $\left\{\begin{matrix} 4x+2y+3z=1 \\ 3x+y+z=-6 \\ 2x+4y+9z=2 \end{matrix}\right.$

>>> x, y, z = symbols('x y z')
>>> eq1 = 4*x + 2*y + 3*z - 1
>>> eq2 = 3*x + y + z + 6
>>> eq3 = 2*x + 4*y + 9*z - 2
>>> A, b = linear_eq_to_matrix( [eq1, eq2, eq3], x, y, z )
>>> A, b

The output will be: $\left( \begin{bmatrix} 4 & 2 & 3 \\ 3 & 1 & 1 \\ 2 & 4 & 9 \end{bmatrix}, \begin{bmatrix} 1 \\ -6 \\ 2 \end{bmatrix} \right)$

💡 Check out the Plotting page to see a full example of plotting the effect of an affinity space.

# Fòrum

Lliçons.jutge.org
Raúl Higueras
Universitat Politècnica de Catalunya, 2020

Prohibit copiar. Tots els drets reservats.