The short answer is: You can enable unicode art for the display of the output and name your variables by the full Greek name. Then you get nicely formatted output:
sage: %display unicode_art
sage: β = var('beta')
sage: β
β
sage: (β^3 + β) / 2
3
β β
── + ─
2 2
sage: latex(β)
\beta
The rendering is done using Sympy. This only changes the appearance of the output, though. Internally the symbol is still represented by beta
.
sage: str(β)
beta
sage: maxima(β)
_SAGE_VAR_beta
sage: _.sage()
β
The long answer: What you are asking for is technically possible and the framework for this mechanism already exists in Sage, but the unicode support has not been implemented yet. Usually the conversion to an interface is implemented by an underscore method. For example:
sage: x._maxima_()
_SAGE_VAR_x
(or related methods such as _maxima_init_
, _maxima_lib_
, _maxima_lib_init_
, but in this case they all refer to _maxima_
) and the conversion back to Sage is implemented in:
sage: x._maxima_()._sage_()
x
In this case, these two methods do not directly implement the conversion, but via a series of indirections they call
https://github.com/sagemath/sage/blob...
for the conversion to Maxima (and other interfaces) and
https://github.com/sagemath/sage/blob...
for the conversion from Maxima back to Sage.
These are the places where the conversion should be improved to handle unicode. A possible implementation might be based on e.g. 'β'.encode('unicode-escape')
to encode a unicode string as ASCII.
Short code block to illustrate the problem please.
Something we can copy and paste in a fresh Sage session.
Would save time for anyone interested in exploring.