Skip to content

Commit

Permalink
Examples in Docu following PR #1591 (#1601)
Browse files Browse the repository at this point in the history
* Examples in Docu following PR #1591

* typo
  • Loading branch information
wdecker authored Oct 7, 2022
1 parent b194bdf commit f3a3d8c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/src/NoncommutativeAlgebra/PBWAlgebras/ideals.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ gen(I, 2)

#### Powers of Ideal

```@docs
^(I::PBWAlgIdeal{D, T, S}, k::Int) where {D, T, S}
```

#### Sum of Ideals

```@docs
Expand All @@ -63,6 +67,10 @@ gen(I, 2)

#### Product of Ideals

```@docs
*(I::PBWAlgIdeal{DI, T, S}, J::PBWAlgIdeal{DJ, T, S}) where {DI, DJ, T, S}
```

### Intersection of Ideals

```@docs
Expand Down
36 changes: 36 additions & 0 deletions src/Rings/PBWAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -726,13 +726,49 @@ function _as_right_ideal(a::PBWAlgIdeal{D}) where D
end
end

@doc Markdown.doc"""
*(I::PBWAlgIdeal{DI, T, S}, J::PBWAlgIdeal{DJ, T, S}) where {DI, DJ, T, S}
Given two ideals `I` and `J` such that both `I` and `J` are two-sided ideals
or `I` and `J` are a left and a right ideal, respectively, return the product of `I` and `J`.
# Examples
```jldoctest
julia> D, (x, y, dx, dy) = weyl_algebra(GF(3), ["x", "y"]);
julia> I = left_ideal(D, [x^3+y^3, x*y^2])
left_ideal(x^3 + y^3, x*y^2)
julia> J = right_ideal(D, [dx^3, dy^5])
right_ideal(dx^3, dy^5)
julia> I*J
two_sided_ideal(x^3*dx^3 + y^3*dx^3, x^3*dy^5 + y^3*dy^5, x*y^2*dx^3, x*y^2*dy^5)
```
"""
function Base.:*(a::PBWAlgIdeal{Da, T, S}, b::PBWAlgIdeal{Db, T, S}) where {Da, Db, T, S}
@assert base_ring(a) == base_ring(b)
is_left(a) && is_right(b) || throw(NotImplementedError(:*, a, b))
# Singular.jl's cartesian product is correct for left*right
return PBWAlgIdeal{0, T, S}(base_ring(a), _as_left_ideal(a)*_as_right_ideal(b))
end

@doc Markdown.doc"""
^(I::PBWAlgIdeal{D, T, S}, k::Int) where {D, T, S}
Given a two_sided ideal `I`, return the `k`-th power of `I`.
# Examples
```jldoctest
julia> D, (x, dx) = weyl_algebra(GF(3), ["x"]);
julia> I = two_sided_ideal(D, [x^3])
two_sided_ideal(x^3)
julia> I^2
two_sided_ideal(x^6)
```
"""
function Base.:^(a::PBWAlgIdeal{D, T, S}, b::Int) where {D, T, S}
@assert b >= 0
b == 0 && return PBWAlgIdeal{D, T, S}(base_ring(a), [one(base_ring(a))])
Expand Down

0 comments on commit f3a3d8c

Please sign in to comment.