1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Pavel [41]
2 years ago
15

Numerous engineering and scientific applications require finding solutions to a set of equations. Ex: 8x + 7y = 38 and 3x - 5y =

-1 have a solution x = 3, y = 2. Given integer coefficients of two linear equations with variables x and y, use brute force to find an integer solution for x and y in the range -10 to 10.
Ex: If the input is:

8
7
38
3
-5
-1
Then the output is:

x = 3 , y = 2
Use this brute force approach:

For every value of x from -10 to 10
For every value of y from -10 to 10
Check if the current x and y satisfy both equations. If so, output the solution, and finish.
Ex: If no solution is found, output:

There is no solution
Assume the two input equations have no more than one solution.

Note: Elegant mathematical techniques exist to solve such linear equations. However, for other kinds of equations or situations, brute force can be handy.
Computers and Technology
1 answer:
Gre4nikov [31]2 years ago
4 0

The brute strength method determines if each x and y value satisfies both conditions. To do this, we must iterate through each result in the specified range and insert them into both models.

<h3>What are Elegant mathematical technique?</h3>

ALGORITHM :

1. Take the values of all coefficients and SET flag = FALSE

2. Run a FOR loop for x in range (-10, 11). 11 won't be included.

2a. Inside the first FOR, start the y FOR loop in range(-10,11). 11 won't be included

2b. Inside the y FOR loop, check IF for a particular value of x and y both the equations satisfied.

2c. If yes, set flag TRUE and print values of x and y.

2d. ELSE the flag stays FALSE.

END FOR Y

END FOR X

3. Check if flag = FALSE, then print NO SOLUTION

PYTHON CODE :

a=int(input()) #taking input for each coefficient

b=int(input())

c= int(input())

a1= int(input())

b1= int(input())

c1= int(input())

flag = False

for x in range(-10,11): #checking for all values of x in range -10 to 10

for y in range(-10,11): #checking for all values of x in range -10 to 10

if (a  x + b  y – c == 0) and (a1*x + b1*y - c1 == 0) : #checking if the x and y values satisfy the equation

flag = True #setting the flag if solution is found

print('Solution : x = {-10, 10}, y = {-10, 10}'.format(x,y)) #if they satisfy print x & y

if flag = False : #if flag stays false, that means there is no solution

print('No solution')

OUTPUT : The output is given below.

More about the Elegant mathematical technique link is given below.

brainly.com/question/27934739

#SPJ1

You might be interested in
____ is scientifically seeking and discovering facts.
galina1969 [7]

Answer:

I believe it is science, but before you do anything with this answer, research more on it, just in case I'm wrong! :)

Explanation:

3 0
3 years ago
Which insert image option allows a user to compile, modify, and add captions to images?
Murrr4er [49]

Answer:

Photo Album

Explanation:

3 0
3 years ago
The safest action to take if someone claiming to be from your bank calls you to ask for account information is to
Fofino [41]
Hang up, and inform your (real) bank that someone may attempt to steal your identity and your money.
6 0
3 years ago
Read 2 more answers
The correct syntax for accessing the length of an array named numbers is:
Sladkaya [172]
The syntax is truly dependent on the programming language, as different languages have different API's. 

But, the most standard form of accessing an array length is via a method or property by dot notation.

For example -

for(int i = 0; i <= m_Array.Length; i++) {...}

This code is from C#, using the Length property.
3 0
3 years ago
W = 100 j<br> t = 10 s<br> P=?
Umnica [9.8K]

Answer:

the answer in 100÷10 10W

3 0
2 years ago
Other questions:
  • The OSHA Workplace Poster 3165 is optional for workplaces.<br> A) True<br> B) False
    13·2 answers
  • Legal counsel has notified the information security manager of a legal matter that will require the preservation of electronic r
    8·1 answer
  • Applying what formatting option to your excel workbook will make it easier to read when printed out?
    13·1 answer
  • Suppose that, even unrealistically, we are to search a list of 700 million items using Binary Search, Recursive (Algorithm 2.1).
    11·1 answer
  • Which of the following refers to special eyeglasses from Google that provide the user with visual information directly in front
    5·1 answer
  • As time goes on, technology is likely to _______. A. Increase in complexity b. Decrease in complexity c. Stay at the same comple
    8·1 answer
  • ERP packages are always quite simple.<br><br> True<br><br> False
    5·1 answer
  • Difference between ancient and modern mode of information <br> transmission
    12·1 answer
  • Match the following:
    10·1 answer
  • Discuss about the main frame computer​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!