Pb with unicode character
The following code works perfectly
var("w0, pi, D, I")
A = matrix(SR, 2, 2, [[w0, 1],[w0-pi,1]])
y = vector([w0-D, w0-D-pi+I])
sol=A.solve_right(y)
sola=sol[0].full_simplify().function(D, pi, I, w0)
solb=sol[1].full_simplify().function(D, pi, I, w0)
f(x, D, pi, I, w0)=sola*x + solb
show("f(x, D, pi, I, w0)=", f(x, D, pi, I, w0))
But if I use \pi <tab> in replacement of pi, there is a Macsyma error
Hello, @Cyrille! Unfortunately, I don't have a complete solution for this problem, so I am writing just a comment.
The problem seems to be in the
full_simplify()
command. Reading the code of this command, I can see that, eventually, it has to convert the Sage code to Maxima code, and, unfortunately, Maxima doesn't handle Unicode characters, like Greek letters. You can try this in order to reproduce the error:If all you want is to have the output written in LaTeX code, you can use the command
pi = var("pi", latex_name=r"\pi")
. Notice the letterr
before the double-quote signs in thelatex_name
argument? That is in order to tell Sage to avoid executing the backslash, which is a escape-character for Python. That is called a raw string (thus ther
)This is the modified code:
This is the result:
$$\newcommand{\Bold}[1]{\mathbf{#1}}f(x, D, {\pi} , I, w0)= -\frac{{\left(I - {\pi}\right)} x}{{\pi}} - \frac{D {\pi} - I w_{0}}{{\pi}}$$
In any case, using the
latex_name
argument should produce better results than using Unicode characters, since these are written with LaTeX's\verb
, which is intended for verbatim text, and disrupts the math-mode.