Question: Write a function called one_so_small that takes no input arguments and returns three scalars as output arguments. If it is called this way, [a,b,c] =

Write a function called one_so_small that takes no input arguments and returns three scalars as output arguments. If it is called this way, [a,b,c] = one_so_small, then it repeatedly gets three numbers from the function rand until the numbers pass this test: ten times one of the numbers is smaller than the product of the other two numbers. For example, if the three random numbers are 0.4, 0.03, and 0.9, then ten times the second number is 0.3 and the product of the first and third numbers is 0.36, so ten times one of these three numbers is smaller than the product of the other two numbers. On the other hand, if the second number were 0.038, these three numbers would not pass the test. Here are two sample calls. Before the sample calls are made, the random number generator is initialized by means of rng. In this case, it is initialized with the number 12 (non-negative integer). The purpose of this use of rng is to make it possible to compare your results with those below.

>> rng(12)

>> [a,b,c] = one_so_small

a =

0.014575

b =

0.91875

c =

0.53374

>> [a,b,c] = one_so_small

a =

0.033421

b =

0.95695

c =

0.90071

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!