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
Stella is a bank executive. She is preparing a spreadsheet on the loan repayment schedules of customers. Which function can she
den301095 [7]

Answer: The function Stella can use to calculate the periodic payments of a loan is:

The Excel PMT function or NPER function.

Explanation: 1. The Excel PMT function is a financial function that returns the periodic payment for a loan.

2. The NPER function to figure out payments for a loan, given the loan amount, number of periods, and interest rate.

7 0
3 years ago
Which functions return a logical value (TRUE or FALSE)?
Ludmilka [50]

Answer:

Functions with a boolean return type.

Explanation:

If the return type is boolean, the only possible values are true or false.

8 0
3 years ago
if you play creative destruction and if u have a mic and if u play it 24/7 and would like to form a team tell me your name or yo
kipiarov [429]

i dont know that game but ill see if i like it and if i do ill send u my ID number ok


8 0
3 years ago
When a person uses terms such as “LOL” to mean “Laughing out loud,” they are using a(n):
gayaneshka [121]
An initialism or an acronym. Hope this helps :)
5 0
2 years ago
Read 2 more answers
Write a program to input 100 students marks and find the highest marks among the them​
Setler [38]

Answer:

Explanation:

The following code is a Python program that allows you to input 100 marks. You can input the value -1 to exit the loop early. Once all the marks are entered the program prints out the highest mark among all of them. The output can be seen in the attached picture below with a test of a couple of marks.

marks = []

for x in range(100):

   mark = int(input("Enter a mark: "))

   if mark == -1:

       break

   else:

       marks.append(mark)

print("Max value: " + str(max(marks)))

5 0
3 years ago
Other questions:
  • Write a program that displays in the title of the window the position of the mouse as the user moves the mouse around the window
    5·1 answer
  • Which of the following is NOT essential for individuals to have to build their own web page?
    9·1 answer
  • A work-study student receives a paycheck from:
    15·2 answers
  • What is the output of the second println statement in the main method, public class foo { int i ; static int s ; public sttic vo
    15·1 answer
  • A specialized security administrator responsible for performing systems development life cycle (SDLC) activities in the developm
    11·1 answer
  • Which questions should you ask yourself when performing research online?
    9·1 answer
  • True / False
    6·1 answer
  • Raw materials have two basic types what are the 2?
    11·2 answers
  • Write. true or false​
    5·2 answers
  • Which of the following was the first computer-animated film to win animated film to win an academy award?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!