Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
4th Edition
ISBN: 9780134639673
Author: Elizabeth A. Stephan, David R. Bowman, William J. Park, Benjamin L. Sill, Matthew W. Ohland
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 19, Problem 23RQ

As early as 650 BC, mathematicians have been composing magic squares, a sequence of n numbers arranged in a square such that all rows, columns, and diagonals sum to the same constant. Used in China, India, and Arab countries for centuries, artist Albrecht Durer’s engraving Melencolia I (year: 1514) is considered the first time a magic square appears in European art. Each row, column, and diagonal of Dürer’s magic square sums to 34. In addition, each quadrant, the center four squares, and the corner squares all sum to 34. The following is an example of a magic square:

Chapter 19, Problem 23RQ, As early as 650 BC, mathematicians have been composing magic squares, a sequence of n numbers

Write a program to determine if a series of numbers is indeed a 4 × 4 magic square. Your program should complete the following steps, in this order

  1. a. Ask the user to enter the proposed magic square in a single input statement (e.g., [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16]—note this example is a 4 × 4 matrix, but NOT a magic square). You may assume the user will enter whole numbers; they will not enter either decimal values or text.
  2. b. Check that all values are positive; ** for-loop or nested for-loop required in the solution. If one or more of the values in the matrix are negative or zero, issue a statement to the command window informing the user of the mistake and ask the user to enter another matrix. This check should be repeated until the user enters a matrix with positive values. This check should work even if the user does not enter a 4 × 4 matrix; it should work regardless of the size of matrix entered.
  3. c. Check for an arrangement of 4 × 4 If the matrix is not a 4 × 4, issue a statement to the command window informing the user of the mistake, and ask the user to enter another matrix. This check should be repeated until the user enters a 4 × 4 matrix. You may assume the reentered matrix contains only positive values; you do not need to recheck the new matrix for positive values, only for matrix dimensions.
  4. d. Determine if the matrix is a form of a magic square. The minimum requirement to be classified as a magic square is each row and column sums to the same value. ** for-loop or nested for-loop required in the solution. If this criterion is not met, issue a statement to the command window informing the user they have not entered a magic square and ask the user if they wish to try another magic square. This question can be posed using either a text answer entered by the user (Yes, No) or by using a menu. If the user chooses to run the program again, the entire program starting with step (a) should begin again.
  5. e. Determine the classification of the magic square using the following requirements:
    1. 1. If each row and column sums to the same value, the magic square is classified as semi-magic; the summation value is ca led the magic constant. **for-loop or nested for-loop required in the solution.
    2. 2. If, in addition to criterion 1, each diagonal sums to the same value, the magic square is classified as normal; **for-loop or nested for-loop required in the solution. The use of built-in functions such as diag, flipir, rot90, trace or similar built-in functions is forbidden.
    3. 3. If, in addition to 1 and 2, the largest value in the magic square is equal to 16, the magic square is classified as perfect.

Format your magic square classification similar to the format shown below. You may choose to format your table differently, but each classification should contain a Yes or No next to each magic square category.

The magic constant for your magic square is 24. The classification for your magic square:

Semi-magic Normal Perfect
Yes Yes Yes

After this table appears, ask users if they wish to try another magic square following the instructions given earlier. A few test cases for you to consider:

  • Albrecht Dürer magic square: [16, 3, 2, 13; 5, 10, 11, 8; 9, 6, 7, 12, 4, 15, 14, 1];
  • Chautisa Yantra magic square: [7, 12, 1, 14, 2, 13, 8, 11; 16, 3, 10, 5; 9, 6, 15, 4];
  • Sangrada Familia church, Barcelona magic square: [1, 14, 14, 4; 11, 7, 6, 9; 8, 10, 10, 5; 13, 2, 3, 15].
  • Random magic square: [80, 15, 10, 65; 25, 50, 55, 40; 45, 30, 35, 60; 20, 75, 70, 5];
  • Steve Wozniak’s magic square: [8, 11, 22, 1; 21, 2, 7, 12; 3, 24, 9, 6; 10, 5, 4, 23]
Blurred answer
Students have asked these similar questions
On an alien planet, the law that expresses the flow of blood through a blood vessel, F, as a function of the radius r of the vessel is f=kr5/2where k is a constant. Certain geological features of this planet produce a gas that changes the radius of blood vessels by 5% at the time of inhalation. What would the corresponding increase in blood flow through the vessel at this time be? Write 1-2 sentences explaining how you found your answer.
Seawater can be purified by distillation into potable water. If it costs 15 cents per kilowatt-hour for energy, what is the cost of energy to produce 100.0 gallons of drinking water at 100.0 ˚C if the seawater starts at 25.00 ˚C? (1 watt × 1 second = 1 joule). Enter your answer to the nearest penny.
Hello im reviewing my notes and im confused as to how s and n were able to come up with the equation. Please help.    n=(cos30,sin30,0) s=(-cos60,sin60,0)   Please explain,thank you

