Ask Your Question

mamuteek's profile - activity

2017-03-03 22:49:55 +0200 received badge  Popular Question (source)
2014-11-16 12:35:12 +0200 asked a question Plotting parametric matrix discriminants

Greetings, I am struggling with the problem concerting characteristic polynomial determinants. I'm intending to plot curves in the (a,b)-plane of parametric matrices, which signal the points of some eigenvalues being zero. To this end, I use the following code

var('a b')
A = matrix([[a+sqrt(-1)b,-1,0],[-1,0,-1],[0,-1,a-sqrt(-1)b]])
p=A.charpoly('t')
d=p.discriminant()
region_plot(d>=0, (a,-4,1), (b,-4,1),incol='gray',figsize=5,axes=true)

which however produces the error

File "handle_error.pyx", line 90, in sage.libs.pari.handle_error._pari_handle_exception (build/cythonized/sage/libs/pari/handle_error.c:1178) sage.libs.pari.gen.PariError: incorrect type in gtofp

Printing the discriminant explicitly and then plotting it works fine

var('a b') 
A = matrix([[a+sqrt(-1)*b,-1,0],[-1,0,-1],[0,-1,a-sqrt(-1)*b]]) 
p=A.charpoly('t') 
d=p.discriminant() 
d2=-4*b^2*a^4 + (-8*b^4 - 40*b^2 + 4)*a^2 + (-4*b^6 + 24*b^4 - 48*b^2 + 32) 
region_plot(d2>=0, (a,-2,2), (b,-2,2),incol='gray',figsize=5,axes=true)

although both quantities seem to be of the same type

<type 'sage.symbolic.expression.Expression'>

any ideas about what am I missing?

2014-11-16 11:30:43 +0200 received badge  Editor (source)
2014-11-16 11:29:45 +0200 asked a question Plotting parametric matrix discriminants

Hi, I intend to plot curves in the (a,b)-plane of parametric matrices, which signal the points of some eigenvalues being zero. To this end, I use the following code

sage: var('a b') sage: A = matrix([[a+sqrt(-1)b,-1,0],[-1,0,-1],[0,-1,a-sqrt(-1)b]]) sage: p=A.charpoly('t') sage :d=p.discriminant() sage :region_plot(d>=0, (a,-4,1), (b,-4,1),incol='gray',figsize=5,axes=true)

which however produces the error

File "handle_error.pyx", line 90, in sage.libs.pari.handle_error._pari_handle_exception (build/cythonized/sage/libs/pari/handle_error.c:1178) sage.libs.pari.gen.PariError: incorrect type in gtofp

to which I havent found sufficient answer/comment throughout the forum. Printing the discriminant explicitly and then plotting it works fine

var('a b') A = matrix([[a+sqrt(-1)*b,-1,0],[-1,0,-1],[0,-1,a-sqrt(-1)*b]]) p=A.charpoly('t') d=p.discriminant() d2=-4*b^2*a^4 + (-8*b^4 - 40*b^2 + 4)*a^2 + (-4*b^6 + 24*b^4 - 48*b^2 + 32) region_plot(d2>=0, (a,-2,2), (b,-2,2),incol='gray',figsize=5,axes=true)

although both quantities seem to be of the same type

<type 'sage.symbolic.expression.Expression'>

any ideas about what am I missing?