This works:
sage: *for* i *in* [ZZ,QQ,RR]:
: print('empty string in',i,':','' *in* i)
:
empty string in Integer Ring : False
empty string in Rational Field : False
empty string in Real Field with 53 bits of precision : False
This gives an error:
sage: '' *in* CC
[…]
^
S
Related to a recent discussion, is there a (simple) way to find whether an
expression contains non exact explicit numbers?
For example:
M1=matrix(1,2,[1,x+2])
M2=matrix(1,2,[1,x+2.])
mytest(M1)
→ True
mytest(M2)
→ False
Guillermo
--
You received this message because you are subscribed to the G
On Wednesday, 3 May 2023 at 08:11:25 UTC-7 G. M.-S. wrote:
This gives an error:
sage: '' *in* CC
[…]
^
SyntaxError: invalid syntax
It looks like this error comes from the fact that "eval('')" raises this.
Apparently an empty string is not valid python for the parser. It is a
lit
On Wednesday, 3 May 2023 at 08:21:39 UTC-7 G. M.-S. wrote:
Related to a recent discussion, is there a (simple) way to find whether an
expression contains non exact explicit numbers?
For symbolic expression you should probably walk the entire expression tree.
For sage objects, examining the par
Thanks Nils.
This is now
https://github.com/sagemath/sage/issues/35607
Guillermo
On Wed, 3 May 2023 at 17:51, Nils Bruin wrote:
> On Wednesday, 3 May 2023 at 08:11:25 UTC-7 G. M.-S. wrote:
>
>
> This gives an error:
>
> sage: '' *in* CC
>
> […]
>
>
>
> ^
>
> SyntaxError: invalid syntax
>
>
Thanks Nils.
I shall try to manage with the information you have given me.
(In case you are curious, this is for code aimed at my students.)
Guillermo
On Wed, 3 May 2023 at 17:58, Nils Bruin wrote:
> On Wednesday, 3 May 2023 at 08:21:39 UTC-7 G. M.-S. wrote:
>
>
> Related to a recent discussi
On Wednesday, 3 May 2023 at 08:58:35 UTC-7 Nils Bruin wrote:
However, be careful:
sage: A=matrix(RR,2,2,[1,2,3,4])
sage: parent(A).is_exact()
True
because matrix rings presently aren't aware of inexactness of their base
rings.
This is something that is considered a bug; see
https://github