On 17 Giu, 09:24, Robert Bradshaw <rober...@math.washington.edu> wrote: > Thanks for the wiki and summary. In my (brief) perusal of the > options, Unum sounds like the best fit to me too. >
I am glad I can give something to this community, I hope this has been valuable to somebody. > On Jun 15, 2009, at 3:27 AM, William Stein wrote: > > > There is also the fact that Sage has rings, elements, parents, a > > coercion model, etc. which might throw a monkey wrench into everything > > (I don't know). > > I'm hoping it's able to store the "numeric" part as a black box, and > just multiplies it by constants to convert. Of course, I'm not sure > if everything would quickly be reduced to 53-bit floating point > results precision... > Thank you for investigating this!! > sage: var('x,y') > (x, y) > sage: (x * unum.units.MILE) / (y * unum.units.S) > x/y [mile/s] > sage: (x+90) * unum.units.MIN + (x+pi) * unum.units.H > pi + 1.01666666666667*x + 1.50000000000000 [h] > > sage: R.<t> = QQ[[]] > sage: foo = (1/(t+1)) * unum.units.KG; foo > 1.0 - 1.0*t + 1.0*t^2 - 1.0*t^3 + 1.0*t^4 - 1.0*t^5 + 1.0*t^6 - > 1.0*t^7 + 1.0*t^8 - 1.0*t^9 + 1.0*t^10 - 1.0*t^11 + 1.0*t^12 - > 1.0*t^13 + 1.0*t^14 - 1.0*t^15 + 1.0*t^16 - 1.0*t^17 + 1.0*t^18 - > 1.0*t^19 + O(t^20) [kg] > sage: getattr(foo, 'as')(unum.units.TON) > 0.001 - 0.001*t + 0.001*t^2 - 0.001*t^3 + 0.001*t^4 - 0.001*t^5 + > 0.001*t^6 - 0.001*t^7 + 0.001*t^8 - 0.001*t^9 + 0.001*t^10 - > 0.001*t^11 + 0.001*t^12 - 0.001*t^13 + 0.001*t^14 - 0.001*t^15 + > 0.001*t^16 - 0.001*t^17 + 0.001*t^18 - 0.001*t^19 + O(t^20) [t] > > Not bad. > > - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---