====== Differences ====== This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
gibson:teaching:fall-2013:math445:lab3 [2013/09/09 18:13] gibson created |
gibson:teaching:fall-2013:math445:lab3 [2013/09/16 18:23] (current) gibson [Math 445 Lab 3: Sorting, Interest, Exponentials, and Limits] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Math 445 Lab 3: Sorting, Interest, Exponentials, and Limits ===== | + | ===== Math 445 Lab 3: Interest, Exponentials, and Limits ===== |
Time Estimate: 4-6 hours. | Time Estimate: 4-6 hours. | ||
Line 10: | Line 10: | ||
labeling different lines in the same plot via the ''legend'' command. | labeling different lines in the same plot via the ''legend'' command. | ||
- | ==== Problem 1==== | ||
- | Write a function ''mysort.m'' that will take in a vector of any size and sort | ||
- | it from least to greatest. Use the strategy of comparing neighbors and swapping | ||
- | them if necessary. If this process is done throughout the entire vector | ||
- | repeatedly enough times, it will work. Rewrite your code so that it does not | ||
- | go through the matrix too many time using first the commands ''if, break'' and | ||
- | then by switching the outer loop to use a ''while'' command. | ||
- | ==== Problem 2==== | + | ==== Problem 1==== |
Suppose you opened a savings account that promised a 100% interest rate | Suppose you opened a savings account that promised a 100% interest rate | ||
(typical rates are closer to 3.5% today). We are going to try to calculate | (typical rates are closer to 3.5% today). We are going to try to calculate | ||
Line 57: | Line 50: | ||
- | ==== Problem 3 ==== | + | ==== Problem 2 ==== |
Now we will compound the interest weekly. Let's use a ''for'' loop to | Now we will compound the interest weekly. Let's use a ''for'' loop to | ||
compute not only how much money we will have in our account at the end of | compute not only how much money we will have in our account at the end of | ||
Line 98: | Line 91: | ||
without using a loop? | without using a loop? | ||
- | ==== Problem 4 ==== | + | ==== Problem 3 ==== |
As the number of compounds increases, the final amount appears to be get | As the number of compounds increases, the final amount appears to be get | ||
closer to some final value. In order to check this, let's compound the interest | closer to some final value. In order to check this, let's compound the interest | ||
Line 111: | Line 104: | ||
commonly in exponential and natural logarithms. | commonly in exponential and natural logarithms. | ||
- | ====Problem 5==== | + | ====Problem 4==== |
At this point I am going to make a guess that | At this point I am going to make a guess that | ||
Line 144: | Line 137: | ||
what's happening here? | what's happening here? | ||
- | ==== Problem 6 ==== | + | ==== Problem 5 ==== |
Using the same procedure as in the previous problem, confirm that | Using the same procedure as in the previous problem, confirm that | ||
Line 156: | Line 149: | ||
the command ''exp(0.754)''. | the command ''exp(0.754)''. | ||
- | ==== Problem 7 ==== | + | ==== Problem 6 ==== |
We have used several MATLAB functions so far. Now we are going to write our | We have used several MATLAB functions so far. Now we are going to write our | ||
Line 194: | Line 187: | ||
the last line. Turn in the code for your function. | the last line. Turn in the code for your function. | ||
- | ==== Problem 8 ==== | + | ==== Problem 7 ==== |
Enter the command ''format long'' then verify the following properties of | Enter the command ''format long'' then verify the following properties of | ||
Line 219: | Line 212: | ||
Note the ''log'' function in matlab is the natural logarithm. How would you | Note the ''log'' function in matlab is the natural logarithm. How would you | ||
calculate $\log_{10}$ , $\log_2$ , or $\log_5$? | calculate $\log_{10}$ , $\log_2$ , or $\log_5$? | ||
+ | |||