Home /
Expert Answers /
Computer Science /
help-solve-3-1-and-3-2-problem-3-1-consider-the-following-matrices-some-are-row-vectors-some-are-c-pa331
(Solved): help solve 3.1 and 3.2 Problem 3.1 Consider the following matrices (some are row vectors, some are c ...
help solve 3.1 and 3.2
Problem 3.1 Consider the following matrices (some are row vectors, some are column vectors): r=[1?3??2?0?],s=?201?5??,u=?xyz?? Calculate the following matrix products by hand. Show your work. a) rs b) sr c) ur Problem 3.2 For each of the following problems, indicate whether a solution to the problem would most naturally tend to include an IF statement (including IF/ELSE, IF/ELSEIF, etc.), a FOR loop, or a WHILE loop, and explain your reasoning. You may include more than one of the above structures, or none of the above, but explain your reasoning. a) Accept 50 position measurements xi? and calculate the corresponding spring force Fi?=kxi?+c for each one. b) Simulate rolling a 6 -sided die 100 times. c) Ask the user to enter a number. Calculate the square root of that number. Print the square root to the screen. d) Ask the user to enter a number between 0 and 100. If they enter a number outside this range, display an error message and ask again. Repeat until they enter a number in this range, then perform some calculations with that number and display the result. e) Population growth can often be modelled using the logistic formula Pyear +1??Pyear ?[1+r(1?KPyear ??)] Estimate the number of years it will take a given population to reach 800 million by starting with the current population, repeatedly applying the formula, and stopping when Pyear ??8×108. f) Calculate and display the square root of x if x is not a negative number. Display an error message if it is negative.