Ask Your Question
0

An error using unicode?

asked 5 years ago

Cyrille gravatar image

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
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 5 years ago

tmonteil gravatar image

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")
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 5 years ago

Seen: 245 times

Last updated: May 12 '20