# LAB 8

## Objectives

• Delegate to functions and subroutines
• Use the SLATEC Library

## Task-A: Tabulate the Bessel Function

This is identical to what we did in Lab7, namely, tabulate the Bessel function of the first kind of order 1 in the range [0,10], except we don't compute it ourselves but get it from the library; i.e. the program, to be called `Lab8A` does not add terms or even know about the series. It merely invokes a function as if it is built in.

The content of the SLATEC library can be examined by viewing the file `toc` (table of content) which is stored in the `SLATEC\DOC` directory. Open this file using any editor and examine the A-Z categories. Category-C refers to "special functions" and Bessel is one of them. Alternatively, you can search for the word "Bessel" and this will lead you to section C10. Either way, you will find that `dBesj1` is the sought function (the D prefix, and the -D suffix, indicate double precision, or real*8). Use your browser to open the documentation of this particular function. It should be in `SLATEC\DOC` under the filename: `dbesj1.f.html`.

### Deliverables

1. Printed program
2. Printed Tabulation

## Task-B: Find Zeros of the Bessel Function

The tabulation of the Bessel function indicates it crosses the x-axis around x=3 and around x=7. We like to compute these two zeros with high precision, say 1.E-8. Rather than writing our own Newton method, we want to use one from the library.

Starting with the `toc` file of SLATEC, we observe that category F is solution of non-linear equations. Scrolling down to section F reveals that F1A deals with polynomials while F1B deals with the general case. This leads us to `dFzero`. Use your browser to open the documentation of this particular subprogram. It is in `SLATEC\DOC` under the filename `dfzero.f.html`. The documentation tells us this a subroutine (i.e. must invoke it using `call`) and it lists all its parameters. The first is the name of the function whose zeros are to be found. In our case this is `dBesj1` and as the documentation says, it must be declared as `external` in our program. This routine looks for zeros in the interval [b,c] with tolerance specified as a relative or absolute error. For our purpose, set both to 1.E-8.

### Deliverables

1. Printed program
2. The values of the two zeros.

## Task-C: Integrate the Bessel Function

We like to integrate the bessel function between two given values of x. Rather than adding up trapezoids, we like to do this using a library routine with tolerance 1.E-8.

Starting with the `toc` file of SLATEC, we observe that category H includes integration. This quickly leads us to the subroutine `dGaus8`. Read its documentation in `dgaus8.f.html`.

1. Printed program
2. The result of the integration between `0.` and `3.831706`.
3. The result of the integration between `3.831706` and `7.0155867`.

Fall2002/HR