159k views
5 votes
How can you solve real world mathematical problems using two linear equations in two variables​

User PkExec
by
8.7k points

1 Answer

6 votes

Answer:

import numpy as np

a = int(input ("Enter a"))

b = int(input ("Enter b"))

c = int(input ("Enter c"))

d = int(input ("Enter d"))

c1 = int(input ("Enter c1"))

c2 = int(input ("Enter c2"))

array1 =[[a, b],[c, d]]

A = np.array (array1)

B = np.array ([c1, c2])

X = np.linalg.inv (A).dot (B)

print (X)

Step-by-step explanation:

let ax + by =c1

cx + dy =c2

We have used the above NumPy library that has the methods for matrix calculation, and here we have used matrix multiplication, and the inverse of a matrix to find the value of x and y.

We know AX=B

X = inv A. B

And this we have used above. We can calculate inv A and do matrix multiplication using NumPy. And thus we get the above solution.

User Latora
by
7.9k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.