Home » Python » Linear Algebra using Python

# 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

*is a vector with element*

**A***and*

**(3 4 -7 12), x = (x y z t)****b = 46**.

**Applications:**

- Machine Learning
- Calculus
- Linear Programming
- 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

TOP Interview Coding Problems/Challenges

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions

**Ad:**
Are you a blogger? Join our Blogging forum.