Homework 1, due September 2, 2010.

Due Thursday, September 9, 2010.
Post Reply
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Homework 1, due September 2, 2010.

Post by goodwine »

Reading: Skim Chapter 1 unless you have little programming experience, in which case you should read it.
Everyone should read Chapter 2.

Collaborative problems:
  1. Compute the Taylor series of the exponential function, exp(t) about t=0.
  2. Write a FORTRAN program that uses the Taylor series to compute the exponential of a specified value. The program should:
    1. prompt the user for how many terms should be used in the series;
    2. prompt the user for the value of t that should be used in exp(t); and,
    3. print the answer.
  3. Investigate how accurate the approximation is for different values of t and for different numbers of iterations. Submit a table that tabulates to how many digits the approximation is valid for different numbers of iterations and different ranges of t. You may use the exp() function in FORTRAN to check the accuracy of your iterative computation.
Individual Problems:
  1. Repeat the problem above but for the cosine function instead of the exponential function. You may use the cos() function in FORTRAN to check the accuracy of your iterative computation.
  2. Write a program that prompts a user to enter an integer. Print out the integer cubed (you may just multiply it by itself three times). Use this program to determine an approximate value for the maximum and minimum integer values. Based on this, how many bits does remote2.helios.nd.edu use to represent an integer?
What to Submit:
Submit everything in class including any written work and printouts of any computer code. Also, upload every FORTRAN program that you write for this assignment. The first line of every program should have your ND ID number and what problem it is, e.g., homework 1, problem 2a.

Extra Credit:
  1. Do all the problems again in C, C++ or java.
  2. Re-write the logistic map problem from class (in FORTRAN) so that it does the computation in integers and works up to the largest possible integer value.
Bill Goodwine, 376 Fitzpatrick
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: Homework 1, due September 2, 2010.

Post by goodwine »

Someone asked me:
I have two questions. One: do you want a computed Taylor series written on paper to be turned in? For example, collaborative number 1, Compute the Taylor series of the exponential function, exp(t) about t=0. Do you want that actually written out?
Yes, actually write it out and submit it.
Two: do you want a table of values for the individual problem? It says to redo the problem above but there are three problems above.
Yes, it was referring to all three collectively since they all related to using the Taylor series for the exponential. So, for the individual Taylor series problem do all three of the collaborative problems for it.
Bill Goodwine, 376 Fitzpatrick
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: Homework 1, due September 2, 2010.

Post by goodwine »

Someone asked me:
I have a question about the homework. For the table for the exponential function, do you want in a program like word? Also, would you like it just typed / written up and handed in, or do you want it to be uploaded to the website if it must be done on the computer?
You can do the table by hand.
Bill Goodwine, 376 Fitzpatrick
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: Homework 1, due September 2, 2010.

Post by goodwine »

I was wondering what you meant for the extra credit on this weeks assignment when you referred to the logistic map problem from class? Please let me know what you meant by that, thank you!
The logistic map was the random number generator from the very first class.
Bill Goodwine, 376 Fitzpatrick
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: Homework 1, due September 2, 2010.

Post by goodwine »

Someone asked me
I have a quick question about the homework. In my code that calculates the factorial of a number, the program calculates the factorial correctly until 13!. It says that 13!=1932053504, when it is actually 6227020800. Thus, in my program, if I try to iterate the loop more than 13 times, it starts to overshoot that actual value of exp(t). I can't see any fault in the program, so I assume this is just fortran not being able to compute that high of a number, but I just wanted to double check with you to make sure. Here is the code for calculating the factorial.
While I haven't checked it myself this evening, it's certainly the case that a factorial grows VERY fast and will soon exceed the largest possible integer, after which it will give garbage, so that's probably what's happening.
Bill Goodwine, 376 Fitzpatrick
joneill5

Re: Homework 1, due September 2, 2010.

Post by joneill5 »

Do you want us to put a word document for the Taylor series and the approximation problems, or do we just hand in the problem in class?
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: Homework 1, due September 2, 2010.

Post by goodwine »

joneill5 wrote:Do you want us to put a word document for the Taylor series and the approximation problems, or do we just hand in the problem in class?
No, unless the HW says otherwise, only upload FORTRAN programs. Hand the other stuff, handwritten is fine, in class.
Bill Goodwine, 376 Fitzpatrick
joneill5

Re: Homework 1, due September 2, 2010.

Post by joneill5 »

I followed your instructions on how to open up a window to write the program, but now I can't get back out to run the program. What should I do?
dwolf3

Re: Homework 1, due September 2, 2010.

Post by dwolf3 »

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

Re: Homework 1, due September 2, 2010.

Post by goodwine »

joneill5 wrote:I followed your instructions on how to open up a window to write the program, but now I can't get back out to run the program. What should I do?
If by "open a window" you mean start emacs then do control-x control-c and that will quit it. Be sure to save it first with control-x control-s.
Bill Goodwine, 376 Fitzpatrick
kpadden

Re: Homework 1, due September 2, 2010.

Post by kpadden »

Homework 1
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “AME 20214, Homework 1”