692692 d = P ([0.5490673726445683 , 0.15991109487875477 ]);
693693 @test degree (gcd (a* d,b* d)) == 0
694694 @test degree (gcd (a* d, b* d, atol= sqrt (eps ()))) > 0
695- VERSION >= v " 1.2.0" && @test degree (gcd (a* d,b* d, method= :noda_sasaki )) == degree (d)
696- @test degree (gcd (a* d,b* d, method= :numerical )) == degree (d)
695+ if VERSION >= v " 1.2.0"
696+ @test degree (gcd (a* d,b* d, method= :noda_sasaki )) == degree (d)
697+ @test degree (gcd (a* d,b* d, method= :numerical )) == degree (d)
698+ end
697699
698700 l,m,n = (5 ,5 ,5 ) # realiable, though for larger l,m,n only **usually** correct
699701 u,v,w = fromroots .(rand .((l,m,n)))
@@ -705,49 +707,52 @@ end
705707 q = (x+ 10 )* (x^ 9 + x^ 8 / 7 - 6 // 7 )
706708
707709 @test degree (gcd (p,q)) == 0
708- VERSION >= v " 1.2.0" && (@test degree (gcd (p,q, method= :noda_sasaki )) == 1 )
709- @test degree (gcd (p,q, method= :numerical )) == 1
710-
711- # more bits don't help Euclidean
712- x = variable (P{BigFloat})
713- p = (x+ 10 )* (x^ 9 + x^ 8 / 3 + 1 )
714- q = (x+ 10 )* (x^ 9 + x^ 8 / 7 - 6 // 7 )
715- @test degree (gcd (p,q)) == 0
716-
717- # Test 1 of Zeng
718- x = variable (P{Float64})
719- alpha (j,n) = cos (j* pi / n)
720- beta (j,n) = sin (j* pi / n)
721- r1, r2 = 1 / 2 , 3 / 2
722- U (n) = prod ( (x- r1* alpha (j,n))^ 2 + r1^ 2 * beta (j,n)^ 2 for j in 1 : n)
723- V (n) = prod ( (x- r2* alpha (j,n))^ 2 + r2^ 2 * beta (j,n)^ 2 for j in 1 : n)
724- W (n) = prod ( (x- r1* alpha (j,n))^ 2 + r1^ 2 * beta (j,n)^ 2 for j in (n+ 1 ): 2 n)
725- for n in 2 : 2 : 20
726- p = U (n) * V (n); q = U (n) * W (n)
727- @test degree (gcd (p,q, method= :numerical )) == degree (U (n))
728- end
729-
730- # Test 5 of Zeng
731- x = variable (P{Float64})
732- for ms in ((2 ,1 ,1 ,0 ), (3 ,2 ,1 ,0 ), (4 ,3 ,2 ,1 ), (5 ,3 ,2 ,1 ), (9 ,6 ,4 ,2 ),
733- (20 , 14 , 10 , 5 ), (80 ,60 ,40 ,20 ), (100 ,60 ,40 ,20 )
734- )
710+ if VERSION >= v " 1.2.0"
711+ (@test degree (gcd (p,q, method= :noda_sasaki )) == 1 )
712+ @test degree (gcd (p,q, method= :numerical )) == 1
713+ end
714+
715+ if VERSION >= v " 1.2.0"
716+ # more bits don't help Euclidean
717+ x = variable (P{BigFloat})
718+ p = (x+ 10 )* (x^ 9 + x^ 8 / 3 + 1 )
719+ q = (x+ 10 )* (x^ 9 + x^ 8 / 7 - 6 // 7 )
720+ @test degree (gcd (p,q)) == 0
721+
722+ # Test 1 of Zeng
723+ x = variable (P{Float64})
724+ alpha (j,n) = cos (j* pi / n)
725+ beta (j,n) = sin (j* pi / n)
726+ r1, r2 = 1 / 2 , 3 / 2
727+ U (n) = prod ( (x- r1* alpha (j,n))^ 2 + r1^ 2 * beta (j,n)^ 2 for j in 1 : n)
728+ V (n) = prod ( (x- r2* alpha (j,n))^ 2 + r2^ 2 * beta (j,n)^ 2 for j in 1 : n)
729+ W (n) = prod ( (x- r1* alpha (j,n))^ 2 + r1^ 2 * beta (j,n)^ 2 for j in (n+ 1 ): 2 n)
730+ for n in 2 : 2 : 20
731+ p = U (n) * V (n); q = U (n) * W (n)
732+ @test degree (gcd (p,q, method= :numerical )) == degree (U (n))
733+ end
734+
735+ # Test 5 of Zeng
736+ x = variable (P{Float64})
737+ for ms in ((2 ,1 ,1 ,0 ), (3 ,2 ,1 ,0 ), (4 ,3 ,2 ,1 ), (5 ,3 ,2 ,1 ), (9 ,6 ,4 ,2 ),
738+ (20 , 14 , 10 , 5 ), (80 ,60 ,40 ,20 ), (100 ,60 ,40 ,20 )
739+ )
740+
741+ p = prod ((x- i)^ j for (i,j) in enumerate (ms))
742+ dp = derivative (p)
743+ @test degree (gcd (p,dp, method= :numerical )) == sum (max .(ms .- 1 , 0 ))
744+ end
745+
746+ # fussy pair
747+ x = variable (P{Float64})
748+ for n in (2 ,5 ,10 ,20 ,50 , 100 )
749+ p = (x- 1 )^ n * (x- 2 )^ n * (x- 3 )
750+ q = (x- 1 ) * (x- 2 ) * (x- 4 )
751+ @test degree (gcd (p,q, method= :numerical )) == 2
752+ end
753+
754+ end
735755
736- p = prod ((x- i)^ j for (i,j) in enumerate (ms))
737- dp = derivative (p)
738- @test degree (gcd (p,dp, method= :numerical )) == sum (max .(ms .- 1 , 0 ))
739- end
740-
741- # fussy pair
742- x = variable (P{Float64})
743- for n in (2 ,5 ,10 ,20 ,50 , 100 )
744- p = (x- 1 )^ n * (x- 2 )^ n * (x- 3 )
745- q = (x- 1 ) * (x- 2 ) * (x- 4 )
746- @test degree (gcd (p,q, method= :numerical )) == 2
747- end
748-
749-
750-
751756end
752757
753758
0 commit comments