Ask Question
27 August, 07:37

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

+3
Answers (1)
  1. 27 August, 08:14
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers