Ask Your Question
1

Using accented letters in interact selectors

asked 2018-03-26 12:53:47 -0500

Boston gravatar image

I would like to use accented letters when displaying the options of my input under the selector method. To be more precise, 'I'd like to have ellipsoïde and à deux nappes, for instance. Thanks.

Here is the interact. And here is the code:

var('x,y,z')
quadrics = {'Ellipsoide':x^2+y^2+z^2-1,'Paraboloide elliptique':x^2+y^2-z,'Paraboloide hyperbolique':x^2-y^2-z, 'Hyperboloide une nappe':x^2+y^2-z^2-1,'Hyperboloide deux nappes':x^2-y^2-z^2-1, 'Cone':x^2+y^2-z^2}
@interact
def quads(q = selector(quadrics.keys(), label='Quadrique'), a = input_box(default=1, label="$a$"), b = input_box(default=1, label="$b$"), c = input_box(default=1, label="$c$"), r = input_box(default=3, label="$r$")):
f = quadrics[q].subs({x:x/a}, {y:y/b}, {z:z/c})
if a*b*c==0 or q=='Cone':
    pretty_print(latex(f)+'=0 '+'(dégénérée)')
else:
    pretty_print(latex(f)+'=0')
p = implicit_plot3d(f,(x,-r,r),(y,-r,r),(z,-r,r), plot_points = 75, mesh=1, opacity=.7)
show(p)
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2018-03-26 13:54:25 -0500

eric_g gravatar image

A solution is to prefix all strings with u (for "unicode"), i.e. write u'Ellipsoïde'. As you can see here, this works.

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: 2018-03-26 12:53:47 -0500

Seen: 29 times

Last updated: Mar 26