On May 28, 9:00 am, Nils Bruin <[email protected]> wrote:
> I have not been able to get the following behaviour out of maxima
> directly, but the following code illustrates that maxima's solve
> forgets about some solutions:
>
> def realzeros(f,g):
> t = polygen(QQbar)
> P = parent(f)
> R = f.resultant(g,P.0)
> yvals = [yval[0] for yval in R(0,t).roots() if yval[0] in RR]
> result = []
> for yval in yvals:
> xpol = GCD(f(t,yval),g(t,yval))
> result += [(xval[0],yval) for xval in xpol.roots() if xval[0]
> in RR]
> return result
> var("x,y")
> f=(x^2-y^2+y^4)*(x^2+y^2-1)
> g=diff(f,x)+2*diff(f,y)
> temp=solve([f,g],x,y)
> S1 = [ (RR(p[0]),RR(p[1])) for p in [(x.subs(s[0]),y.subs(s[1])) for s
> in temp] if p[0] in RR and p[1] in RR]
> S2 = realzeros(f.polynomial(QQ),g.polynomial(QQ))
> implicit_plot(g,(x,-2,2),(y,-2,2))+implicit_plot(f,(x,-2,2),(y,-2,2))
> +points(S1,color="red",pointsize=40)+points(S2,color="blue",pointsize=20)
>
> This code produces a picture that clearly shows that maxima's solve
> misses some of the intersection points that a straightforward
> resultant-and-roots-of-univariate-polynomials does find.
>
> Perhaps someone more expert in using maxima can get this problem to
> happen directly in maxima so that it can be reported upstream?
I'm too lazy to see what roots you actually want :) but here is the
appropriate Maxima session:
(%i15) f:(x^2-y^2+y^4)*(x^2+y^2-1);
2 2 4 2 2
(%o15) (y + x - 1) (y - y + x )
(%i16) g:diff(f,x)+2*diff(f,y);
4 2 2 2 2 3
4 2 2
(%o16) 2 (2 y (y - y + x ) + (y + x - 1) (4 y - 2 y)) + 2 x (y -
y + x )
2 2
+ 2 x (y
+ x - 1)
(%i17) solve([f,g],[x,y]);
2 1 2 1
(%o17) [[x = - -------, y = -------], [x = -------, y = - -------],
sqrt(5) sqrt(5) sqrt(5) sqrt(5)
[x = 0, y = - 1], [x = 0, y = 1], [x =
0, y = 0]]
So it gets five intersection points, including three on the x-axis and
two other conjugate ones on the unit circle. Which ones is it
missing? (to_poly_solve gets the same roots, by the way, in the Sage
Maxima.)
- kcrisman
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org