Chapter 9. Tangent Lines to a Curve
Rovenski Vladimir, Haifa
> restart:
9.1 Tangent Lines
Example 1 . Plot tangent lines to the graph of y= f(x) . Start with the parabola.
> f:=x^2/2: x1:=-2: x2:=2: m:=15: # enter your function
> fx:=diff(f, x): X:=i -> x1+i*(x2-x1)/m:
> p:=i -> subs(x=X(i), f+fx*(t-x)):
> Tp:=plot([seq(p(i), i=0..m)], t=x1..x2):
> Gf:=plot(f, x=x1..x2, thickness=2):
> plots[display]([Gf, Tp]);
Continuation : We use two different methods to plot the moving normal vector along the graph.
> N:=evalm([x, f]+s*[-fx, 1]/sqrt(1+fx^2));
First method :
> Np:=plots[animate]([subs(x=X(i), N[1]), subs(x=X(i), N[2]),s=0..1], i=1..m): plots[display]([Np, Gf], scaling=constrained);
Second method (replace the line in the program with Np ):
> q:=i->plot([subs(x=X(i), N[1]),subs(x=X(i), N[2]), s=0..1]): Np:=plots[display]([seq(q(i), i=0..m)], insequence=true): plots[display]([Np, Gf], scaling=constrained);
2 . Let us plot the tangent lines and normal vectors to a parametrized plane curve; start with the cycloid:
> r:=[t-sin(t), 1-cos(t)]: m:=32: t1:=0: t2:=4*Pi:
> rt:=diff(r,t): Tp:=evalm(r+s*rt): # tangent line at a point t
> Np:=evalm(r+s*[-rt[2], rt[1]]): # normal vector at a point t
> T:=i->t1+i*(t2-t1)/m: p:=i->plot([subs(t=T(i), Tp[1]), subs(t=T(i), Tp[2]), s=-2..2], color=blue): q:=i->plot([subs(t=T(i), Np[1]), subs(t=T(i), Np[2]), s=0..1], color=red):
> plots[display](seq([p(i), q(i)], i=0..m), scaling=constrained);
Continuation : we plot the moving Frenet frame along the curve.
> with(plots): B:=plot([r[1], r[2], t=t1..t2]):
Warning, existing definition for changecoords has been overwritten
> A1:=display(seq(p(i), i=0..m), insequence=true): A2:=display(seq(q(i), i=0..m), insequence=true):
> display([A1, A2, B], scaling=constrained);
>
If the curve has no singular points (the ellipse r:=[2*sin(t), cos(t)] with t2:=2*Pi then we use its unit normal vector.
> Np:=evalm(r+s*[-rt[2], rt[1]]/linalg[norm](rt, 2));
>
Example :
> r:=[2*sin(t), cos(t)];
> rt:=diff(r,t): Tp:=evalm(r+s*rt): Np:=evalm(r+s*[-rt[2], rt[1]]/linalg[norm](rt, 2)): T:=i->t1+i*(t2-t1)/m: p:=i->plot([subs(t=T(i), Tp[1]), subs(t=T(i), Tp[2]), s=-2..2], color=blue): q:=i->plot([subs(t=T(i), Np[1]), subs(t=T(i), Np[2]), s=0..1], color=red): plots[display](seq([p(i), q(i)], i=0..m), scaling=constrained);
Continuation: Plot the moving Frenet frame along the curve.
> B:=plot([r[1], r[2], t=t1..t2]): A1:=display(seq(p(i), i=0..m), insequence=true): A2:=display(seq(q(i), i=0..m), insequence=true): display([A1, A2, B], scaling=constrained);
3 . We deduce the equation and then plot the tractrix.
> X:=t->a*sin(t):
> eq1:=dx=diff(X(t), t)*dt; eq2:=dx=tan(t)*dy; eq3:=subs(dx=op(2,eq1),eq2); _D:=simplify(solve(eq3, dy)/dt);
> simplify(int(_D, t)): Y:=unapply(%, t);
> q:=plot([X(t)/a, Y(t)/a, t=0.2..Pi-0.2], color=blue, scaling=constrained): %;
>
Continuation : we derive and plot the tangent line to the tractrix.
> simplify(Y(t)-X(t)*diff(Y(t), t)/diff(X(t), t)): y1:=unapply(%,t);
> p:=i -> plot([[X(Pi/2+i/9)/a, Y(Pi/2+i/9)/a], [0, y1(Pi/2+i/9)/a]]):
> display([seq(p(i), i=0..10), q], scaling=constrained);
Continuation : finally we plot the moving tangent line to the tractrix.
> A:=animate([(1-s)*X(Pi/2+i/9)/a, (Y(Pi/2+i/9)+s*(y1(Pi/2+i/9)-Y(Pi/2+i/9)))/a, s=0..1], i=-10..10):
> display([q, A]);
4 . Plot tangent lines to a space curve;
a) the circular helix
> r:=[R*cos(t), R*sin(t), v*t]: t1:=0: t2:=6*Pi: v:=1:
> # r:=[R*cos(t)^2, R*cos(t)*sin(t), R*sin(t)]: t1:=0: t2:=2*Pi:
> rt:=diff(r, t): m:=8: R:=1:
> B:=spacecurve(r, t=t1..t2,thickness=2): Tp:=evalm(r+s*rt);
> T:=i -> t1+i*(t2-t1)/m: p:=i -> spacecurve([subs(t=T(i), Tp[1]), subs(t=T(i), Tp[2]), subs(t=T(i), Tp[3])], s=-2..2):
> display([seq(p(i), i=0..m), B], axes=boxed);
b) the curve of Viviani
> r:=[R*cos(t)^2, R*cos(t)*sin(t), R*sin(t)]: t1:=0: t2:=2*Pi:
> rt:=diff(r, t): m:=8: R:=1:
> B:=spacecurve(r, t=t1..t2,thickness=2): Tp:=evalm(r+s*rt);
> T:=i -> t1+i*(t2-t1)/m: p:=i -> spacecurve([subs(t=T(i), Tp[1]), subs(t=T(i), Tp[2]), subs(t=T(i), Tp[3])], s=-2..2):
>
> display([seq(p(i), i=0..m), B], axes=boxed);
Continuation : we plot the moving tangent line along the curve.
> m:=32: A:=display(seq(p(i), i=0..m), insequence=true, orientation=[45, 60]): display([B, A]);
5 . Find the equation of the parabola that is tangent to the circle at the point P(1,1),
plot the curves. Answer : .
> f:=y-(x^2+a*x+b): g:=x^2+y^2-2:
> with(linalg): df:=grad(f, [x,y]); dg:=grad(g, [x,y]);
Warning, protected name norm has been changed and unprotected
Warning, protected name trace has been changed and unprotected
> t:=Pi/4: P:=[sqrt(2)*cos(t), sqrt(2)*sin(t)]: # enter your t
> a0:=solve(subs({x=P[1],y=P[2]}, det(matrix([df,dg]))),a); b0:=solve(subs({x=P[1], y=P[2], a=a0}, f)); f0:=subs(subs({b=b0, a=a0}, f));
> plots[implicitplot]({f0, g}, x=-2..3, y=-2..3);
>
9.2 Envelope Curve of a Family of Curves
Example 1 .
1. The discriminant y=0 of the family : consists of singular points of members of the family.
> p:=t -> plot([u^3+2*t, u^2/10, u=-1.1..1.1]): plots[display]([seq(p(t), t=1..7)]);
>
2. The parabola of safety .
> restart: with(plots): g:=9.8: v:=10:
Warning, existing definition for changecoords has been overwritten
> X:=v*t*cos(Pi/18*s): Y:=v*t*sin(Pi/18*s)-g*t^2/2: q:=plot(v^2/(2*g)-g/(2*v^2)*x^2,x=-v^2/g..v^2/g): T:=s->2*v*sin(Pi/18*s)/g: p:=s->plot([X,Y,t=0..T(s)]): A:=display([seq(p(s), s=1..17)], insequence=true):
> display([q, A], scaling=constrained);# Fig. 9.12
>
Without option insequence=true we obtain the stationary figure.
3. The envelope of the family of segments that cut out:
(a) triangles with area S from the coordinate angle X0Y. : a hyperbola.
> p:=n -> plot([t*n/10, (1-t)*10/n, t=0..1]): q:= n -> plot([t*n/10, -(1-t)*10/n, t=0..1]): plots[display](seq([p(n), q(n)], n={$-10..10} minus {0}));
(b) triangles with the hypotenuse a from the coordinate angle XY. , the astroid.
> p:=n->plot([t*cos(Pi/20*n),(1-t)*sin(Pi/20*n), t=0..1]): plots[display]([seq(p(n), n=-19..19)],scaling=constrained);
(c) the segments with sum of lengths from the coordinate axes OX and OY equal to a. .
> p:=n -> plot([t*n/10, (1-t)*(1-abs(n)/10), t=0..1]): q:=n -> plot([t*n/10, -(1-t)*(1-abs(n)/10), t=0..1]): plots[display](seq([p(n), q(n)], n=-9..9),scaling=constrained);
>
9.3 Mathematical Embroidery
9.3.1 Mathematical Embroidery Using Line Segments
2. The astroid
> restart: with(plots): m:=3: # astroid, for m=2 deltoid
Warning, existing definition for changecoords has been overwritten
> T:=n->Pi/18*n: p:=n->plot((sin(Pi-T(n)*m)-sin(T(n)))/(cos(Pi-T(n)*m)-cos(T(n)))*(x-cos(T(n)))+sin(T(n)), x=-3..3, y=-3..3):
> q1:=plot([cos(t), sin(t), t=-Pi..Pi], linestyle=2): q2:=plot([3*cos(t), 3*sin(t), t=-Pi..Pi], linestyle=2):
> display([seq(p(i), i={$-36..35} minus {seq(18*i-27,i=0..3)}), q1, q2], scaling=constrained, axes=framed); # astroid, for m=3 only !
> m:=2: T:=n->Pi/18*n: p:=n->plot((sin(Pi-T(n)*m)-sin(T(n)))/(cos(Pi-T(n)*m)-cos(T(n)))*(x-cos(T(n)))+sin(T(n)), x=-3..3, y=-3..3):
> q1:=plot([cos(t), sin(t), t=-Pi..Pi], linestyle=2): q2:=plot([3*cos(t), 3*sin(t), t=-Pi..Pi], linestyle=2):
> display([seq(p(i),i={$-35..35} minus {seq(6*i, i=-5..5)}), q1, q2], scaling=constrained, axes=framed); # deltoid, for m=2 only !
4. Embroidery of the nephroid
> restart: with(plots): m:=2: # m=2, cardioid
Warning, existing definition for changecoords has been overwritten
> p:=n->plot([t*cos(Pi/36*(18+n*m))+(1-t)*cos(Pi/36*(-18+n)), t*sin(Pi/36*(18+n*m))+(1-t)*sin(Pi/36*(-18+n)), t=0..1]): q:=plot([cos(t),sin(t),t=-Pi..Pi]):
> display([seq(p(n), n=-35..35), q], scaling=constrained); # Envelope: M=1 - cardioid, M=0.5 - nephroid.
> M:=1: plot([(1+M)*sin(M*t)-M*sin(t+M*t),-(1+M)*cos(M*t)+M*cos(t+M*t), t=0..2*Pi/M]);
> restart: with(plots): m:=3: # m=3 nephroid
Warning, existing definition for changecoords has been overwritten
> p:=n->plot([t*cos(Pi/36*(18+n*m))+(1-t)*cos(Pi/36*(-18+n)), t*sin(Pi/36*(18+n*m))+(1-t)*sin(Pi/36*(-18+n)), t=0..1]): q:=plot([cos(t),sin(t),t=-Pi..Pi]):
> display([seq(p(n), n=-35..35), q], scaling=constrained); # Envelope: M=0.5 - nephroid.
> M:=0.5: plot([(1+M)*sin(M*t)-M*sin(t+M*t),-(1+M)*cos(M*t)+M*cos(t+M*t), t=0..2*Pi/M]);
>
9.3.2 Mathematical Embroidery Using Circles
7. Embroidery of
> m:=1: T:=Pi/18*n: q:=plot([cos(t), sin(t), t=-Pi..Pi], linestyle=2):
cardioid; for m \=1 the Pascal's limacon
> b1:=n->sqrt(cos(T)^2+(m-sin(T))^2): p:=n->plot([cos(T)+b1(n)*cos(t), sin(T)+b1(n)*sin(t), t=0..2*Pi]): plots[display]([seq(p(n), n=-18..17), q]);
nephroid
> b2:=n->abs(cos(T)): p:=n->plot([cos(T)+b2(n)*cos(t),sin(T)+b2(n)*sin(t), t=0..2*Pi]): p:=n->plot([cos(T)+b2(n)*cos(t), sin(T)+b2(n)*sin(t), t=0..2*Pi]): plots[display]([seq(p(n), n=-18..17), q]);
>
9.4 Evolute and Evolvent (Involute). Caustic
Example 1 .
1. The parabola by parametric equations
and its evolute the half-cubic parabola , = .
> restart: with(plots):
Warning, existing definition for changecoords has been overwritten
> x:=t: y:=t^2: t1:=-2: t2:=2: # enter your curve
> xt:=diff(x, t): yt:=diff(y, t): xtt:=diff(xt, t): ytt:=diff(yt, t):
> x1:=simplify(x-yt*(xt^2+yt^2)/(xt*ytt-xtt*yt)); y1:=simplify(y+xt*(xt^2+yt^2)/(xt*ytt-xtt*yt));
Figure with moving normal:
> p1:=plot([x, y, t=t1..t2], color=blue): p2:=plot([x1, y1, t=t1+1..t2-1]):
> display([p1, p2], scaling=constrained);
> N:=evalm([x,y] + s*[x1-x, y1-y]);
> m:=16: T:=i->t1+i*(t2-t1)/m: p:=i -> plot([subs(t=T(i),N[1]), subs(t=T(i), N[2]), s=0..1]):
> A:=display([seq(p(i), i=m/4..3*m/4)], insequence=true):
> display([A, p1, p2], scaling=constrained);
2. The evolute of the ellipse is the prolate astroid
, .
In the above program we assume a:=3: b:=2: t1:=0: t2:=2*Pi:
3. The catenary is the evolute of the tractrix. In the above program we assume a:=1: t1:=.25: t2:=Pi-.25:
5. The evolvents of the unit-speed circle are the curves:
. Plot them by the following program.
> x:=R*cos(s/R)+(s-c)*sin(s/R): y:=R*sin(s/R)-(s-c)*cos(s/R): R:=1: p:=c -> plot([x, y, s=c..c+1.5*Pi]): q:=plot([R*cos(s/R), R*sin(s/R), s=0..2*Pi], color=blue):
> display([seq(p(c), c=0..5), q], scaling=constrained);
>
9.5 Parallel Curves
Example 1 . The equidistants for several curves.
> a:=8: x:=a*cos(t)^3: y:=a*sin(t)^3: t1:=-Pi: t2:=Pi:
> a:=8: b:=7: x:=a*cos(t): y:=b*sin(t): t1:=0: t2:=2*Pi:
> d:='d': x:=t: y:=t^2: t1:=-2: t2:=2: # parabola,
> xt:=diff(x, t): yt:=diff(y, t): xtt:=diff(xt, t): ytt:=diff(yt, t):
> xd:=x-d*yt/sqrt(xt^2+yt^2): yd:=y+d*xt/sqrt(xt^2+yt^2):
> q:=plot([x, y, t=t1..t2], color=blue, thickness=2):
> p:=d -> plot([xd, yd, t=t1..t2], thickness=2):
> plots[display]([seq(p(d), d=-3..3), q]);
>