# An error using unicode?

Following the short answer of "Automatic substitution of unicode characters", the following code works nicely

%display unicode_art
π = var('pi')
solu=solve(π^2 - π==0, π)
solu


But if this code works nicely too

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)
%display unicode_art
sola=sol[0].full_simplify().function(D, pi, I, w0)
solb=sol[1].full_simplify().function(D, pi, I, w0)
f(x, D, π, I, w0)=sola*x + solb
f(x, D, π, I, w0)


The use of unicode on the preceding code generates an error

%display unicode_art
π = var('pi')
var("w0, π, D, I")
A = matrix(SR, 2, 2, [[w0, 1],[w0-π,1]])
y = vector([w0-D, w0-D-π+I])
sol=A.solve_right(y)
sola=sol[0].full_simplify().function(D, π, I, w0)
solb=sol[1].full_simplify().function(D, π, I, w0)
f(x, D, π, I, w0)=sola*x + solb

edit retag close merge delete

Sort by » oldest newest most voted

When you write var("w0, π, D, I") you overwrite the Python name π to point to te symbol SR.var('π') (that some libraries can not handle), while it should point to the symbol SR.var('pi').

Hence, to fix your issue, you have to replace

var("w0, π, D, I")


with

var("w0, D, I")

more

## Stats

Seen: 197 times

Last updated: May 12 '20