Mathematics
Mathematics, 03.04.2020 21:39, sugandiwoodbine

An algorithm for calculating the cubic root of a number, VP, starts by choosing a value x, as a first estimate of the root. Using this value, a second, more accurate value x, is calculated as X, = x(x + 2P)/(2x} +P), which is then used for calculating a third, still more accurate value Xy, and so on. The general equation for calculating the i+ 1 value from the ith value of x is X[+1 = x (x +2P)/(2x +P) A. (15 pts) Write a UDF HWYP2.m that calculates the cubic root of a number. The input argument to your function must be the number P and the output argument must be its cubic root x. The function must use x, = P for the first estimate of the root. Then by using the general equation in a while loop, the function calculates a new, more accurate value and repeats. The function must calculate the estimated relative error E = 1 between every 2 consecutive x values. You can use variable names xi and xipi for x, and X:-1, respectively. The loop must terminate once E <10-1° or the number of passes exceeds 50. At the end of the pass your must assign the value of xipl to xi to start a new iteration (trial). Use your function to calculate: a) V800 b) V59071 c ) V-31.55 d) V-10-5 Verify the output of your functions by the nthroot(P,3) B. (10 pts) Modify your function to work not only for scalars but also for any 2D array. You will need first to determine the dimensions mxn of the input array and then to preallocate an array of the outputs (Root3) to zeros (m, n). Then, you must nest your while loop from the previous part inside 2 other nested for loops, one for each array dimension. For every value of the input matrix P(ij), the function must determine its cubic root x as before and then save it in Root 3(1.j) such that the output of HW7P2 in will be similar to the output of nthroot(P, 3) when P is an array not a scalar. Use your function on the following arrays, 1) B 1 0.008 2764 0.125 2) E-11 B 0.027 -64 0.125; B 0,064 0.216 512 -0.001] 3) F = 11:5:10:-1:6: 11:15 Verify the output of your functions by the nthroot (P.3)

answer
Answers: 2

Other questions on the subject: Mathematics

image
Mathematics, 21.06.2019 14:00, ira51
Can you decompose the numbers 20,740,6,000
Answers: 1
image
Mathematics, 21.06.2019 18:00, kush3489t
Aplane is taking off from bangladesh headed to new york city. at the same time, a plane from new york city is headed to bangladesh is also taking off. the plane bound to new york city is traveling at 600 mph, while the plane traveling to bangladesh is traveling at 400 mph. how far from new york city will the two planes meet if the distance between new york city and bangladesh is 8,000 miles?
Answers: 3
image
Mathematics, 21.06.2019 18:00, xojade
Assume that the weights of quarters are normally distributed with a mean of 5.67 g and a standard deviation 0.070 g. a vending machine will only accept coins weighing between 5.48 g and 5.82 g. what percentage of legal quarters will be rejected? round your answer to two decimal places.
Answers: 1
image
Mathematics, 21.06.2019 21:30, oliup567
(c) the diagram shows the first three shapes of a matchsticks arrangement. first shape = 3second shape = 5third shape = 7given m represents the number of matchstick used to arrange the n'th shape.(i) write a formula to represent the relation between m and n. express m as the subjectof the formula.(ii) 19 matchsticks are used to make the p'th shape. find the value of p.
Answers: 2
Do you know the correct answer?
An algorithm for calculating the cubic root of a number, VP, starts by choosing a value x, as a firs...

Questions in other subjects:

Konu
Mathematics, 17.09.2019 23:40