On Sep 20, 12:36 am, Stan Schymanski <schym...@gmail.com> wrote:
> That's awesome, thanks a lot, William!
>
> Since this is done in the units package already, is there a way to
> formally save the units of e.g. T_a as units.temperature.Kelvin and then
> have something like:
> sage: T_a = 300
> sage: T_a
> 300 Kelvin
>
> Cheers
> Stan
>
> On 19/09/11 17:09, William Stein wrote:
> ...
>
>
>
>
>
>
>
>
>
> > You could put the above into a function:
>
> > def var2(name, doc):
> >      z = sage.symbolic.units.UnitExpression(SR, SR(name))
> >      z._sage_doc_ = lambda: str(doc)
> >      return z
>
> > Use it like this (make sure to assign to T_a):
>
> > sage: T_a = var2('T_a', 'Air Temperature (K)')
>
> > sage: T_a?
> > Air Temperature (K)
>
> > William

-- 
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

Reply via email to