Thursday, September 17, 2015

Blog Post #8 for 09/17

FOR LOOP PRACTICE
 The program on top will determine how many numbers in matrix x are greater than thirty (basically the find tool), while the program on the bottom sums all of the values of matrix x (basically the sum tool).


WHILE LOOP PRACTICE
 This function also replicates the embedded 'find' function in matlab, but it uses a while loop rather than a for loop.


ALTERNATING HARMONIC SERIES
 This program will determine how many cumulative sums are required in order to calculate ln(2) within four digits of precision.


DIVERGING SERIES
 This program determines how many cumulative sums must be performed until the two values for 'total' are separated by at least 0.001. The program will stop if more than 50 sums are required.


FACTORIAL
This function will determine the factorial for a user inputted value, which is simply the MatLab embedded 'factorial' function.

No comments:

Post a Comment