Dear Simon, Richard, Nils and Maarten,
Thanks for putting so much thought into it. Unfortunately, most of what
you are discussing is way beyond my horizon, so I can't really
contribute. I had no clue how many things need to be considered before
implementing my request.
I just wanted to confirm that Simon summarised my request very
accurately in the below text.
Here is an example of a typical worksheet:
var('T_a') # Air temperature (K)
var('T_l') # Leaf temperature (K)
var('R_ll') # Longwave radiation away from leaf per unit projected
leaf area (W m-2)
var('sigm') # Stefan-Boltzmann constant (5.67e-8 Wm-2 K-4)
...
Then, I define equations such as
eq_Rll_g = R_ll == 2*sigm*T_l^4
...
Then I forget what equations I defined, so I type:
eq_Rll+<tab> to find all the different formulations for R_ll. I pick
one, display it, and don't remember what the variables are or their
units. So, currently, I have to scroll all the way to the top of the
worksheet to find out. For long equations, I need to scroll back and
forth many times before I understand the equation again. After solving
a system of such equations I need to know the units and variable
definitions to understand the results, so here comes the scrolling
again. Of course, I could print out the variable definitions and look
there...
Ideally, I would like to do something like
var('T_a'); T_a.set_custom_doc('Air temperature (K)')
and then type
T_a?
to see the definition. Or, similarly,
eq_Rll_g.set_custom_doc('Gross long wave emission from leaf').
Anyway, the added convenience by this functionality probably does not
outweigh its implementation costs, so unless lots of other people call
for it, it's probably not worth it. I got some ideas how to do it for
myself using dictionaries and I could probably write a little function
to easily extract all the relevant variable descriptions of an equation
from the dictionary. I don't care about garbage and pollution of my
worksheets too much, so this should work.
Thanks heaps for your ideas!
Cheers
Stan
On 17/09/11 21:15, Simon King wrote:
Hi Richard,
On 17 Sep., 20:09, rjf<fate...@gmail.com> wrote:
Data need not be stored in random access memory. A disk file might be
quite adequate,
since documentation presumably is not needed in a hurry, nor is it
needed in huge
quantities.
I think the application Stan had in mind was indeed to add
documentation on the fly, interactively, and in large quantities.
If I understood him correctly, he wants to create a system with many
variables, and wants to store information about what each variable is
referring to *in that particular aplication*, what units are used, and
so on.
I am sure Stan is aware that he could create a dictionary, containing
information on each variable, indexed by either the variable itself or
by its name or by its address in memory. If it is indexed by name,
then of course such dictionary could easily be stored on disk.
However, he also asked whether he can store the data [citing Stan's
post] "so that I could then type the name of the variable further down
in the document followed by a question mark to see that information
again".
And that's where things start to become interesting. Can one use/
modify the existing stuff in sage.misc.sageinspect for that purpose?
If "yes": Is the additional comfort of not having to create one's own
dictionary and simply appending "?" to retrieve the information,
really worth the effort?
Humans have a limited ability to read documentation.
Here, the purpose is to support the human memory by a brief reminder
that, say, the variable t_max denotes the maximal temperature of a
solar flare, measured in Kelvin. The idea is to use the same
infrastructure that is also used for documentation, but it isn't
documentation as it is currently used in Sage.
Or if you insist on having different
documentation
for each element in an array.
Yes, if you understand "documentation" in the sense of "reminder what
a particular variable is referring to", then I think that's exactly
Stan's idea: Have different documentation for each variable.
There are perhaps alternatives (e.g. "weak hash tables") that would
work with GC,
Strings can't be used as weak keys. Is there a way to create a
dictionary such that data stored under a key K are garbage-collected
as soon as K is removed from globals().keys()?
Best regards,
Simon
--
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