ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 21 Jul 2014 10:12:46 +0200Create an infinite set with list comprehensionhttps://ask.sagemath.org/question/23510/create-an-infinite-set-with-list-comprehension/ Hello.
In Sage is possible to create B = Set(Primes()). For B Sage says Set of all prime numbers: 2, 3, 5, 7, ... . So B is infinite.
I try to create now a set C = Set([x^2 for x in QQ]). I am expecting to get something similar like above, but Sage does not get so far. After some 20 Minutes of waiting I broke down the action.
Is possible to create an infinite Set with list comprehension? I know that lists should befinite but the notation used by list
comprehension is very near on the mathematical way to describe a set like D = Set([x^2 for x in range(10)]) for example.
Any help appreciated.
Thank you and regards,
VasileVasileMon, 21 Jul 2014 10:12:46 +0200https://ask.sagemath.org/question/23510/How th work with enumerable and infinite sethttps://ask.sagemath.org/question/23467/how-th-work-with-enumerable-and-infinite-set/ Hello,
I am trying to do following: construct the set B that is the difference between QQ and the set of the prime numbers
(note that B is a countable set). Within Sage, I tried the following
X = Set(QQ)
Y = Set(Primes())
B = Set(X.difference(Y))
B.cardinality()
then I press evaluate. I am expecting that the cardinality of B is +Infinity. But Sage does not bring any result.
I tried this also initializing B like
B = InfiniteEnumeratedSets(RR).
Could anybody please give me a hint what I am doing wrong?
Thank you very much and regards.
vbk
VasileFri, 18 Jul 2014 15:51:01 +0200https://ask.sagemath.org/question/23467/