Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5 (**). A polynomial such as: f(x) = 7.4x5 + 3.1x2 - 10.2x + 14.9 can be represented as a linked list in which every

5 (**). A polynomial such as: f(x) = 7.4x5 + 3.1x2 - 10.2x + 14.9 can be represented as a linked list in which every node corresponds to a term in the polynomial. Each term's coefficient and degree are stored as fields in the corresponding node. Write a menu driven program, to let the user do any of the following:

Find the sum, multiplication, division, and subtraction of two polynomials.

Find the derivative of a polynomial. The rules of finding a derivative:

o If the expression is a constant value, the derivative is zero.

o If the expression is any power in the form AX^N, where is A is a positive or negative integer, and N is any positive integer, the derivative is equal to A times N, times X raised to the power of N-1, or ANX^(N-1).

o The derivative of a sum of multiple operands is the sum of the derivatives of each operand.

For example:

The derivative of 8 is just 0, since 8 is a constant value.

The derivative of X is 1, since A is implied to be 1, and the power of X is implied to be 1. N-1 is zero, and so X^0 is 1, therefore 1(A) times 1(N) times 1(X^0) is equal to 1. The derivative of X^5 is 5 times 1 times X^4, or 5X^4. Evaluate a polynomial (calculate its value) for a given value of x.

Output the polynomial The user will input the size(s) of the polynomial(s) (up to size 9) and its coefficients delimited by one space from the keyboard. For example, given the coefficients 0 0 0 1 22 -333 0 1 and -1, the output would display as: x^5 + 22x^4 - 333x^3 + x - 1. Also, to evaluate a polynomial as stated above the user must also input a given value of x to calculate. Output formatting rules are as follows:

Terms must appear in decreasing order of degree.

Exponents should appear after a caret "^".

The constant term appears as only the constant.

Only terms with nonzero coefficients should appear, unless all terms have zero coefficients in which case the constant term should appear.

The only spaces should be a single space on either side of the binary + and - operators.

If the leading term is positive then no sign should precede it; a negative leading term should be preceded by a minus sign, as in -7x^2 + 30x + 66.

Negated terms should appear as a subtracted unnegated term (except for a negative leading term which should appear as described above.) That is, rather than x^2 + -3x, the output should be x^2 - 3x.

The constants 1 and -1 should appear only as the constant term. That is, rather than -1x^3 + 1x^2 +3x^1 - 1, the output should appear as -x^3 + x^2 + 3x -1. The program must use a linked list. Output should be user friendly. Name the program: PolyProgramXX.java or PolyProgramXX.cpp, where XX are your initials.

image text in transcribedimage text in transcribed

5(**). A polynomial such as: f(x) = 7.4x5 + 3.1x2 - 10.2x + 14.9 can be represented as a linked list in which every node corresponds to a term in the polynomial. Each term's coefficient and degree are stored as fields in the corresponding node. Write a menu driven program, to let the user do any of the following: Find the sum, multiplication, division, and subtraction of two polynomials. Find the derivative of a polynomial. The rules of finding a derivative: If the expression is a constant value, the derivative is zero. o If the expression is any power in the form AX^N, where is A is a positive or negative integer, and N is any positive integer, the derivative is equal to A times N, times X raised to the power of N-1, or ANX^(N-1). o The derivative of a sum of multiple operands is the sum of the derivatives of each operand. For example: The derivative of 8 is just O, since 8 is a constant value. The derivative of x is 1, since A is implied to be 1, and the power of X is implied to be 1. N-1 is zero, and so X^0 is 1, therefore 1(A) times 1(N) times 1(X^) is equal to 1. The derivative of x^5 is 5 times 1 times X^4, or 5X^4. Evaluate a polynomial (calculate its value) for a given value of x. Output the polynomial The user will input the size(s) of the polynomial(s) (up to size 9) and its coefficients delimited by one space from the keyboard. For example, given the coefficients 0 0 0 1 22 -333 0 1 and -1, the output would display as: x^5 + 22x^4 - 333x^3 + x - 1. Also, to evaluate a polynomial as stated above the user must also input a given value of x to calculate. Output formatting rules are as follows: Terms must appear in decreasing order of degree. Exponents should appear after a caret "A". The constant term appears as only the constant. . Only terms with nonzero coefficients should appear, unless all terms have zero coefficients in which case the constant term should appear. The only spaces should be a single space on either side of the binary + and - operators. If the leading term is positive then no sign should precede it; a negative leading term should be preceded by a minus sign, as in -7x^2 + 30x + 66. Negated terms should appear as a subtracted unnegated term (except for a negative leading term which should appear as described above.) That is, rather than x^2 + -3x, the output should be x^2 - 3x. The constants 1 and -1 should appear only as the constant term. That is, rather than - 1x^3 + 1x^2 +3x^1 - 1, the output should appear as - x^3 + x^2 + 3x -1. The program must use a linked list. Output should be user friendly. Name the program: PolyProgramxx.java or PolyProgramxx.cpp, where xx are your initials. 5(**). A polynomial such as: f(x) = 7.4x5 + 3.1x2 - 10.2x + 14.9 can be represented as a linked list in which every node corresponds to a term in the polynomial. Each term's coefficient and degree are stored as fields in the corresponding node. Write a menu driven program, to let the user do any of the following: Find the sum, multiplication, division, and subtraction of two polynomials. Find the derivative of a polynomial. The rules of finding a derivative: If the expression is a constant value, the derivative is zero. o If the expression is any power in the form AX^N, where is A is a positive or negative integer, and N is any positive integer, the derivative is equal to A times N, times X raised to the power of N-1, or ANX^(N-1). o The derivative of a sum of multiple operands is the sum of the derivatives of each operand. For example: The derivative of 8 is just O, since 8 is a constant value. The derivative of x is 1, since A is implied to be 1, and the power of X is implied to be 1. N-1 is zero, and so X^0 is 1, therefore 1(A) times 1(N) times 1(X^) is equal to 1. The derivative of x^5 is 5 times 1 times X^4, or 5X^4. Evaluate a polynomial (calculate its value) for a given value of x. Output the polynomial The user will input the size(s) of the polynomial(s) (up to size 9) and its coefficients delimited by one space from the keyboard. For example, given the coefficients 0 0 0 1 22 -333 0 1 and -1, the output would display as: x^5 + 22x^4 - 333x^3 + x - 1. Also, to evaluate a polynomial as stated above the user must also input a given value of x to calculate. Output formatting rules are as follows: Terms must appear in decreasing order of degree. Exponents should appear after a caret "A". The constant term appears as only the constant. . Only terms with nonzero coefficients should appear, unless all terms have zero coefficients in which case the constant term should appear. The only spaces should be a single space on either side of the binary + and - operators. If the leading term is positive then no sign should precede it; a negative leading term should be preceded by a minus sign, as in -7x^2 + 30x + 66. Negated terms should appear as a subtracted unnegated term (except for a negative leading term which should appear as described above.) That is, rather than x^2 + -3x, the output should be x^2 - 3x. The constants 1 and -1 should appear only as the constant term. That is, rather than - 1x^3 + 1x^2 +3x^1 - 1, the output should appear as - x^3 + x^2 + 3x -1. The program must use a linked list. Output should be user friendly. Name the program: PolyProgramxx.java or PolyProgramxx.cpp, where xx are your initials

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

Are closed-minded and inflexible.

Answered: 1 week ago

Question

5. Describe the visual representations, or models, of communication

Answered: 1 week ago