Ask Question
10 March, 22:22

the addition of two numbers is 15 and their difference is 4.5. Write a program to find these numbers

+1
Answers (1)
  1. 11 March, 01:42
    0
    import numpy as np

    a = [[1,1],[1,-1]]

    A = np. array (a)

    B = np. array ([15, 4.5])

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

    print (X)

    Explanation:

    In the above program, we have used the matrix method and the NumPy library to solve a simultaneous equation.

    We know AX=B

    or X = inverseA. B

    inverse A is found using np. linalg. inv (matrix). and matrix multiplication by A. dot (matrix B)

    We need to get A and B from a simultaneous equation. were A is the coefficient of X and Y and the B is the C like as ax + b = c. here a and b are coefficients and c is the constant. And this is given in both equation like

    here, x + y = 15

    and x - y = 4.5

    and this gives as matrixes as used above in the program.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “the addition of two numbers is 15 and their difference is 4.5. Write a program to find these numbers ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers