Representation of a Linear Equation | Linear Algebra using Python

Linear Algebra using Python | Representation of a Linear Equation: Here, we are going to learn about the representation of a linear equation in Python.
Submitted by Anuj Singh, on May 23, 2020

In this article, we are going to learn how to represent a linear equation in Python using Linear Algebra? For example we are considering an equation with 3 variables (x,y,z and t).

    3x + 4y - 7z + 12t = 46

The above equation has a form as below in linear Algebra:

Ax = b, Here A is a vector with element (3 4 -7 12), x = (x y z t) and b = 46.

Applications:

  1. Machine Learning
  2. Calculus
  3. Linear Programming
  4. Physics and Kinetic Studies

Python code for representation of a linear equation

# Linear Algebra Learning Sequence
# Represntation of a Linear Equation in python

import numpy as np

# Use of np.array() to define an Vector
V = np.array([3, 4, -7, 12])
A = V.T
print("The Vector A : ",A)

x = np.array(['x', 'y', 'z', 't'])
print("\nThe Vector x : ",x)
print("\nB = ",46)

print("\n---Now the equation is represented in form of vector: Ax = b---")
print("This is just a python intrepetation of understanding a linear equation")

Output:

The Vector A :  [ 3  4 -7 12]

The Vector x :  ['x' 'y' 'z' 't']

B =  46

---Now the equation is represented in form of vector: Ax = b---
This is just a python intrepetation of understanding a linear equation


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.