\bf Problem sets\hskip1in

Problem sets                    




Problem Set \#1: assigned Jan 18, due Tuesday, Jan 25

Problem Set #1: assigned Jan 18, due Tuesday, Jan 25

Although I generally try to find problems for which I can motivate the mathematics, here at the beginning of the course I need to ask you to look at an integral for its own sake. (This may also force you to dig your calculus book out early, so it is readily available for your use in the rest of the course.)



We are going to consider calculating the integral Tn = ò0g [(xn)/(x+b)]dx for values like g = 0.5 and 0 < b £ 6.
a)
Recall that an integral measures the area under the graph of its function. Sketch a rough graph with f(x) = xn/(x+b) for n = 2,4,8 (and, say, b = 3) and predict what happens to the value of the integral as n increases.
b)
Using your knowledge of calculus, determine the exact values of T0, T1, and T2. (Remember integration by parts. Don't use numerical integration; if can use a symbolic algebra package to check yourself on T2, then use it to do a couple more as well.)
c)
Give a one-line demonstration that bTn-1 + Tn = gn/n.
d)
Use c) to calculate T2, T3, ¼, T35 from the value of T0 in part b). Try this for g = 0.5 and b Î {0.3,0.8, 1.5, 3.0}. Hand in only the first and last values of b.
e)
From the rough prediction that T35 = 0, use c) to calculate T34, T33, ¼, T0. Try this for g = 0.5 and b Î {0.3, 0.8, 1.5, 3.0}. Hand in only the runs on b = 0.3 and b = 3.0.
f)
Compare the results of d) and e) and explain them for all four values of b; (Especially how you can start with a wrong value of T35 = 0 for b = 3.0 and get the right value of T0, while the other recurrence blows up...)



I expect that you should be able to hand in only about 5 pages: a graph for a), a page each for b) and f), a short derivation for c), and a two-sided page each of output for d) and e). Recall that collaboration is allowed, but must be acknowledged. Anything handed in, or any code used to generate results, must be your own writing or typing. Using someone else's code to produce results that you hand in as your own is NOT acceptable. You must type it yourself (and debug the typos you introduce) to help you understand it.

Problem Set \#2: assigned Feb 1, due Tuesday, Feb 8

Problem Set #2: assigned Feb 1, due Tuesday, Feb 8



The convex hull algorithms are based on the CCW(p,q,r) determinant, which tests the sign of

ê
ê
ê
ê
ê
1
px
py
1
qx
qy
1
rx
ry
ê
ê
ê
ê
ê
.
a)
Suppose that each point is moving with a different (but fixed) velocity vector, so that p(t) = p+t[u\vec] = (px+t ux, py+t uy), q(t) = q+t[v\vec], and r(t) = r+t[w\vec]. Express the CCW(p,q,r) test as a polynomial in t.
b)
Given a time t0, how would you calculate the next time t > t0 at which the sign would change?
c)
What is the polynomial in t for the InCircle(p,q,r,s) determinant, where s(t) = s+t [(s)\vec]:

ê
ê
ê
ê
ê
ê
1
px
py
px2+py2
1
qx
qy
qx2+qy2
1
rx
ry
rx2+ry2
1
sx
sy
sx2+sy2
ê
ê
ê
ê
ê
ê
.



Let W be a set of n windows-vertical line segments in the plane with above and below endpoints ai = (xi, ayi) and bi = (xi, byi) with ayi > byi, for 1 £ i £ n. We can look through W if some line intersects every window in W. Find an efficient algorithm to determine if we can look through W. (A linear time algorithm is not difficult if the windows are sorted by x-coordinate. Is there an W(nlogn) lower bound or can linear time be attained without sorting?)
Problem Set \#3: assigned Feb 8, due Thurs, Feb 22

Problem Set #3: assigned Feb 8, due Thurs, Feb 22



