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
A​ __________ is a commonly used tool for showing how the parts of a whole are distributed.
dsp73
A. (pie chart) - correct answer
7 0
3 years ago
Write IF() function for student 3, If total mark is greater than 10 then print
Debora [2.8K]

Answer:

Explanation:

The following code is written in Java. The if() function is actually called an if statement. The following code can be copied and pasted where you need as long as it is within the scope of the mark variable in order to call it and compare it to 10

if (mark > 10){

           System.out.println("you have scored good");  

       } else {

           System.out.println("you need to improve ");

       }

3 0
3 years ago
What doe the &amp; operator do in python programming software
ArbitrLikvidat [17]
Hardware software is the answer
5 0
3 years ago
Joe, a user, has just installed his first home wireless router. Which of the following tasks should be considered to help secure
MakcuM [25]

Answer:

Update the unit firmware.

Explanation:

Updating unit firmware means update the information related to the network that is newly installed on the wireless router. The purpose of this change is to update the devices with new network alterations to work with efficiency and better security. As things are updating on daily basis, so the manufacturer makes the devices, reprogram able to meet the requirement of the future by updating the program in firmware unit. By updating device means this will be to fix the bugs that can be occur in modern era. This will make the device more secure.

5 0
3 years ago
Modify the provided code file to create a workout tracking program that lets the user enter (from the console) the distance they
koban [17]

Answer:

  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3. public class Main {
  4.    public static void main(String[] args) {
  5.        Scanner input = new Scanner(System.in);
  6.        double distances [] = new double[7];
  7.        for(int i=0; i < distances.length; i++){
  8.            System.out.print("Input running distance for day " + (i+1) + ": ");
  9.            distances[i] = input.nextDouble();
  10.        }
  11.        System.out.println(Arrays.toString(distances));
  12.    }
  13. }

Explanation:

The solution code is written in Java.

Firstly, create a Scanner object to get user input for running distance (Line 6). Next, declare a distances array and set the array size to 7 because we intend to use this array to hold running distance for 7 days per week.

Next, use the for loop that run for 7 times to repeatedly prompt user to input running distance for each day and store each value to the array distances (Line 9 -12).

At last, display the array to console terminal (Line 14).

3 0
3 years ago
Other questions:
  • What car dealership websites did you use to conduct your research?​
    8·1 answer
  • How could you fact check a news report that you saw on television
    12·1 answer
  • 8) Which of the following statements is FALSE?
    14·1 answer
  • PLEASE HELP POWER POINT:
    8·2 answers
  • What is blogging
    15·2 answers
  • A business would use a website analytics tool for all of the following EXCEPT _____.
    9·1 answer
  • When we code an algorithm, we need to provide the commands in the order we want the
    10·1 answer
  • You want to use the randrange() method. Which line will allow you to enter the following code in IDLE?
    12·2 answers
  • Sabiendo que z1 = 10, z2 = 20, z3 =10 , z4 = 20, n1 = 1200 rpm.
    6·1 answer
  • My messaging system is messed up. It keeps saying I'm getting messages but then it says nothing new in my inbox. I'm confused- H
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!