Test of root method, of class Secant.
()
| 139 | * Test of root method, of class Secant. |
| 140 | */ |
| 141 | @Test |
| 142 | public void testRoot_5args() |
| 143 | { |
| 144 | System.out.println("root"); |
| 145 | double eps = 1e-15; |
| 146 | double result = Secant.root(eps, -PI/2, PI/2, sinF); |
| 147 | assertEquals(0, sinF.f(result), eps); |
| 148 | |
| 149 | result = Secant.root(eps, -6, 6, polyF); |
| 150 | assertEquals(-4.8790576334840479813, result, eps); |
| 151 | |
| 152 | result = Secant.root(eps, -6, 6, 0, polyF); |
| 153 | assertEquals(-4.8790576334840479813, result, eps); |
| 154 | |
| 155 | |
| 156 | result = Secant.root(eps, -PI / 2, PI / 2, sinFp1, 0.0, 1.0); |
| 157 | assertEquals(0, sinFp1.f(result, 1.0), eps); |
| 158 | |
| 159 | try |
| 160 | { |
| 161 | result = Secant.root(eps, -PI / 2, PI / 2, sinFp1); |
| 162 | fail("Should not have run"); |
| 163 | } |
| 164 | catch (Exception ex) |
| 165 | { |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | @Test |
| 170 | public void testRoot_6args() |