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

  What are some likely future uses and enhancements

Describe a specific web or mobile application'spurpose. How is it used? What changes has it brought about to its users? What are some likely future uses and enhancements

  B-tree might be an elegant solution for the sorting

As you are working on finalizing the code for your solution, you are thinking that a B-Tree might be an elegant solution for the sorting and search algorithms. In order though to implement the solution in the most elegant fashion the use of recurs..

  Creating database for charity event

Your Project is to organize a charity event. You must use at least two events, one of which must be a Windows program such as Word, WordPad, or Paint.

  Write an algorithm called find-g

Write an algorithm called "Find-G" to nd a maximally-general consistent hypothesis. You can assume the data will be noise-free and that the target concept is in the hypothesis space.

  Question about multi dimensional arrays

Multi-dimensional arrays could cost a lot of memory. Determine how much memory does it take to create an integer array of 3 dimensions,

  Create an array dynamically

Write a program to accept a number representing how many first names the user will enter from the command line (5 names maximum), and the actual first names, from the command line.

  Developing an eer model

Construct an EER model for the given situation using the traditional EER notation, the Visio notation or the supertypes notation.

  Ford-fulkerson algorithm on capacities

Write code that finds a maximum flow in a directed graph, using the Ford-Fulkerson algorithm on capacities given as matrix void maximum flow(

  Write true if the statement is true or false

It is impossible to over-train a multi-layer feed-forward network using the back-propagation learning algorithm. It is guaranteed that the longer you train your system, the more accurate it will perform.

  Let sbe the set of all people in the world for a b epsilon

let sbe the set of all people in the world. for a b epsilon s define a binary relation r as follows a b epsilon r if

  System administrators database, network and application

What methods would you use to effectively manage a team of system administrators database, network, application working in your data center?

  Currency conversion development

Currency Conversion Development

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