2023-02-24 13:11:52 +0200 | received badge | ● Nice Question
(source)
|
2022-07-23 00:59:19 +0200 | received badge | ● Notable Question
(source)
|
2022-07-23 00:59:19 +0200 | received badge | ● Popular Question
(source)
|
2020-03-23 13:06:05 +0200 | received badge | ● Editor
(source)
|
2020-03-23 13:05:08 +0200 | received badge | ● Supporter
(source)
|
2020-03-23 13:05:06 +0200 | commented answer | discriminant of multivariate polynomial Thanks so much! Of course, I didn't attempt to multiply the whle string by 1.0, that was a typo in my question, which I'll correct now.
Just wondering, what's wrong with the field RR for this purpose? Is it that the variables x,z,I are not included automatically? |
2020-03-21 09:50:29 +0200 | asked a question | discriminant of multivariate polynomial If I do R.<x,z,I>=QQ[]
f_str = 'x**3 + x*z +1'
f = eval(f_str)
f.discriminant(x)
this works out correctly, giving -4*z^3 - 27
But if I instead replace the coefficient of any monomial with a rational, such as R.<x,z,I>=QQ[]
f_str = '1.0*x**3 + x*z +1'
f = eval(f_str)
f.discriminant(x)
I get the following error: AttributeError: 'MPolynomial_polydict' object has no attribute 'discriminant'
Can someone explain how to make it work? |
2019-05-22 21:25:18 +0200 | received badge | ● Famous Question
(source)
|
2018-03-02 18:19:33 +0200 | received badge | ● Notable Question
(source)
|
2018-03-02 18:19:33 +0200 | received badge | ● Popular Question
(source)
|
2015-12-23 02:16:29 +0200 | commented answer | Discriminant of multivariate polynomials with complex coefficients Indeed, it is. It seems that CC(0,1) = 1.000000 I, still employs 'I'.
So why is it so much faster? I guess previously sage was trying to solve exactly, since coefficients were integers, while now the rational coefficient triggers approximate solution?
Thanks again! |
2015-12-22 23:58:28 +0200 | commented answer | Discriminant of multivariate polynomials with complex coefficients On further inspection, while this definitely works, it seems that sticking to 'I' does have some drawback apparently.
For instance, computing the discriminant of a slightly more complicated polynomial like -108*x**27*z**26 - 540*I*x**15*z**15 + 540*I*x**15*z**13 - x**3*z**4 + 2*x**3*z**2 - x**3
is much slower than computing the same discriminant with -108*x**27*z**26 - 540*1j*x**15*z**15 + 540*1j*x**15*z**13 - x**3*z**4 + 2*x**3*z**2 - x**3
So it seems that I should really find a way of converting I to 1j, in the end. Any trick for this? |
2015-12-22 23:35:20 +0200 | commented answer | Discriminant of multivariate polynomials with complex coefficients Thanks! Especially for explaining what is the issue with 'I'.
Also nice simple solution |
2015-12-22 20:31:47 +0200 | asked a question | Discriminant of multivariate polynomials with complex coefficients I would like to compute the discriminant of some polynomial in two variables, x and z, the discriminant should be computed with respect to x.
I am able to do so in certain cases, but not when the coefficients are complex numbers written in a certain way.
For example, this works: R.<z> = QQ[]
S.<x> = R[]
p = x**2 - z**2
p.discriminant()
gives: 4*z^2
But when I try to use a complex coefficient, discriminant fails because the expression is regarded as a symbolic expression, instead of a polynomial q = x**2 - z**2 * I
q.discriminant()
AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'discriminant'
Curiously, if I use instead q = x**2 - z**2 * 1j
q.discriminant()
this gives the correct answer.
Now for particular reasons I really need to deal with 'I' as the complex unit, and cannot use 'j'. What's wrong with 'I'? |
2015-12-09 23:19:26 +0200 | commented answer | Multiplicities of solutions not showing up correctly |
2015-12-09 23:19:26 +0200 | commented answer | Multiplicities of solutions not showing up correctly |
2015-12-09 23:11:53 +0200 | received badge | ● Scholar
(source)
|
2015-12-09 19:45:26 +0200 | received badge | ● Student
(source)
|
2015-12-09 03:10:01 +0200 | asked a question | Multiplicities of solutions not showing up correctly I am trying to find the roots of the following f = -54.0*I*x**27 + (-202.5 - 584.567147554496*I)*x**15 + (1.62379763209582 + 2.0625*I)*x**3
using the command sols, mults = solve(f ,x, multiplicities=True)
but the answer I get is wrong, because there should be 27 roots, of which x=0.0 should have multiplicity 3 and all the other should have multiplicity 1. This is what I get instead: ([x == 1/4*2^(3/4)*(sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) + I*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == 1/4*2^(3/4)*(I*sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) + (-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == 1/2*I*2^(3/4)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12), x == 1/4*2^(3/4)*(I*sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) - (-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == -1/4*2^(3/4)*(sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) - I*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == -1/2*2^(3/4)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12), x == -1/4*2^(3/4)*(sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) + I*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == 1/4*2^(3/4)*(-I*sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) - (-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == -1/2*I*2^(3/4)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12), x == 1/4*2^(3/4)*(-I*sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) + (-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == 1/4*2^(3/4)*(sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) - I*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == 1/2*2^(3/4)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12), x == 1/4*2^(3/4)*(sqrt(3)*(1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) + I*(1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == 1/4*2^(3/4)*(I*sqrt(3)*(1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) + (1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I ... (more) |