@@ -22,17 +22,24 @@ three_halves_pi = 3*big_pi/2
2222 f′ (x) = 2 * x* exp (x^ 2 ) + sin (x)
2323 f1 (x) = x^ 4 - 10 x^ 3 + 35 x^ 2 - 50 x + 24
2424 f1′ (x) = 4 x^ 3 - 30 x^ 2 + 70 x - 50
25-
25+ f2 (x) = 4567 x^ 2 - 9134 x + 4567
26+ f2′ (x) = 9134 x - 9134
27+ f3 (x) = (x^ 2 - 2 )^ 2
28+ f3′ (x) = 4 x * (x^ 2 - 2 )
2629 for autodiff in (false , true )
2730 if autodiff
2831 rts1 = newton1d (sin, - 5 .. 5 )
2932 rts2 = newton1d (f, - ∞.. ∞)
3033 rts3 = newton1d (f1, - 10 .. 10 )
34+ rts4 = newton1d (f2, - 10 .. 11 )
35+ rts5 = newton1d (f3, - 10 .. 10 )
3136
3237 else
3338 rts1 = newton1d (sin, cos, - 5 .. 5 )
3439 rts2 = newton1d (f, f′, - ∞.. ∞)
3540 rts3 = newton1d (f1, f1′, - 10 .. 10 )
41+ rts4 = newton1d (f2, f2′, - 10 .. 11 )
42+ rts5 = newton1d (f3, f3′, - 10 .. 10 )
3643 end
3744
3845 @test length (rts1) == 3
@@ -42,12 +49,20 @@ three_halves_pi = 3*big_pi/2
4249 end
4350
4451 @test length (rts2) == 1
45- @test (0 .. 0 ) == rts2[1 ]. interval && :unique == rts2[1 ]. status
52+ @test (0 .. 0 ) == rts2[1 ]. interval && :unknown == rts2[1 ]. status
4653
4754 @test length (rts3) == 4
4855 L = [1 , 2 , 3 , 4 ]
4956 for i = 1 : length (rts3)
5057 @test L[i] in rts3[i]. interval && :unique == rts3[i]. status
5158 end
59+
60+ @test length (rts4) == 1
61+ @test 1 in rts4[1 ]. interval && :unknown == rts4[1 ]. status
62+
63+ L1 = [- sqrt (2 ), - sqrt (2 ), sqrt (2 ), sqrt (2 )]
64+ for i = 1 : length (rts5)
65+ @test L1[i] in rts5[i]. interval && :unknown == rts5[i]. status
66+ end
5267 end
5368end
0 commit comments