## Problem

Previewing page *1*
of
actual document.

**View the full content.**View Full Document

## Problem

0 0 91 views

Other

- Pages:
- 3
- School:
- Carnegie Mellon University
- Course:
- Meg 24311 - Numerical Methods

**Unformatted text preview: **

24 311 NUMERICAL METHODS Fall 02 Carnegie Mellon University PROBLEM SET 2 Issued Due Weight PS2 1 9 4 02 9 11 02 Please hand in your solutions at the beginning of class 4 of total grade C Java Programming Forward Finite Divided Difference This is essentially the same problem as PS1 3 but you will solve it by writing a C or JAVA code A storage tank contains a liquid at depth y where y 0 when the tank is half full Liquid is withdrawn at a constant flow rate Q to meet demands The contents are re supplied at a sinusoidal rate 3Q sin 2 t see Figure 1 The cross sectional area of the tank is A Write a C C Java program that solves for the depth y from t 0 to 5 sec with a step size of 0 1 sec Use the parameter values A 1200 m 2 and Q 400 m3 sec The depth is zero at t 0 Your code has to output an ASCII text file named output csv that contains 50 numbers separated by commas representing how the water depth changes over time Suppose this text file is stored as c output csv read the file into Mathcad by using a command READPRN C output csv and plot a graph You can download and study a sample text file output csv and a Mathcad script readprn mcd from the schedule section of the class web page In your hand in directory on AFS see the course information section of the class web for the actual location on AFS make a new directory called ps2 1 in lower case Hand in the following in your hand in directory Source code files and header files Executable file Output text file output csv Also hand in a printout of the following Source code files and header files Output text file Mathcad file with a graph Figure 1 A storage tank containing a liquid 1 PS2 2 Taylor Series Approximation Use zero first second and third order Taylor series expansions to predict f 2 f x 25 x 3 6 x 2 7 x 88 using a base point at x 1 Calculate the error for each of the Taylor series expansions error true value approximated value by Taylor series true value PS2 3 Finding Roots of Equations with Mathcad Real

View Full Document