Solutions to Matlab exercises 1, 2, 3

Last update:  October 14, 2008

Exercise 1

In this exercise, we define  C  to be the plane curve
       y2 = x2 - x4,
  1. Is the origin a point of  C?     Ans:   Yes. To check this, substitute  (x,y) = (0,0)  into the equation of  C.
  2. Use the Matlab script aPlot to plot  C  in the region  -1.2 < x < 1.2,    -1 < y < 1, in each of the following ways:
  3. Which of the plots are more accurate than the others? What features could be contributing to this situation?
       Ans:   Most parts of the plot with the 100 by 100 grid are somewhat smoother than the corresponding parts of the plot with the 51 by 51 grid, because of the improved resolution. On the other hand, the plot with the 100 by 100 grid misses the origin  (0,0)  ¡because of the even number of grid points!
      A plot with a 500 by 500 grid would be still smoother. It also would miss the origin, but this phenomenon would be shown at an extremely small scale. Accordingly, you might not see it without zooming in on the origin.

Exercise 2

  1. Use the Matlab script aPlot to plot the plane curve

           y2 = x4 + y4,
    in the region  -1 < x < 1,    -1.2 < y < 1.2, in each of the following ways:
  2. Answer the same questions as in Part c of Exercise 1.
       Ans:   While the 51 by 51 grid gives a plot that looks somewhat "shaky", it is at least accurate enough to include the origin. The 501 by 501 grid gives a smoother plot and also includes the origin. While the 1000 by 1000 grid gives a very smooth plot, it not only misses the origin, but also omits very visible piece of the curve near the origin.
  3. (Challenge question) Can you identify what feature makes this curve "worse" than the curve of Exercise 1?
       Ans:   Despite the higher resolution than in the 100 by 100 grid in exercise 1, the present plot with the 1000 by 1000 grid actually seems to leave a larger gap. This seems to be related to the shape of the curve near near the origin. In exercise 1 the curve crosses itself at the origin, with an angle that is fairly close to a right angle. But in exercise 2, the portion of the curve near the origin looks like two parabolas that are pasted together. And thus, each point on the upper half of the curve is very close to a point on the lower half of the curve. {You could express this in a quantitative way by using the equation of the curve to express y as a power series in x.}

    Well, that's as much as I can explain clearly. We could give a more penetrating explanation if we knew what algorithm Matlab uses to connect "consecutive" points on the curve. Also, as one member of the class mentioned to me, round-off error also could be contributing.

Exercise 3
Consider the following family of plane cubic curves:

y2 = x3 - 3x + c

Plot  6  curves in this family, corresponding to the following parame ter values:

  1. c = 2
  2. c = -2
  3. A value of  c slightly above  c = 2
    and a value of  c slightly below  c = 2.
  4. A value of  c slightly above  c = -2
    and a value of  c slightly below  c = -2.
    Print a picture that includes all 6 curves, with distinct colors or patterns, and suitable labels.
    Alternatively if this is too cluttered, print 2 pictures, each including 3 curves.
    Comments:   In this first figure the curve that corresponds to  c = 2  crosses itself at the origin,
    while the curve that corresponds to  c = 1.5  is disconnected.
    Comments:   In this second figure, the curve that corresponds to  c = -1.5  still has two components,
    but at  c = -2   it has shrunk to a single point.
    Comment:   The point  (-1,0)   is far enough away from any other points of the curve so that Matlab can't connect it to a nearby point, and therefore has completely omitted it from the sketch. It's shown here because I inserted it separately.

Back to the class homepage.

Back to the homework solutions page.

Prof. Joel Roberts
School of Mathematics
University of Minnesota
Minneapolis, MN 55455
Office: 351 Vincent Hall
Phone: (612) 625-1076
Dept. FAX: (612) 626-2017