Hi Eric,

I agree with Kwankyu and Simon:
- the global namespace is already bloated
- abbreviations should be avoided in most places in Sage

And having the namespace modified at the time an object is created is by
far the worst solution.

The following two alternatives would be fine

1) using member functions (methods): ie v.div() instead of div(v)

2) having a module containing all of your abbreviations so that
{{{
sage: from sage.manifolds.operators import *
}}}
would give access to these abbreviations in the namespace. You might want to import this module in the namespace as "manifolds" so that the user can do
{{{
sage: manifolds.div(v)
}}}
This is what was done to simplfy the global namespace with sage.codings.codes_catalog.

Vincent

On 04/03/2018 08:22, Simon King wrote:
Hi Eric,

On 2018-03-03, Eric Gourgoulhon <egourgoul...@gmail.com> wrote:
To cope with standard mathematical notations, these operators are
introduced as functions in the global namespace, which merely invoke the
corresponding method of their argument, e.g. if v is a vector field,

sage: div(v)

What's wrong with v.div(), to cope with standard notation in SageMath?

"div", as a notation for "divergence", could also easily be mistaken
with "division", "divisor", or also "dividend" (IIRC, there *is* some
mathematical finance in SageMath).

Also one should be aware that "standard mathematical notation" is
usually strongly dependent on context. Here is a little anecdote: In
some test, I gave my students the little problem "What is the definition
of the order of a group element?". Surprisingly many of them gave the
definition of an order relation. So, in the next homework, I asked them
to do a little research and find as many different mathematical notions
that are named "order". I think they found more than 10.

Conclusion: Functions in the global name space lack context, and are thus
often unsuited for mathematical notations.

And even if you absolutely want to put divergence into the global name
space (which already is too much bloated, IMHO), then I think it would
still be a bad idea to put an *abbreviated* function name into the global
name space ("div" instead of "divergence") just because in *some* branch
of mathematics that abbreviation is standard.

Is it OK to introduce five new names in the global namespace:
grad, div, curl, laplacian, dalembertian
and possibly a sixth one: rot as an alias of curl?

-1

An alternative (disapproved by the reviewer) is to inject these names in
the global namespace only if any pseudo-Riemannian manifold is constructed,

-1

Again, what is wrong with the Python standard notation v.div(), where v
is a vector field? Since v.div is a method of a vector field, it
automatically adds the context that were missing if div() was a global
function.

Best regards,
Simon


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

Reply via email to