Question: Please implement this in java! the example output is at the end. Cannot import packages. Thank you! // 5.1 public static int[] calculateDerivative (int[] polyArr)

Please implement this in java! the example output is at the end. Cannot import packages. Thank you!

Please implement this in java! the example output is at the end.

Cannot import packages. Thank you! // 5.1 public static int[] calculateDerivative (int[]

// 5.1 public static int[] calculateDerivative (int[] polyArr) dy 1 From your AP Calculus course or Math 20A/B/C course, given a polynomial f(x) = 2, + ajx' + a2x2 +...+ an. 121-1 + anx", the derivative dx = a + 2*@2x+...+(n-1)*an-147-2 +n*anxin-1 The derivative of a polynomial function will also be a polynomial. Below are some basic examples of derivatives, in case you forgot how to do them (As a student in DSC major/minor, derivatives are important !). = dx = = 4 f(x) = 5, f'(x) = ax = 0 f(x) = 2 + 3x + 7x, f'(x) = ax = 3 + 14x f(x) = 9 + 5x + 15x + x^, f'(x) = dy = 5 + 45x + 4x3 f(x) = x + 2x, f'(x) = ax = 1 + 10x* f(x) = 0, f'(x) dy = 4 = dx = = 0 275 Prompt: This exercise practices how polynomials can be represented using an array as well as performing derivatives on a polynomial algorithmically. We'll be storing the coefficients into an array, padded with O's if the term has coefficients 0. Eg: f(x) = x + = 0 + 1x + 0x + Ox? + Ox* + 2x" and will be represented as [0,1,0,0,0,2]. Given an array representation of a polynomial function f(x), where coefficients are placed in ascending powers, you'll be performing the derivative operation, and returning an array that represents the polynomial function f'(x). For the input array (polyArr), you are guaranteed that O's will be padded correctly such that the value at index i will always correspond to coefficient for x'. Below are some example inputs and corresponding outputs. Note: We'll only be giving polynomial functions, which excludes exponential functions ( e*) and trigonometric functions(Eg: sin(x)). Polynomial functions will always be presented in ascending powers. The output array should have length equivalent to the (highest power of the polynomial + 1). You can't pad additional O's at the back, and you should pad O's if the corresponding derivative term has coefficient 0. You are guaranteed that the length of input array(polyArr) will always be greater than 0 f(x) f(x) Mathematical notation polyArr Mathematical notation Output Array 2 + 3x + 7x? [2, 3, 7] 3 + 14x [3,14] 9 + 5x + 15x3 + x4 + [9,5, 0, 15, 1] 5 + 45x + 4x? [5, 0, 45, 4] 5 x + 2x [0, 1, 0, 0, 0, 2] 1 + 10x+ (1, 0, 0, 0, 10] 5 [5] 0 [O] 5 3 x + 6x 4 [0, 0, 0, 1, 0, 6, 1] 5 6 + x 3x + 30x* + 6x [0, 0, 3, 0, 30, 6]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!