U n i v e r s i t y S o f t w a r e POLYNOMIALS SINCLAIR ZX SPECTRUM (16K-48K) _____________________________________________________________ Programs constituting the U n i v e r s i t y S o f t w a r e LIBRARY OF ADVANCED MATH/STAT/ECON have been carefully prepared by a team of PhD students from the University of London. Although the programs are designed to handle the most complex problems, instructions printed on the covers intend to introduce the non-specialist to the fundamentals of the theory. All programs start executing automatically once they are loaded and all that is required is to follow the instruc- tions displayed on the screen. But, the used is not denied the right of having access to the program listings. REM statements give the user an idea about how they work. If shorter execution times or more memory space is required, they may be excluded from programs. © Copyright 1983 U n i v e r s i t y S o f t w a r e 29 St. Peters Street, London N1 8JP No part of this recording, its program listings or the contents of this cassette inlay can be reproduced without written permission. Although due care has been taken in preparing these programs, the publisher is not responsible for any errors or liable for any damage arising from their use. _____________________________________________________________ Side A : REAL ROOTS OF POLYNOMIALS A polynomial is a function of the form : n n-1 2 F(x) = c x + c x + . . c x + c x + c n n-1 2 1 0 where cn......c0 are called the coefficients and n the degree of polynomial. The values of x which satisfy F(x)=0 are called the roots of the polynomial. To calculate the roots the present program employs three different methods. (i) Quadratic Equations are in fact second degree poly- nomials. If the degree of a polynomial is entered as 2, the roots are calculated by the formula : ____________ _ / 2 -c +/c - 4c c __1_V__1______2_0___ 2c 0 (ii) Newton-Raphson Method is applied to higher degree (3 or more) polynomials. The basic step of the method is as follows : starting with an arbitrarily chosen initial value of x (say x0), another x (say x1) is produced which is closer to any one of the roots of the function F(x). x1 is produced by the formula : F(x ) x = x - ____0__ 1 0 F'(x ) 0 where F(x0) is the value of the first derivative of F(x) for x=x0. Of course, we assume that F(x) is differentiable. This step is repeated until the difference between the new x and the old x is less than a desired degree of accuracy. In this program this accuracy level is set as 10^-8. If F(x) does not have any real roots, iteration is carried out 100 times. The option of iterating another 100 times is available. If one root is found, other roots can be searched for by entering different initial values. Although Newton-Raphson method of approximation works much faster than the half- interval search method, it is difficult to guess which initial value approximates to which root. (iii) Half-interval Search Method looks for a change of sign of F(x) within a given interval. First the interval is divided into 10 equal parts and the sign change is searched for these increments. If a sign change is found the limits of the current increment is defined as a new interval and in turn divided into 10 increments. This procedure is repeated until the increment is less than 10^-8. If no sign change is found in first 10 iterations, the original interval is divided into 100 increments and search is repeated. If still no sign change is found the absence of real roots within given interval is reported. Side B : PLOT OF POLYNOMIALS This program plots the polynomials between given limits, prints the extremum values and the lower and upper limits on the axes. If a root is found x axis adjusts its location according to the values of polynomial and the approximate value of the root is printed at the intersection point. It is advisable to use this program first to have an idea about the behavious of the polynomial and then use Side A to determine the precise values of roots. _____________________________________________________________ U S POLYNOMIALS _____________________________________________________________ UNIVERSITY SOFTWARE Library of Advanced Math/ Stat/ Econ: MATRIX OPERATIONS POLYNOMIALS INTEGRATION REGRESSION LINEAR PROGRAMMING