Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Math JAVA challenging question question. Please see the pictures and there is th

ID: 3884135 • Letter: M

Question

Math JAVA challenging question question. Please see the pictures and there is the question and the library. Not sure what part of the library I would use to answer the question and i did try to start the problem. NEED HELP!

1limport 4 java . util . ArrayList; 5 public class LibrariesChallengePS 6 7 8 7 5 points 9 static Polynomial Q1 (Polynomial input, double x)f 10 11 double x1 = input . evaluate(x); 12 13 14 Polynomi alp= new Polynomial(list); 15 16 17 18 // return any Polynomial that intersects the input Polynomial at x ArrayListDouble> list new ArrayList(); = return null;

Explanation / Answer

Suppose a polynomial is given to you as:

x^2 -3x - 4 = 0;

If you try finding polynomial which intersects it at x = 6, Then both the polynomials should have the same value at x = 6..

So value of x^2 -3x - 4 at x=6 is: 36 - 18 - 4 = 14..

So we are sure that at x = 6, the resultant polynomial should give us value 14..

Now There can be a lot of polynomials like line, circle, parabola etc. which may give us value of 14 at x = 6.. x=6 and value of 14 is nothing but just a point (6,14) and there can be inifinite shapes / lines passing through a point in the space..

A simple line can be a line passing parallel to x axis which always returns value 14 on y axis.. Its equation will be y = 14.. you notice that there is no power of x in the equation, hence it will not change its y value at any value of x.

Similarly, there can be line with gradient(not parallel to x axis) which are passing through point (6,14)..

a simple example can be y = x+8, This line will give you y = 14 at x = 6..

There can be many more examples..

For this question, lets try to answer in form of polynomial as x + c, where c is the constant term..
As given in above example, if we need to find intersection at p, and the value of Poynomial comes as v at x=p, then we can find the equation as x + (v - p)
in the last example, p was 6, and v came to 14, hence the derived equation was x + (14 - 6) = x - 8(Answer)

now comes the progamming part:

static Polynomial Q1(Polynomial input, double p) {

double v = input.evaluate(p);

ArrayList<Double> list = new ArrayList<Double>();

// add constant term

list.add(v - p);

// add the term containing x power..

// notice that multiple of x will always be 1 in this case

list.add(1);

return new Polynomial(list);

}