Automatic differentiation of polynomials. Realize it in this way. Use the \'inpu
ID: 3687376 • Letter: A
Question
Automatic differentiation of polynomials. Realize it in this way. Use the 'input' function to get a polynomial and a x value (which means two 'input' functions in your program). An input polynomial should have a form of a*x**n + b*x**(n-1) +... + constant Ex.) 3*x**2 + 2*x + 17.1 *x**3+12.345*x**0 5.3 * x ** 10 - 8.0 * x ** 1 -256 * x It shouldn't contain any variables except x. (The coefficients a, b.... and the exponent n in the abeve form must be just numbers. Exponents must be nonnegative integers.) You must not allow any parentheses in the input polynomial. Use the metheds of string type and the type conversion functions to calculate the output differentiation value. Your progam must be able to handle strange inputs by using the 'try-except-else' structure. Test your program with your inputs. Add comments describing your test results.Explanation / Answer
public class Polynomialdifferentiate { private int[] coeff1; // Theese are the coefficients private int degree1; // This is the degree of polynomial // This is the constructor to pass in the polynomial value public Polynomialdifferentiate(int a, int b) { coeff1 = new int[b+1]; coeff1[b] = a; degree1 = degreecalculate(); } //This function is used to return the degree of this polynomial public int degreecalculate() { int d = 0; for (int i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.