Copyright © – Sudharsan Iyengar
CS – 415: Spring 2023 Sudharsan
Iyengar 2/14/2023
Polynomial Operations:
You are required to write an application that will perform polynomial operations. A polynomial is of the form
AnXn + An-1Xn-1+ ……+ A1X+A0
Where A0, A1, …., An-1, An are constants and X is a variable.
Write a FORTRAN application that will store polynomials and simple way for user to choose two polynomials, and perform operations using the corresponding polynomial(s).
Select and Evaluate a Polynomial, given an input value
Select and add two Polynomials and display the result polynomial
The polynomials are in an input file poly.dat – that describes 3 polynomials using the following format: (assume polynomial degree < 20).
The first line indicates the number of polynomials described in the file.
Each subsequent line describes a polynomial using pairs of integers – each pair representing a term ex: 5X3 is represented by the pair 5 3
Example poly.dat file.
3
6 3 4 1 2 0
10 12 18 6 -4 2 1 1
4 1 -20 0
This file describes 3 polynomials. The first one is 6X3 + 4X + 2, the second one is 10X12+ 18X6 – 4X2 + X, and the third one is 4X – 20.
You can output a polynomial read from the file and the results of operations as follows:
10X^12 + 18X^6 - 4X^2 + X
You should store
your project to your folder for this class by midnight on the due date.