An interactive Python script that allows you to visualize linear algebra concepts in 2D and 3D space with custom input values.
- Vectors: Vector addition and subtraction with parallelogram visualization
- Linear Equation: Single line (ax + by = c)
- System of Linear Equations: Two lines with intersection point solution
- Linear Transformation: Apply 2x2 matrices to vectors
- Vectors: Vector addition and cross product
- Plane: Single plane with normal vector (ax + by + cz = d)
- System of Planes: Intersection of two planes
- Linear Transformation: Apply 3x3 matrices to vectors
- Install the required dependencies:
pip install -r requirements.txtRun the script:
python main.pyThe program will guide you through:
- Choose dimension: Select 2D (2 variables) or 3D (3 variables)
- Choose visualization type: Pick from vectors, equations/planes, or transformations
- Enter your values: Input coefficients, constants, or vector components
- View the plot: The visualization will be displayed
- Modify or save: You can:
- Modify values and refresh the diagram
- Save the current plot as a PNG image
- Return to the main menu
2D Linear Equation Example:
Choose: 2 Variables (2D)
Choose: Linear Equation
Enter a: 2
Enter b: 3
Enter c: 6
This will plot the line 2x + 3y = 6
3D Vector Example:
Choose: 3 Variables (3D)
Choose: Vectors
Enter v1: (1, 0, 0)
Enter v2: (0, 1, 0)
This will show vector addition and cross product
System of Equations Example:
Choose: 2 Variables (2D)
Choose: System of Linear Equations
Equation 1: 2x + y = 5
Equation 2: x - y = 1
This will show both lines and their intersection point (2, 1)
- Real-time visualization with custom inputs
- Ability to modify values and refresh plots
- Save visualizations as high-resolution PNG images
- Automatic solution calculation for systems of equations
- Additional information (determinants, dot products, cross products)
- Error handling for invalid inputs
- Python 3.7+
- NumPy
- Matplotlib
- For linear equations, coefficients can be positive or negative
- For transformations, try identity matrix [[1,0],[0,1]] first to see basis vectors
- The plot automatically scales to fit your data
- You can rotate 3D plots by clicking and dragging