On Jun 15, 4:24 am, Maurizio <maurizio.gran...@gmail.com> wrote: > precisely, basic units (as meter, second, etc) are, by definition, > terminal unums (without references); derived units (as Newton, Joule, > etc) have a dictionary with, as keys, unums representing basic/derived > units, and, as values, their exponents; finally, any quantity may be > derived with the same idea.
Well, I think this is an example of an operation (and it's pretty important to the unit conversion stuff) that could be simplified quite a bit by exploiting Sage's capabilities instead of trying to bolt on an existing package. If you had a list of equations of derived units in terms of basic units, you could immediately compute a conversion factor for two derived units. So the question is how to get such a list. Unit conversions are conveniently expressed by equations like foo = bar^m * baz^n. Any such equation defines a derived unit; basic units or other derived units might appear on the right. To get conversions to base units, just solve all the equations for all the derived units. (It's convenient to take logarithms so the equations are linear.) Then you have every derived unit expressed in terms of basic units only. When new conversions are defined, just append the new equations and solve it again. Symbolic operations (representing equations, solving equations, log and exp, substitution or evaluation) make that construction very simple. The whole business with building a hash table or a graph or whatever is just a workaround for the lack of symbolic operations. best Robert Dodier --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---