Unformatted text preview:

1ChEE 201 Computer Homework 3 You need to have read Computer Handout 3 before attempting this homework. This homework will have you: 1) show you can write a function that would calculate an infinite series to approximate a function 2) demonstrate you can use a function you developed in homework three and include it into a longer program 3) demonstrate that you understand and can use the error definitions given in Computer Reading 3 1) In Reading 3, you saw there were some common infinite sums for calculating approximate answers to common functions. Write a program that would find the approximate value of ln(1+x) up to a specified number of terms. Your VBA program should receive two pieces of information from Excel: the value of x, and the number of terms you want to include in your approximation. In Excel, put the value 0.4 in cell A1. Then in Column B, put the word "Number of terms" in B1 Finally, put 1 in B2, 2 in B3,…etc., down to number 6 in cell B7 Create a VBA module and then write a program to use the infinite sum from Reading 3 to approximate ln(1+x). Your module should send back only one number, which is the value of the summed approximation for the number of terms you want. Go back to Excel and put the word "Approximate Value" in cell C1 In cell C2, put "=your function name($A$1,B2). Then copy this formula into the cells beneath this one until you have a table with answers for each of the number of terms. Print out your spreadsheet and the program module for credit. Include a description of what you find as the number of terms increases. You do NOT need to email this solution to the professor. 2) In Computer HW 2, you wrote a program that found the factorial of a number. You're going to use that code here to find the approximate value to cos(x). To do this, first look at the infinite series for cosine and try to find the general functional description of how the terms are increasing as you move from term to term. You want to write an infinite sum formula like the one we have for ex where: ∑∞==0nnx!nxe You should realize based on the beginning comments from this problem that you should have a factorial in your function somewhere. Report your infinite sum formula with your answer. Now that you have the infinite sum formula, write a VBA program to compute cos(3) using that formula. Your VBA program should take in 3 and the number of terms you are going to use. Make a table like you did in problem 1 to show the value of cos(3) for between 0 and 15 terms. Using your calculator, find the cos(3). Be careful that this is in radians and not degrees because the infinite sum is for use when x is in radians. In the columns next to your approximate value, compute the true error, the true relative error, the approximate error, and the approximate relative error, like was done on the fourth page of Reading 3. Print out a copy of your table and your computer program and include that with your hard copy solution. Now change your Excel file to find cos(5), cos(7), cos(9) (no spreadsheets are needed with this part, but just describe your response to the next sentence). Comment on what you see in the column for the value as the number of terms increases for each case.2Also, save this spreadsheet and module by itself as your "first name+last name+HW3.2.xls" and email to [email protected] before class on the day it is due. As an example, my own submission would be saved as


View Full Document

UA CHEE 201 - Computer Homework 3

Download Computer Homework 3
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Computer Homework 3 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Computer Homework 3 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?