Elaborating some earlier programs

New version of the table of factorials program: write
to a file instead of the screen.

New version of the program to compute the integral of
the function f(x) = fourth root of 1  x^2 on the
interval [0,1]: it should declare f as a C function.

The integral of e^{x^2/2}

The series 1 + 1/2^3 + 1/3^3 + 1/4^3 + ...
Problem 1.
Rewrite your factorial program so that it writes its output to a
file using fopen and fprintf.
Problem 2
Rewrite your program to compute the integral of the fourth root
of 1  x^2 on the interval [0,1] so that it uses a function
declaration.
Problem 3
Modify the previous program to compute the integral of
e^{x^2/2} on the interval [1,1]. Aim for two decimals of
accuracy and discuss the precision actually obtained. Make a
sketch of the geometric figure whose area the integral
represents.
Problem 4
Write a program which computes the sum
f(1) + f(2) + \cdots + f(n)
where f is an arbitrary function delared as a C function and
where the user specifies n. Use this program to compute an
approximation to the sum
beta = 1 + 1/2^3 + 1/3^3 + 1/4^3 + ...
accurate to two decimal places. What value of n need to achieve
this accuracy? Justify your answer.
Back to syllabus
Back to Department of Mathematics, University of Utah
Last modified: Feb 22, 1995
Copyright © 1995 Department of Mathematics, University of
Utah