ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 20 May 2012 10:52:06 -0500decimal form of a unit converted answerhttps://ask.sagemath.org/question/8987/decimal-form-of-a-unit-converted-answer/I was wondering what a good way might be to get a decimal answer when using units. For example, say I try
#define units
ft = units.length.foot
m = units.length.meter
#add some lengths and output in ft
(3*ft + 4*m).convert(units.length.ft)
I get back
6143/381*foot
Now, suppose I'd rather see this represented as a decimal than a fraction (for homework, perhaps?). If I try
(3*ft + 4*m).convert(units.length.foot).n()
I get an error. This is occuring on Sage 4.8 for sure, and I'm pretty sure in Sage 5.0 as well.
Can anyone think of a good solution to this?
Arrgh_JaySun, 20 May 2012 10:52:06 -0500https://ask.sagemath.org/question/8987/