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 <nbr...@sfu.ca> wrote:

> 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 parents involved should do the trick:
>
> sage: QQ.is_exact()
> True
> sage: RR.is_exact()
> False
>
> 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. So you should walk the construction of a parent and see if there are
> any inexact constituents:
>
> sage: parent(A).construction()
> (MatrixFunctor, Real Field with 53 bits of precision)
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CANnG189YsBhjH%3DU1u9gYD4oYz%3DvBSOpVOkmaRRj5z3jU41gHrA%40mail.gmail.com.

Reply via email to