subject
Engineering, 21.02.2020 03:20 offensiveneedle

The "divide and average" method, an old-time method for approximating the square root of any positive number a, can be formulated as:

x= (x +a/x)/2

Write a well-structured M-file function based on the while...break loop structure to implement this algorithm. Use proper indentation so that the structure is clear. At each step estimate the error in your approximation as:

ε= |x^new- x^old/x^new|

Repeat the loop until ε is less than or equal to a specified value. Design your program so that it returns both the result and the error. Make sure that it can evaluate the square root of numbers that are equal to and less than zero. For the latter case, display the result as an imaginary number. For example, the square root of -4 would return 2i. Test your program by evaluating a = 0,2, 10 and-4 for ε = 10^-4

ansver
Answers: 2

Another question on Engineering

question
Engineering, 03.07.2019 14:10
Line joining liquid phase with liquid and solid phase mixture is known as: a) liquidus b) solidus c) tie line d) none of the mentioned
Answers: 2
question
Engineering, 04.07.2019 18:10
Ajournal bearing has a journal diameter of 3.250 in with a unilateral tolerance of 20.003 in. the bushing bore has a diameter of 3.256 in and a unilateral tolerance of 0.004 in. the bushing is 2.8 in long and supports a 700-lbf load. the journal speed is 900 rev/min. find the minimum oil film thickness and the maximum film pressure for both sae 20 and sae 20w-30 lubricants, for the tightest assembly if the operating film temperature is 160°f. a computer code is appropriate for solving this problem.
Answers: 3
question
Engineering, 04.07.2019 18:20
What is the heat treatment of metals? what is the benefit of it? why and how it's useful? answer in details, do not write by hand.
Answers: 3
question
Engineering, 06.07.2019 03:10
Air is flows through an adiabatic nozzle with an inlet pressure of 400 psia at a temperature of 300°f and a velocity of 20 ft/s. the outlet pressure is 40 psia and the velocity is 800 ftl/s. determine the outlet temperature of the air using: a) property tables b) specific heat (using the specific heat value for air at 300°f)
Answers: 3
You know the right answer?
The "divide and average" method, an old-time method for approximating the square root of any positiv...
Questions
question
Mathematics, 28.09.2020 01:01
question
Mathematics, 28.09.2020 01:01
question
Mathematics, 28.09.2020 01:01
question
Mathematics, 28.09.2020 01:01
question
Mathematics, 28.09.2020 01:01
question
Mathematics, 28.09.2020 01:01
question
Health, 28.09.2020 01:01
Questions on the website: 13722362