Ask Question

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

+3
Answers (1)
  1. 10 July, 14:58
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers