Such a feature might come in handy so solve a couple of cases where sage creates (or receives from its subsystems) a symbolic expression with "new" variables.
Two chronic offenders are Maxima's solver and differential equation solver(s), which routinely add new symbolic constants as required by their inputs. In these cases, getting the names of these new variables and properly declaring them for future use can become a pain in the ass. In these cases (and other possible automatic variable creation i do dot have in mind currently), such auto_declare behaviour should be the *default*. I am less sanguine about automatic declaration of symbolic variables in general. Having to explicitly declare my symbolic variables saved my sorry ass from more than a couple of typos (and thinkos, BTW...). However, most CASes now available do away without this mandatory declaration. One has also to consider the case (important in Sage) of the indeterminate(s) of a polynomial. Do we risk introducing an ambiguity if allowing automatic variable declaration ? In any case, *if* this feature is deemed useful, then +1 for including it in the Sage interpreter itself, and not as an appendix of one of its ibnterfaces. HTH, -- Emmanuel Charpentier Le mardi 13 mars 2018 18:32:11 UTC+1, Erik Bray a écrit : > > Paul Zimmerman pointed out to me that there's a feature of the legacy > Sage Notebook, automatic_names() [1], which turns on automatic > creation of symbolic variables and functions when they are not already > defined. For example, by default if you enter: > > sage: x + y + z > > you get: > > NameError: name 'y' is not defined > > ('y', in this case, because 'x' is pre-defined as a special case). > With automatic_names(True) it inserts a shim into the Sage syntax > pre-processor that automatically creates variables from names not > already found in globals(). > > I see no reason this feature needs to be confined to the legacy > Notebook, as opposed to being in Sage proper. Then that feature would > be usable at the command-line, as well as in the Jupyter Notebook. > > Thoughts? > > [1] > https://github.com/sagemath/sagenb/blob/e6910891f445e47690760966441328971d51a78d/sagenb/misc/support.py#L602 > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.