@Test public void testSimpleDifferentiation() { String[] params = new String[] {"A"}; ParametrisedPolynomial simplePoly = new ParametrisedPolynomial(params); ParametrisedPolynomial diffedPoly = simplePoly.differentiate(); Double[][] paramMatrix = diffedPoly.getParamMatrix(); assertEquals(new Double(0.0), paramMatrix[0][0]); }
@Test public void testBiggerDifferentiation() { String[] params = new String[] {"A", "B", "C"}; ParametrisedPolynomial simplePoly = new ParametrisedPolynomial(params); ParametrisedPolynomial diffedPoly = simplePoly.differentiate(); Double[][] paramMatrix = diffedPoly.getParamMatrix(); assertEquals(new Double(2.0), paramMatrix[1][0]); // 2*A*x assertEquals(new Double(1.0), paramMatrix[2][1]); // B }