Ask Your Question
0

An error using unicode?

asked 2020-05-12 05:42:33 -0500

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
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2020-05-12 08:22:40 -0500

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")
edit flag offensive delete link more

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: 2020-05-12 05:42:33 -0500

Seen: 46 times

Last updated: May 12