On Tuesday, July 25, 2017 at 5:53:37 AM UTC-7, springfield .gion wrote:
>
> Hi, I need to create and manipulate the additive semigroups generated by 
> integers (such as those generated by tuples of coprime integers), but I am 
> struggling with the syntax; is there an easy way to create something along 
> the line of:
>
> S = ZZ.Semigroup([2,3])   
> S = {0,2,3,4,....}
>
> Thanks in advance
>

You can try this:

    S = NN.subsemigroup([2,3])   # or ZZ.subsemigroup([2,3])

although (a) it is not clear to me that this the right thing (it looks like 
the multiplicative subsemigroup, not the additive one) and (b) I can't do 
anything sensible with it.

So I tried to use multiplicative semigroups instead. If A is the 
multiplicative semigroup consisting of powers of 2, then we could ask for 
the multiplicative subsemigroup generated by 2**2 and 2**3, which should be 
analogous to what you want. Unfortunately, it is broken:

    sage: A = NN.subsemigroup([2])
    sage: S = A.subsemigroup([2**2, 2**3])

Listing some elements and their base 2 logs is promising:

    sage: list(S.some_elements())  # output omitted since it is a little 
lengthy
    sage: [log_b(ZZ(_),2) for _ in list(S.some_elements())]   # output 
omitted

but this is surprising:

    sage: S.cardinality()
    11441

I certainly didn't know that this semigroup was finite, let alone precisely 
what its cardinality is.

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to