Hi Golam, +1 for this enhancement! I look forward to using it and I wouldn't mind helping if needed. Could you let me know how you got it to work? In combination with the show() command? I can't answer your question below, but here is what I used to do for variables that I wanted to print nicely in latex:
var('sui') sui._latex_ = lambda: 's_{u,i}' show(sui) However, if I then defined sui as a function of another variable, the above didn't work any more: var('t') suit = function('sui',t) show(suit) show(sui) In your example, something similar seems to happen. If you just define a variable psi, it will plot nicely in latex: var('psi') show(psi) But as soon as you define psi(x), this breaks down. This is carries over to the integral expressions as well as differentials. Thus, I think that the problem is not in the definition of the latex reprentations of integral and diff, but in what happens when you define psi(x) = function('psi',x). In my view, this is where the trouble starts. Cheers, Stan Golam Mortuza Hossain wrote: > Hi all, > > I am trying to enhance the support for latex-formatting > of "SymbolicFunctionEvaluation" in Sage. In particular, > when their names match with Greek letters then Sage > should use formatting similar to the formatting of > "SymbolicVariable". > > In Physics, we often use "psi(x)" to denote a wave-function > like > --- > psi(x) = function('psi',x) > --- > > It will make Sage output more intuitive if they are > formatted as Greek letters. > > I have already got it working after adding only few lines > of codes. However, I am facing couple of issues: > > (1) While formatting integral expression, such as > > integrate(phi(x)*psi(x),x) > > Sage seems to bypass the _latex_ representation for > the class "SymbolicFunctionEvaluation" (of phi(x), psi(x)). > > Can anyone give me some hints: where are the latex > representations for "integrate", "diff", .... are defined? > I mean in which file? > > (2) In the list "common_varnames" (in sage/misc/latex.py) two > letters "Phi" and "phi" are missing. So LaTex formatting > for them doesn't work like other Greek letters (even when they > are defined as "SymbolicVariable"). > > > Thanks, > Golam > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---