V
V
Valery2021-05-12 23:35:36
Python
Valery, 2021-05-12 23:35:36

How many solutions does the system ax + by = c, dx + ey = f have?

Determine how many solutions the system has ax + by = c, dx + ey = f 609c3c0d86bf6552848758.jpeg
If the solution exists and is unique, then find the values ​​of x and y.
My code (doubt it's correct):

import numpy
a = int(input("Введите значение переменной Ax: "))
b = int(input("Введите значение переменной By: "))
c = int(input("Введите значение переменной c: "))
d = int(input("Введите значение переменной Dy: "))
e = int(input("Введите значение переменной Ey: "))
f = int(input("Введите значение переменной f: "))
 
if a == 0 and b == 0 and d == 0 and e == 0 and c == 0 and f == 0:
    print("Бесконечное количество решений.")
elif a == 0 and b == 0 and d == 0 and e == 0 and c != 0 and f != 0:
    print("Решений нет.")
else:
    M1 = numpy.array()
    v1 = numpy.array([c, f])
    print(numpy.linalg.solve(M1, v1))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-05-13
@ApXNTekToP

Imagine the system as two graphs of lines, and look for their intersection point.

  • If a / d = b / e = c / f, then there are infinitely many solutions, since this is essentially the same equation (the same straight line).
  • If a/d = b/e != c/f, then there are no solutions, since these are equations of parallel lines.
  • Otherwise, there is exactly one solution, since non-parallel lines have one point of intersection.

To solve the problem with coefficients equal to 0, change the proportion from division to multiplication.
a/d = b/e = c/f => ae = bd and af = cd
a/d = b/e != c/f => ae = bd and af != cd

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question