Constructing a polynomial given an array of coefficients

Assignment Help Data Structure & Algorithms
Reference no: EM13842170

A polynomial of a real valued variable x is an expression of the form a

n x n + an-1xn-1 + ... + a1x1+ a0

where a0 , ..., an are real constants, called coefficients.

For instance, 2.5 x 3 +1.2x-5 is a polynomial of x with a3=2.5, a2=0, a1=1.2 and a0=-5.

In this project, you are required to develop a class named Polynomial that supports symbolic manipulation of polynomials of a fixed variable x, that is, all polynomials are polynomials of the same variable x. Your class must at least support operations for

1. Constructing a polynomial given an array of coefficients. For example, given the float point number array {2.5,0.0,1.2,-5}, the operation constructs a Polynomial  object representing 2.5x3+1.2x-5.

This is a constructor.

2. Adding one polynomial to another. For example, if this object represents 2.5x3+1.2x-5 then adding another object representing 7x4+2x3+x2+3 to this object 

changes this object so that it represents 7x4+5.5x3+x2+1.2x-2.

Note that the ranks (the largest exponent) of the two polynomials are not necessary the same.

3. Multiplying one polynomial by another. For example, if this object represents

2x2+x-5 then multiplying it by another object representing 3x3+x2+3 changes thisobject so that it represents 6x5+5x4-14x3+x2+3x-15. Again the ranks of the two polynomials are not necessary the same.

4. Evaluating a polynomial for a given value for x. For instance, if this object represents 2x2+x-5 then evaluating it for x=2 yields 5.

5. Converting a Polynomial object to a string so that the Polynomial object can be displayed. If this object represents 3x3+x2-1 then the method should return "3*x^3 + x^2 - 1" although "3*x^3 + 1*x^2 + 0*x^1 + (-1)" is acceptable

1. Specify, design and implement Polynomial. Your implementation must use linked lists to represent polynomials.

2. Write an interactive test program that tests all the public methods of the Polynomial class.

Please submit the following.

 Analysis: test data;

 Design:

1. Class diagrams showing representation of data;

2. A class invariant for each class;

3. Pre/Post conditions for required operations;

4. Algorithms for required operations. Algorithms can be described in English,

Reference no: EM13842170

Questions Cloud

Write a program to load an array : Write a program to load an array
What is the main theme of the righteous mind : What is the main theme of The Righteous Mind by Jonathan Haidt? What are 2 to 3 similarities between The Righteous Mind and Sam Harris' book Free Will?
A uml class diagram to describe the ordering system class : a UML class diagram to describe the ordering system class
How you as a crisis intervention worker will help the person : For this Assignment, you will pick one of the case studies provided and using the ABC Model of Crisis Intervention, write a six-page paper on how you as a crisis intervention worker will help the person who comes into your office with a crisis
Constructing a polynomial given an array of coefficients : Constructing a polynomial given an array of coefficients
In search of strategy by markides-what is the message : Read the article (In Search of Strategy by Markides) and answer the question What's the message (the idea, concept, thesis)
How much revenue would gonzales company report related : How much revenue would Gonzales Company report related to this contract on its income statement for the year ended December 31, 2013? How much would it report as cash flows from operating activities for 2013?
Define anorexia nervosa : Anorexia Nervosa: Define anorexia nervosa, refer to its prevalence and main symptoms, examine its causes and effects, and consider various treatment options.
Analyze effects of malnutrition and starvation : Effects of starvation: Analyze effects of malnutrition and starvation on individual mental and physical health, as well mention possible social consequences. Conclude what starvation effects you consider most important.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Briefly define the caesar cipher

What are the two basic functions used in encryption algorithms and how many keys are required for two people to communicate via a cipher?

  Question about lan and wan

Think about the following two scenarios two computers are connected to a LAN using a total of 20-feet of cable, and two computers are connected over the Internet and are 8000 miles from each other.

  Define difference between algorithm and heuristic

Please explain in detail the Difference Between the following terms Algorithm and Heuristic

  Build b tree for the part table

Build B+ tree for the PART table with n = 6 pointers; illustrate how B+ tree expand (show several intermediate trees) and what final tree will look like.

  Characteristics that influence the buying decision

Purchaser's perceptions of a item and its value are an important influence on pricing. Value consciousness, price consciousness, and prestige sensitivity are three ways of explaining these perceptions.

  Data systems and design

Suppose if you have a program with a housekeep() module, a mainloop() module, and a finishup() module, when is the second input record usually read?

  Create a loop structure to display all integer values

Determine if the first number is larger than, smaller than, or equal to the second number.

  Computing available storage space

There are twenty gigabyte of space on a computer's hard disk. I transfer information via a telephone line (connection) at the rate of 14,400 bits per second.

  Explain spacewise efficient implementation two-stack data

Structure of such two-stack data type would consist of two arrays and two top pointers. Describe why this may not be a spacewise efficient implementation.

  Perform the acyclic-topological sort algorithm

Perform the acyclic-topological sort algorithm on the directed graph having vertex set a-k and edges {(j; a);(j; g);(a; b);(a; e);(b; c);(c; k);(d; e);(e; c);(e; f);(e; i);(f; k); (g; d);(g; e);(g; h);(h; e);(h; i);(i; f);(i; k)} Show the state of th..

  Create unix shell scripts using dos commands

Suppose you are an experienced DOS programmer and you wish to create UNIX shell scripts using DOS commands.

  Create all the possible combinations of array a

The subset-sum problem is defined as follows: given a set B of n positive integers and an integer K, can you find a subset of B whose elements' summation is equal to K? Design an algorithm to solve this problem. Address its correctness and running..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd