• [coeff[2][3], coeff[2][1], coeff[2][2]]] Matrix d2 using coeff as given in cramers rule d2 = [[coeff[0][0], coeff[0][3], coeff[0][2]]
  • D3 = determinantOfMatrix(d3) print("D is : ", D) print("D1 is : ", D1) print("D2 is : ", D2) print("D3 is : ", D3) Case 1
  • Driver Code if name == "main": soring coefficients of linear equations in coeff matrix coeff = [[2, -1, 3, 9]
  • Amaliy mashg‘ulot ishi – 1




    Download 351,4 Kb.
    bet3/3
    Sana02.01.2024
    Hajmi351,4 Kb.
    #129594
    1   2   3
    # cramer's rule
    d = [[coeff[0][0], coeff[0][1], coeff[0][2]],
    [coeff[1][0], coeff[1][1], coeff[1][2]],
    [coeff[2][0], coeff[2][1], coeff[2][2]]]
    # Matrix d1 using coeff as given in
    # cramer's rule
    d1 = [[coeff[0][3], coeff[0][1], coeff[0][2]],
    [coeff[1][3], coeff[1][1], coeff[1][2]],
    [coeff[2][3], coeff[2][1], coeff[2][2]]]
    # Matrix d2 using coeff as given in
    # cramer's rule
    d2 = [[coeff[0][0], coeff[0][3], coeff[0][2]],
    [coeff[1][0], coeff[1][3], coeff[1][2]],
    [coeff[2][0], coeff[2][3], coeff[2][2]]]
    # Matrix d3 using coeff as given in
    # cramer's rule
    d3 = [[coeff[0][0], coeff[0][1], coeff[0][3]],
    [coeff[1][0], coeff[1][1], coeff[1][3]],
    [coeff[2][0], coeff[2][1], coeff[2][3]]]
    # Calculating Determinant of Matrices
    # d, d1, d2, d3
    D = determinantOfMatrix(d)
    D1 = determinantOfMatrix(d1)
    D2 = determinantOfMatrix(d2)


    D3 = determinantOfMatrix(d3)
    print("D is : ", D)
    print("D1 is : ", D1)
    print("D2 is : ", D2)
    print("D3 is : ", D3)
    # Case 1
    if (D != 0):
    # Coeff have a unique solution.
    # Apply Cramer's Rule
    x = D1 / D
    y = D2 / D
    # calculating z using cramer's rule
    z = D3 / D
    print("Value of x is : ", x)
    print("Value of y is : ", y)
    print("Value of z is : ", z)
    # Case 2
    else:
    if (D1 == 0 and D2 == 0 and
    D3 == 0):
    print("Infinite solutions")
    elif (D1 != 0 or D2 != 0 or
    D3 != 0):
    print("No solutions")
    # Driver Code
    if name == "main":
    # soring coefficients of linear
    # equations in coeff matrix
    coeff = [[2, -1, 3, 9],
    [1, 1, 1, 6],
    [1, -1, 1, 2]]
    findSolution(coeff)


    XULOSA
    Ushbu amaliy mashg‘ulot python dasturlash tilini o‘rnatish va chiziqli masalalarni ishlashga qaratilgan bo‘lib quyidagicha xulosalar va natijalar keltirilgan: 1. Adabiyotlar tahlil qilingan 2. Python dasturlash tilini windows operatsion tizimiga o‘rnatishning amaliy qismi ko‘rsatilgan 3. Python dasturlash tilida chiziqli masalalar va ularning kodlari, natijalari olingan

    Download 351,4 Kb.
    1   2   3




    Download 351,4 Kb.