On Jul 20, 2:58 am, "William Stein" <[EMAIL PROTECTED]> wrote: > ... for Sage unit conversion we would surely want > something that works well in the context of sage itself, e.g., the coercion > model, symbolic calculus, etc.
I spent some time a couple of months ago thinking about how units could work in Sage, but I didn't get something I was happy with. My goal was to get something that used the coercion model. I decided there should be a parent for every combination of unit and base ring, so if foo were "5 feet" you might see sage: foo.parent() Dimension feet over Integer Ring sage: foo 5 feet Then there would be coercions between different units of length, etc.; (and there would also be a conversion to strip off the units): sage: a 3 in sage: b 254 mm sage: a+b 13 in sage: ZZ(a) 3 sage: ZZ(b) 254 One problem is that polynomials assume that the variable is dimensionless. For instance, it would be nice to have something like this work: sage: a 9.8 m/s^2 sage: v 35 m/s sage: t = polygen(...) sage: 1/2 * a * t^2 + v*t but it can't, because all the coefficients of a polynomial must have the same parent, but a is an acceleration and v is a velocity. > (a) research exactly what Maple, Mathematica, and Matlab do I would suggest also looking at Emacs calc, a scientific calculator written in Emacs Lisp with arbitrary-precision arithmetic, symbolic integration, and all sorts of other cool features. That's what I use for all my unit-conversion needs. Carl --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---