Use If to define a function that, given a list of numbers, doubles all the positive numbers
Question:
Use If to define a function that, given a list of numbers, doubles all the positive numbers but leaves the negative numbers unchanged.
Rewrite abs to include a specific rule for the case where its argument is complex.
The definition of the absolute value function in this section does not handle complex numbers well:
One of the fastest methods for computing Fibonacci numbers (Section 5.3) involves iterating multiplication of the matrix {{0, 1}, {1, 1}} and pulling off the appropriate part. For example, the last element in the output of mat 9 is the tenth Fibonacci number.
Without using MatrixPower, create a function FibMat[n] that iterates the matrix multiplication and then pulls off the correct element from the resulting matrix to give the nth Fibonacci number. Check the speed of your implementation against both MatrixPower and the built-in Fibonacci.
Introduction To Statistical Investigations
ISBN: 9781119683452
2nd Edition
Authors: Beth L.Chance, George W.Cobb, Allan J.Rossman Nathan Tintle, Todd Swanson Soma Roy