Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using accented letters in interact selectors

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)