ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 16 Nov 2014 05:35:12 -0600Plotting parametric matrix discriminantshttps://ask.sagemath.org/question/24881/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?mamuteekSun, 16 Nov 2014 05:35:12 -0600https://ask.sagemath.org/question/24881/pariError when computing discriminanthttps://ask.sagemath.org/question/9233/parierror-when-computing-discriminant/Consider the following piece of code:
Qx.<x> = PolynomialRing(Rationals())
K = NumberField(x^2+1, 'a')
OOK = K.ring_of_integers() #K.maximal_order() has same effect
OOa = OOK.extension(x^3+2, 'alpha'); OOa
This returns "`Univariate Quotient Polynomial Ring in alpha over Maximal Order in Number Field in a with defining polynomial x^2 + 1 with modulus alpha^3 + 2`". Why is this the case? I would have expected it to have the same effect as
Qx.<x> = PolynomialRing(Rationals())
00b = ZZ.extension([x^3+2,x^2+1], 'beta,b'); OOb
Namely, that it returns `"Relative Order in Number Field in beta with defining polynomial x^3 + 2 over its base field`".
Moreover, and perhaps more interestingly, when one tries to run the command `OOa.discriminant()` after the first piece of code, "`PariError: (5)`" is returned. Running the analogous command, `OOb.absolute_discriminant()` after the second piece of code, one gets -746496. I presume the fact that these two commands return different results is explained in [Quotients of Univariate Polynomial Rings](http://www.sagemath.org/doc/reference/sage/rings/polynomial/polynomial_quotient_ring.html "Quotients of Univariate Polynomial Rings") when it says
> The discriminant of the quotient polynomial ring need not equal the discriminant of the corresponding number field, since the discriminant of a number field is by definition the discriminant of the ring of integers of the number field.
even though we are not computing the discriminant of a number field in the second piece of code. However, why is a pariError returned when trying to compute the discriminant of `OOa`? Surely this must be somehow linked to the fact that the two blocks of code return completely different things. Is this indeed the case? Any help would be appreciated.
Leonhard MoosbruggerTue, 14 Aug 2012 02:58:15 -0500https://ask.sagemath.org/question/9233/