can any one solve this linear eqn, elimination method please? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can any one solve this linear eqn, elimination method please?

Given the coefficients of a pair of linear equations, a1x+b1y=c1a2x+b2y=c2 Find the solutions to x and y inputs 2 3 7 4 -2 6 output 2 1

28th Jan 2024, 2:30 AM
Dr Ashok Kumar M
Dr Ashok Kumar M - avatar
3 Answers
+ 4
Dr Ashok Kumar M To add to Per Bratthammar if you want to see your linear equation you can add import matplotlib.pyplot as plt to import numpy as np And observe your steps as they are displayed. https://sololearn.com/compiler-playground/cHpuzwDO8Vut/?ref=app
28th Jan 2024, 6:56 AM
BroFar
BroFar - avatar
+ 2
# Hi, Dr Ashok Kumar M ! # You can do it yourself, or relatively simple use numpy, # by using solve in linalg. # To solve: # 2x + 3y = 7 # 4x - 2y = 6 # Assume AX = C, # where A = [[2, 3], [4, -2]] and C = [7, 6] import numpy as np A = np.array([[2, 3], [4, -2]]) C = np.array([7, 6]) X = np.linalg.solve(A, C) print(f"{X = }") print(f"\t-> x = {X[0]}") print(f"\t-> y = {X[1]}") # Read more at: # https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
28th Jan 2024, 6:21 AM
Per Bratthammar
Per Bratthammar - avatar
0
2x+3y=7; 2x=7-3y; x=(7-3y)/2; If y=1 then x=2; 4x-2y=6; 4*2-2*1=6;
28th Jan 2024, 1:16 PM
Solo
Solo - avatar