Chapter 19 Solutions

Thinking Like an Engineer: An Active Learning Approach (4th Edition)

Ch. 19.3 - Write a for loop to display every even number from...Ch. 19.3 - Write a for loop to display every multiple of 5...Ch. 19.3 - Write a for loop to display every odd number from...Ch. 19.3 - Assume a vector Vals has already been defined....Ch. 19.3 - Consider the following table of values. Determine...Ch. 19.3 - Write two nested for loops to determine how many...Ch. 19.3 - Assume a matrix MZ has already been defined. Write...Ch. 19.3 - Prob. 18CCCh. 19.3 - Determine the output of the following code:Ch. 19 - Prob. 1ICACh. 19 - Create a written algorithm or flowchart as...Ch. 19 - Create a written algorithm or flowchart as...Ch. 19 - Create a written algorithm or flowchart as...Ch. 19 - Create a written algorithm or flowchart as...Ch. 19 - Create a written algorithm or flowchart as...Ch. 19 - Create a written algorithm or flowchart as...Ch. 19 - For each of the following code segments, determine...Ch. 19 - a. Assume CA1 and CA2 are cell arrays that both...Ch. 19 - Fill in the table with the values of k, b, x, and...Ch. 19 - Assume that a simple menu has been created by the...Ch. 19 - Write a MATLAB program to implement the algorithm...Ch. 19 - Write a program that will ask the user to input a...Ch. 19 - Write a MATLAB program to implement the algorithm...Ch. 19 - Write a function named CountDown that accepts a...Ch. 19 - While experimenting with coding sequences, you...Ch. 19 - Answer the question with each of the following...Ch. 19 - For each of the following code segments, determine...Ch. 19 - a.Explain what the following function does,...Ch. 19 - For each of the following code segments, determine...Ch. 19 - Prob. 23ICACh. 19 - Prob. 24ICACh. 19 - Write a MATLAB program to implement the algorithm...Ch. 19 - Prob. 26ICACh. 19 - Write a function named GetArray that will accept...Ch. 19 - Assume the vector AM contains an even number of...Ch. 19 - Write a function named EvenSum that will accept a...Ch. 19 - Prob. 30ICACh. 19 - Write a function named CLASS that will accept a...Ch. 19 - You are assessing the price of various components...Ch. 19 - You are studying the number of defective parts...Ch. 19 - The pascal triangle an amazing number of uses,...Ch. 19 - Write a function named Prodstate that will accept...Ch. 19 - Design a flowchart for a program to help students...Ch. 19 - Create an algorithm to allow the user to enter a...Ch. 19 - Write a program to implement the algorithm...Ch. 19 - A zombie picks up a calculator and starts adding...Ch. 19 - Write a function called Balloon that will accept a...Ch. 19 - Prob. 7RQCh. 19 - Prob. 8RQCh. 19 - You are to program part of the interface for a...Ch. 19 - Prob. 13RQCh. 19 - A matrix names mach contains three columns of data...Ch. 19 - Prob. 15RQCh. 19 - You are programming the control system for a robot...Ch. 19 - Write a program to implement the GPA calculator...Ch. 19 - The Fibonacci sequence is an integer sequence...Ch. 19 - As early as 650 BC, mathematicians have been...Ch. 19 - Write a program to analyze the cooling of a cup of...Ch. 19 - After numerous experiments with a circuit...
Knowledge Booster
Background pattern image
Mechanical Engineering
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, mechanical-engineering and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Elements Of Electromagnetics
Mechanical Engineering
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Oxford University Press
Text book image
Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:9780134319650
Author:Russell C. Hibbeler
Publisher:PEARSON
Text book image
Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:9781259822674
Author:Yunus A. Cengel Dr., Michael A. Boles
Publisher:McGraw-Hill Education
Text book image
Control Systems Engineering
Mechanical Engineering
ISBN:9781118170519
Author:Norman S. Nise
Publisher:WILEY
Text book image
Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:9781337093347
Author:Barry J. Goodno, James M. Gere
Publisher:Cengage Learning
Text book image
Engineering Mechanics: Statics
Mechanical Engineering
ISBN:9781118807330
Author:James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:WILEY
8.01x - Lect 27 - Fluid Mechanics, Hydrostatics, Pascal's Principle, Atmosph. Pressure; Author: Lectures by Walter Lewin. They will make you ♥ Physics.;https://www.youtube.com/watch?v=O_HQklhIlwQ;License: Standard YouTube License, CC-BY
Dynamics of Fluid Flow - Introduction; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=djx9jlkYAt4;License: Standard Youtube License