|
1 | 1 | @testset "Non-commutative Monomial" begin |
2 | 2 | Mod.@ncpolyvar x |
3 | | - X = constantmonomial(typeof(x)) |
4 | | - @test nvariables(X) == 0 |
5 | | - @test isempty(X.vars) |
6 | | - @test isempty(X.z) |
7 | | - X = constantmonomial(x) |
8 | | - @test nvariables(X) == 1 |
9 | | - @test variables(X)[1] == x |
10 | | - @test collect(exponents(X)) == [0] |
11 | | - X = monomial(x) |
12 | | - @test nvariables(X) == 1 |
13 | | - @test variables(X)[1] == x |
14 | | - @test collect(exponents(X)) == [1] |
15 | | - X = x^0 |
16 | | - Y = X * x^2 |
17 | | - @test nvariables(Y) == 1 |
18 | | - @test variables(Y)[1] == x |
19 | | - @test collect(exponents(Y)) == [2] |
20 | | - Y = x^2 * X |
21 | | - @test nvariables(Y) == 1 |
22 | | - @test variables(Y)[1] == x |
23 | | - @test collect(exponents(Y)) == [2] |
| 3 | + X_ = constantmonomial(typeof(x)) |
| 4 | + @test nvariables(X_) == 0 |
| 5 | + @test isempty(X_.vars) |
| 6 | + @test isempty(X_.z) |
| 7 | + X0 = constantmonomial(x) |
| 8 | + for Y in [x^0, X0] |
| 9 | + @test nvariables(Y) == 1 |
| 10 | + @test variables(Y)[1] == x |
| 11 | + @test collect(exponents(Y)) == [0] |
| 12 | + end |
| 13 | + for X in [X_, X0] |
| 14 | + for Y in [monomial(x), x^1, x * X, X * x] |
| 15 | + @test nvariables(Y) == 1 |
| 16 | + @test variables(Y)[1] == x |
| 17 | + @test collect(exponents(Y)) == [1] |
| 18 | + end |
| 19 | + end |
| 20 | + for X in [X_, X0] |
| 21 | + for Y in [x^2, X * x^2, x^2 * X] |
| 22 | + @test nvariables(Y) == 1 |
| 23 | + @test variables(Y)[1] == x |
| 24 | + @test collect(exponents(Y)) == [2] |
| 25 | + end |
| 26 | + end |
24 | 27 | end |
25 | 28 | @testset "Non-commutative MonomialVector" begin |
26 | 29 | Mod.@ncpolyvar x y |
|
0 commit comments