Implement a program that takes as input a set of n points P and velocity vectors V, and maintains a triangulation as the points move from t = 0 to t = 1. That is, maintain a decomposition of the convex hull (or of the entire plane) into ccw-oriented triangles whose vertices are the moving points. You will need to use the determinant calculations from the last problem set.
Your program should come in two variations: 1. maintaining some sort of lazy triangulation, where you change the triangulation only when a triangle shrinks to zero area, and 2. maintaining the Delaunay triangulation.

We will be modifying this program later to allow more complicated motions than fixed linear motion, so keep this in mind.

You should run your code on examples on the web site at http://www.cs.unc.edu/~snoeyink/c/c205/DynTri/examples3.htm. These examples are ascii files with the first line being the number of points n, and the subsequent lines being the point and motion vector coordinates separated by spaces, px py vx vy, for the points p1 through pn.

For these three examples, you should produce ascii output with your name, the list of points/vectors, the list of edges for the initial triangulation, and the list of swap events/times in order. I'll make a Java applet available that will parse such a file and display the moving triangulation so that you can check.

In more detail: Any line starting with ``%'' will be considered a comment. The first line should be a comment with your name, and which exercise is being solved: A, B, or C or one you've made up.

Then list the points/vectors in the same form as the input: One line with n followed by the coordinates separated by spaces, px py vx vy, for p1 through pn in the order that you will refer to them.

Then list the number edges of the initial triangulation, and the edges as pairs of point indices. Order will not be considered important; you can separate these one per line or by spaces.

Finally, list the times and vertex indices involved in swaps, one per line. If at time t you swap ij for kl, the line would read: t i j k l. When swapping an edge of the convex hull, you can have an index of zero to denote a swap with a point at infinity (as in the example below).

%Jack Snoeyink, small example 
%points
4
0 0 0 0
4 0 0 0
2 4 0 -3
2 2 2 2
%initial triangle edges
6
1 2
2 3
1 3
1 4
2 4
3 4
%swaps
0.241694 2 3 4 00 %point added to hull
0.666667 1 4 2 3  %normal swap
0.666667 3 00 4 1 %optional, to restore convex hull.

You may paste text like this into the applet at http://www.cs.unc.edu/~snoeyink/c/c205/DynTri/ to see the points, edges, and swaps.

There are some hints available on the web pages. Check out the open problem in the dynamic triangulation puzzle, too.

Problem Set \#4: assigned Feb 29, due Tuesday, March 7

Problem Set #4: assigned Feb 29, due Tuesday, March 7



Trace the intersection curve of two cylinders by interpolation.
Define two cylinders by these two equations:
A : y2 +( z + 1/2)2 = 1

B : x2 +( z - 1/2)2 = 1

The intersection is the set of all points that satisfy both equations. We'd like to be able to trace this curve as a parametric vector-valued function f(t) = ( x(t), y(t), z(t)). Here is a table with values of the three coordinate functions if we parameterize with t Î [0,1].

t x(t) y(t) z(t)
0 1 0 1/2
1/8 Ö3/2 Ö3/2 0
1/4 0 1 -1/2
3/8 -Ö3/2 Ö3/2 0
1/2 -1 0 1/2
5/8 -Ö3/2 -Ö3/2 0
3/4 0 -1 -1/2
7/8 Ö3/2 -Ö3/2 0
1 1 0 1/2

Interpolate functions for x(t), y(t), z(t). The interpolation methods you should use are:

a)
Lagrange interpolation (Hamming 14.5)
b)
Cubic spline interpolation with the standard end conditions that the second derivatives are zero. (Hamming 20.9)
c)
Cubic spline interpolation without end conditions-use the fact that the intersection is a closed curve.
Plot each coordinate function for the three interpolations. Also plot (x(t), z(t)) in the xz plane, for the three interpolations, and plot the circle for cylinder B.


File translated from TEX by
TTH, version 2.60.
On 3 Mar 2000, 09:32.