Geometry Python
Geometry Python
Geometry Python
### Abstract
Linear algebra provides a robust framework for understanding geometric transformations,
vector spaces, and multidimensional relationships. This paper explores fundamental geometric
concepts, such as lines, planes, and transformations, through the lens of linear algebra. Python
code examples are included to clarify and visualize these concepts.
---
### 1. Introduction
Linear algebra is a cornerstone of modern mathematics with applications ranging from physics
to computer graphics. By bridging the gap between abstract theory and practical computation,
Python o ers an accessible platform to explore these concepts interactively.
---
# Example vectors
v1 = [2, 3]
v2 = [-1, 2]
# Plot vectors
plt. gure( gsize=(6, 6))
plot_vector(v1, color='b')
plot_vector(v2, color='g')
plt.xlim(-3, 3)
plt.ylim(-3, 3)
plt.grid()
plt.axhline(0, color='black',linewidth=0.5)
plt.axvline(0, color='black',linewidth=0.5)
plt.show()
```
The above example demonstrates two 2D vectors, which can be visualized on a Cartesian
plane. The direction and length of each vector illustrate its geometric properties.
---
\[
\text{Rotation: } T(\mathbf{x}) = \begin{bmatrix}
\cos(\theta) & -\sin(\theta) \\
\sin(\theta) & \cos(\theta)
\end{bmatrix}\mathbf{x}
\]
\[
\text{Scaling: } T(\mathbf{x}) = \begin{bmatrix}
s & 0 \\
0&s
\end{bmatrix}\mathbf{x}
\]
def scaling_matrix(s):
return np.array([
[s, 0],
[0, s]
])
# Example
theta = np.pi / 4 # 45-degree rotation
scale = 2 # Scaling factor
---
# Plane parameters
point = np.array([1, 1, 1]) # A point on the plane
normal = np.array([1, -2, 1])
# Plot
g = plt. gure( gsize=(8, 8))
ax = g.add_subplot(111, projection='3d')
ax.plot_surface(x, y, z, alpha=0.5, color='blue')
ax.quiver(*point, *normal, color='r', length=2)
plt.show()
```
This code visualizes a 3D plane along with its normal vector.
---
Eigenvalues and eigenvectors provide insight into the properties of a transformation matrix.
They reveal invariant directions and scaling factors.
Linear algebra provides powerful tools to analyze and manipulate geometric objects. Python
serves as an excellent medium to bridge theoretical concepts and practical implementation,
enhancing understanding through visualization and computation.