quiz9.mws

Quiz 9 MCS 320 Friday 28 October 2005

1. Plot the curve defined by (x^2 + y^2)^2 - 2*(x^2 - y^2) = 0, for x and y both in [-2,2].

   Create a better plot by converting to polar coordinates.  

   Give the polar representation of this curve and all relevant Maple commands.

> p := (x^2 + y^2)^2 - 2*(x^2-y^2);

p := (x^2+y^2)^2-2*x^2+2*y^2

> plots[implicitplot](p,x=-2..2,y=-2..2);

[Plot]

> pp := subs(x=r*cos(t),y=r*sin(t),p);

pp := (r^2*cos(t)^2+r^2*sin(t)^2)^2-2*r^2*cos(t)^2+2*r^2*sin(t)^2

> sr := solve(pp,r);

sr := 0, 0, (2-4*sin(t)^2)^(1/2), -(2-4*sin(t)^2)^(1/2)

> plots[polarplot](sr[3],t=0..2*Pi);

[Plot]

> restart;

2. Consider the polynomial system defined by f = x^3 - 3*x*y^2 + 1 =0 and g = x^2 + y - 1 = 0.

   Use the method of Groebner bases to determine how many real solutions this system has.

   Give all relevant commands to create a list of coordinates of the real solutions.

> s := {x^3 - 3*x*y^2 + 1,x^2 + y - 1};

s := {x^3-3*x*y^2+1, x^2+y-1}

> gb1 := grobner[gbasis](s,[x,y],plex);

Warning, grobner[gbasis] is deprecated. Please, use Groebner[Basis].

gb1 := [3*y^3-2*y^2-2*y+x+1, 9*y^5-3*y^4-11*y^3+3*y^2+3*y]

We follow the warning of Maple and use the new Groebner[Basis]:

> gb2 := Groebner[Basis]([op(s)], plex(x, y)); 1

gb2 := [9*y^5-3*y^4-11*y^3+3*y^2+3*y, 3*y^3-2*y^2-2*y+x+1]

Notice the difference in the order of the polynomials between gb1 and gb2.  With gb1, we start with gb1[2].

> ys := [fsolve(gb2[1],y)];

ys := [-.9414822102, -.4583649315, 0.]

> eqs := seq(subs(y=ys[j],gb2[2]),j=1..nops(ys));

eqs := -1.393370808+x, 1.207627812+x, 1.+x

> xs := map(eq -> fsolve(eq,x),[eqs]);

xs := [1.393370808, -1.207627812, -1.]

> real_sols := zip((x,y) -> [x,y],xs,ys);

real_sols := [[1.393370808, -.9414822102], [-1.207627812, -.4583649315], [-1., 0.]]

> %?