Page 1 of 1

Homework 3, due September 25, 2008.

Posted: Thu Sep 18, 2008 2:23 pm
by goodwine
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.

Re: Homework 3, due September 25, 2008.

Posted: Sat Sep 20, 2008 1:33 am
by gorozco
In the collaborative problem 1., codes e. and i. are the same

Re: Homework 3, due September 25, 2008.

Posted: Tue Sep 23, 2008 11:19 pm
by nsolomon
Nathan Solomon
Homework 3

Re: Homework 3, due September 25, 2008.

Posted: Wed Sep 24, 2008 8:50 am
by goodwine
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.

Re: Homework 3, due September 25, 2008.

Posted: Wed Sep 24, 2008 1:10 pm
by mzahm
hmwrk3.f -- Collaborative Problem 1 (uncommenting will be necessary to run)

hmwrk3-2.f -- Collaborative Problem 2

hmwrk3-3.f -- Individual Problem

Re: Homework 3, due September 25, 2008.

Posted: Wed Sep 24, 2008 3:19 pm
by mnguye10
3 Files:

HW03PR01.f

HW03PR02.f

HW03IP01.f

Re: Homework 3, due September 25, 2008.

Posted: Wed Sep 24, 2008 4:41 pm
by mabeling
Collaborative Problem 1
-hw3p1.f

Collaborative Problem 2
-hw3p2.f

Individual Problem
-hw3p3.f

Re: Homework 3, due September 25, 2008.

Posted: Wed Sep 24, 2008 6:07 pm
by cbernhar
3 files. Collaborative Problems, Individual Problems, and Output Table as a .txt

Re: Homework 3, due September 25, 2008.

Posted: Wed Sep 24, 2008 6:19 pm
by mmcdonn3
Michael McDonnell

Re: Homework 3, due September 25, 2008.

Posted: Wed Sep 24, 2008 7:39 pm
by znussman
Homework three

Re: Homework 3, due September 25, 2008.

Posted: Thu Sep 25, 2008 12:18 am
by aydeegee
hw 3

Re: Homework 3, due September 25, 2008.

Posted: Thu Sep 25, 2008 2:04 pm
by am2011
Ashley Meklis

Re: Homework 3, due September 25, 2008.

Posted: Thu Sep 25, 2008 2:12 pm
by pfox1
HW 3 Files