Test of root method, of class Secant.
()
| 108 | * Test of root method, of class Secant. |
| 109 | */ |
| 110 | @Test |
| 111 | public void testRoot_4args() |
| 112 | { |
| 113 | System.out.println("root"); |
| 114 | double eps = 1e-15; |
| 115 | double result = Secant.root(-PI/2, PI/2, sinF); |
| 116 | assertEquals(0, sinF.f(result), eps); |
| 117 | |
| 118 | result = Secant.root(-6, 6, polyF); |
| 119 | assertEquals(-4.8790576334840479813, result, eps); |
| 120 | |
| 121 | result = Secant.root(-6, 6, polyF, 0); |
| 122 | assertEquals(-4.8790576334840479813, result, eps); |
| 123 | |
| 124 | |
| 125 | result = Secant.root(-PI / 2, PI / 2, sinFp1, 0.0, 1.0); |
| 126 | assertEquals(0, sinFp1.f(result, 1.0), eps); |
| 127 | |
| 128 | try |
| 129 | { |
| 130 | result = Secant.root(-PI / 2, PI / 2, sinFp1); |
| 131 | fail("Should not have run"); |
| 132 | } |
| 133 | catch (Exception ex) |
| 134 | { |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * Test of root method, of class Secant. |