I don't really see this as a bug. Units are treated as variables, so it makes sense. Are you suggesting that 0 * kelvin should be left unevaluated, and then not give an error when it is the denominator?
On Aug 2, 7:49 am, Stan Schymanski <schym...@gmail.com> wrote: > Dear all, > > This is a bug-report or feature request for the units package, taken > from sage-support. Basically, the units package does not handle > addition and subtraction in a sensible way, as units cancel out when > variables with the same units are subtracted from each other. Sage > should give an error message when adding or subtracting variables with > different units, while leaving the units intact if the variables have > the same units. Does anyone have an idea how this could be > accomplished? Thanks already! > > Below is an example of the problem posted > athttp://groups.google.com/group/sage-support/browse_thread/thread/a60c... > > sage: udict = {} > sage: udict[H_l] = units.energy.calorie/units.length.centimeter^2/ > units.time.minute > sage: udict[T_a] = units.temperature.kelvin > sage: udict[T_l] = units.temperature.kelvin > sage: soln = solve(H_l == h_c*(T_a - T_l), h_c)[0]; soln > h_c == H_l/(T_a - T_l) > sage: soln.subs(udict) > Traceback (most recent call last): > ... > RuntimeError: power::eval(): division by zero > > --- > This works: > sage: (H_l/T_a).subs(udict) > calorie/(centimeter^2*kelvin*minute) -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org