how to restore latex_name
I wonder how to restore the latex_name attribute of a function or variable after saving to a file
my (updated) code is:
var('y')
fx = function('fx',latex_name=r'f_x')
eq=fx(y)+fx(y).diff(y)
save([y,fx,eq],'test')
check the latex expression:
> print(latex(eq))
f_x\left(y\right) + \frac{\partial}{\partial y}f_x\left(y\right)
In a new session I load the definitions and print the latex forms:
y,fx,eq=load('test')
print(latex(fx))
print(latex(eq))
with output
f_x
{\rm fx}\left(y\right) + \frac{\partial}{\partial y}{\rm fx}\left(y\right)
curiously the latex form of the function 'f_x' is preserved but it is not used in the symbolic expression 'eq', where only 'fx' appears.
So I thought I do the following: I define a new function and substitute the new function in eq
ffx = function('ffx',latex_name=r'f_x')
print( latex( eq.substitute_function(fx,ffx) ) )
but I still get fx in the output, it seems fx in eq is not the function fx , I cannot even substitute it against another function!