# Lecture 4: Basic Arithmetic Algorithms

### Date: Jan. 26

### Background Material and Further Resources

- Review Maple and C programming.

### Reading

- Chap. 4 of the text.
- Handout: "Computer Algebra of Polynomials and Rational Functions"

### Topics

- Go over assignment 3
- Maple programs for computing the probability that two Gaussian integers
are relatively prime and the average number of division steps
in the Euclidean algorithm for Gaussian integers.
- Introduction to the SACLIB computer algebra library (A library
of C callable algorithms for computing with polynomials and related
structures. See Using SACLIB for
a brief introduction on how to use SACLIB.
- Elementary data structures and algorithms in SACLIB.
- list processing
- representation of integers and polynomials
- algorithms for basic arithmetic (DPR, DQR, IPROD, IQR, ISUM)
- Computing time analysis of these functions.

- Relating empirical computing times to theoretical computing times.
E.G. Classical algorithm for integer multiplication.
- Obtaining empirical computing times for random inputs with
varying sizes.
- Example timing program
tiprod.c (time integer product routine IPROD). See
Makefile
to compile and link this programs.
- Ploting times as a function of input sizes and comparing
(using limits) to theoretical computing times.
- Obtaining function to estimate computing time by fitting
timing data to computing time function with unkown parameters.
- Maple worksheet illustrating these
ideas using data from tiprod.

- Computing time analysis of two methods for computing modular
inverses in Z_m, where m is a beta digit (fits in a single word).
See MDINV from the SACLIB library for an approach using the
half-extended Euclidean algorithm. The second approach uses
Fermat's theorem and a fast algorithm for computing modular
powers (see MDEXP for the fast powering algorithm).

### Maple Worksheet

- giavg.mws(Solution to assignment
3 - Gaussian integer relative primality probability calculation and
calculation of the average number of divisions in the Euclidean
algorithm)
- tiprod.mws(Analysis of the computing time
of the SACLIB algorithm IPROD for computing arbitrary precision
integer products).

### Assignment

Created: Jan. 27, 2000 by
jjohnson@mcs.drexel.edu