In this assignment you will create a library of functions related to radiocarbon
dating and use that library to print some results.
-
First, create one file containing at least two functions. One should
solve the time equation for C14
and another solve the concentration equation
Feel free to add other functions if you want.
-
Create another file containing the main procedure. This should prompt
the user to enter a mass fraction of C14 (i.e. the
ratio of N(t)/N(0)) and should print out the estimated time since the
creature died. Then it should prompt the user for an initial
concentration and time in years and print out the concentration at that
time.
-
Finally, optionally create a Makefile to compile the two files and link
them together. If you decide not to create a Makefile please include
the commands to compile the files in a commented section of the file
containing the main function. Remember, indention in Makefiles
must be done with tabs.
Comment the code well, ensure the compiler does not generate any warnings,
and generate a tar file containing all the files as per the instructions on
the home page.
Note that while you can certainly write your own exponential and logarithm
functions if you want you are allowed to link to the standard math library
and use the built in functions
double exp (double) and
double log (double) (see man 3 exp
and man 3 log for more function information). To do this you
should include the header math.h and link with the math library
using -lm. A sample link command for two files, main.c and lib.c,
that links in the math library could look like this
cc -Wall -o hw3 main.c lib.c -lm
To test your results a mass fraction of 0.17 should result in a time of
14648 years.