Is there a preferred way of taking numerical approximation of a quantity in 
Sage with units of measure? Here is a contrived example:

r = 123/47 * units.length.meter
r
area = pi * r^2
area

output:

123/47*meter
15129/2209*pi*meter^2

Now imagine that r is not a literal but the result of other calculations 
involving units of measure, so you can't easily apply n() at the time of 
assignment to r. Is there a simple way to take n() of things without 
getting into the following?

# "n(r)"
n(r.coeffs()[0][0]^r.coeffs()[0][1])*r.args()[0]
==>
2.61702127659574*meter

# "n(area)"
(n(area.coeffs()[0][0])*(area.args()[0])^area.coeffs()[0][1])
==>
21.5161409036487*meter^2

###

-- 
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 http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to