## Homework 3, due September 25, 2008.

Due Thursday, September 25, 2008.
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Homework 3, due September 25, 2008.

Reading: Chapter 3 from the course text.

Collaborative Exercises:
1. Assume that you entered the value -0.00123456789 and assigned it to the real variable X and then subsequently printed it useing

Code: Select all

PRINT 13, X
How would the output appear for each of the following FORMAT statements
1. Code: Select all

13   FORMAT(F12.3)
2. Code: Select all

13   FORMAT(F10.3)
3. Code: Select all

13   FORMAT(F14.5)
4. Code: Select all

13   FORMAT(F7.2)
5. Code: Select all

13   FORMAT('X=',F12.3)
6. Code: Select all

13   FORMAT(E12.3)
7. Code: Select all

13   FORMAT(D12.3)
8. Code: Select all

13   FORMAT(D6.3)
9. Code: Select all

13   FORMAT('X=',F12.3)
10. Code: Select all

13   FORMAT('X=',/,F12.3)
11. Code: Select all

13   FORMAT('X=',/.T10,F12.3)
2. Write a computer program that computes the area of a triangle. The user should input the (x,y) values of the three points. A good program would check that the user entered three different points, but you do not have to check that. The program should ouput
1. The (x,y) values entered with three decimals after the decimal point for each value. Each (x,y) pair should be on a new line.
2. The area with one decimal after the decimal point.
3. The area in exponential notation.
Everything that is printed should have some text preceding it to indicate what is being printed.
Individual Exercise:
Modify your sine function based on a Taylor series to output a table. The first column of the table should be angle values that go from -90 degrees to +90 degrees in increments of 10 degrees. The second column should be the correct value for the sine function (you may use the SIN() fortran function for that column. The third through seventh columns should be what your Taylor series computes for 1, 2, 3, 4 and 5 terms, respectively. Each column should have a label at the top. The number of digits printed should be appropriate to effectively communicate the accuracy of the Taylor series approximations and the decimal points, if present, should line up in each column.

In other words, make the table one of professional quality, as if your job depended on it.

After your program runs properly, run it by typing

a.out > output.txt

This will "redirect" the output of the program to be put in the file "output.txt" instead of being printed to the screen. Print out the file and submit it with your homework.
Bill Goodwine, 376 Fitzpatrick
gorozco

### Re: Homework 3, due September 25, 2008.

In the collaborative problem 1., codes e. and i. are the same
nsolomon

### Re: Homework 3, due September 25, 2008.

Nathan Solomon
Homework 3
You do not have the required permissions to view the files attached to this post.
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Re: Homework 3, due September 25, 2008.

For the individual problem on homework 3, how can I enter the values of sine directly into the table in fortran? Is there a command that brings the values you compute in a program directly into the table you create in that program? I haven't found it in the book so far.
I'm not sure I totally understand the question, but I think the answer is that you want to use the SIN() function. That will presumably give you the correct answer and you can put that in the appropriate column in the table.
Bill Goodwine, 376 Fitzpatrick
mzahm

### Re: Homework 3, due September 25, 2008.

hmwrk3.f -- Collaborative Problem 1 (uncommenting will be necessary to run)

hmwrk3-2.f -- Collaborative Problem 2

hmwrk3-3.f -- Individual Problem
You do not have the required permissions to view the files attached to this post.
mnguye10

### Re: Homework 3, due September 25, 2008.

3 Files:

HW03PR01.f

HW03PR02.f

HW03IP01.f
You do not have the required permissions to view the files attached to this post.
mabeling

### Re: Homework 3, due September 25, 2008.

Collaborative Problem 1
-hw3p1.f

Collaborative Problem 2
-hw3p2.f

Individual Problem
-hw3p3.f
You do not have the required permissions to view the files attached to this post.
cbernhar

### Re: Homework 3, due September 25, 2008.

3 files. Collaborative Problems, Individual Problems, and Output Table as a .txt
You do not have the required permissions to view the files attached to this post.
mmcdonn3

### Re: Homework 3, due September 25, 2008.

Michael McDonnell
You do not have the required permissions to view the files attached to this post.
znussman

### Re: Homework 3, due September 25, 2008.

Homework three
You do not have the required permissions to view the files attached to this post.
aydeegee

### Re: Homework 3, due September 25, 2008.

hw 3
You do not have the required permissions to view the files attached to this post.
am2011

### Re: Homework 3, due September 25, 2008.

Ashley Meklis
You do not have the required permissions to view the files attached to this post.
pfox1

### Re: Homework 3, due September 25, 2008.

HW 3 Files
You do not have the required permissions to view the files attached to this post.