113 - Topic 9 - Parametric Graphing

719 days ago by Professor102

Generally, one plots functions given in the form $ y = f(x) $ such as $ y = x^2 - 3x + 5 $ where you might plug in a selection of "independent" x-values to get a correspond set of "dependent" y-values. Plotting the points and connecting them nicely is what you have perhaps done in the past.

But what about a possible case where both x and y are dependent upon some other variable.  Then, what happens is that you might want to consider the case when

$$x = f(t)$$

$$y = g(t)$$

for various values of an independent variable $ a \le t \le b$. 

The result will still be a collection of points $(x,y)$ that can still be graphed. In this case you will get a curve that might no longer satisfy the vertical line test but which is a mixture of two functions.  The independent variable t could then act something like an odomoter that tells you how far you have traveled along the curve.

var('t') @interact(layout=dict(top=[['x', 'y']],bottom=[['left','right']])) def _(x=input_box(default=t^2-3,label="x(t) =",width=30), y=input_box(default=sin(t),label="y(t) =",width=30), left=input_box(default=-3,width=5,label="left endpoint ="), right=input_box(default=3,width=5,label=", right endpoint =")): G = parametric_plot([x,y],(t,left,right)) n=10 delt = (right-left)/n ts = [left+k*delt for k in [0..n]] eps = 0.1 T = "Parametric Plot of $ x(t) = %s$"%str(x) + " and $y(t) = %s$"%str(y) for tk in ts: G += point((x(t=tk),y(t=tk)),color='red')+text("t="+str(tk),(x(t=tk)-eps,y(t=tk)+eps),color='red',fontsize=7) G.show(title=T) 
       
x(t) =  y(t) = 
left endpoint =  , right endpoint = 

Click to the left again to hide and once more to show the dynamic interactive window

# Epitrochoid vs Hypotrochoid var('t,Hypotrochoid,Epitrochoid ') @interact def _(a=input_box(default=-10*pi), b=input_box(default=10*pi), m1 = slider(1,20,1,5), m2 = slider(1,20,1,4), showlabels = checkbox(default=0), graph = ['Hypotrochoid','Epitrochoid']): if graph == 'Epitrochoid': x=(m1 + m2)*cos(t) - m2*cos((m1/m2 + 1)*t) y=(m1 + m2)*sin(t) - m2*sin((m1/m2 + 1)*t) else: x=(m1 - m2)*cos(t) + m2*cos((m1/m2 - 1)*t) y=(m1 - m2)*sin(t) - m2*sin((m1/m2 - 1)*t) G = parametric_plot([x,y],(t,a,b)) if showlabels: n=11 delt = (b-a)/n ts = [a+k*delt for k in [0..n]] eps = 0.1 for tk in ts: G += point((x(t=tk),y(t=tk)),color='red')+text("t="+str(tk),(x(t=tk)-eps,y(t=tk)+eps),color='red',fontsize=7) G.show() pretty_print(x) pretty_print(y) 
       
m1 
m2 
showlabels 
graph 

Click to the left again to hide and once more to show the dynamic interactive window

It is especially interesting to see what happens when one uses trigonometric functions as part of the parametric equations. When doing so, one can get some really nifty graphs.

var('t') x = sin(t)^3 y = cos(t)^3 a = 0 b = 2*pi G = parametric_plot([x,y],(t,a,b)) G.show() pretty_print(x) pretty_print(y) 
       

                                
                            

                                
var('t') x = t*sin(t)^3 y = t*cos(t)^3 a = 0 b = 6*pi G = parametric_plot([x,y],(t,a,b)) n = 20 delt = (b-a)/n ts = [a+k*delt for k in [0..n]] pieces = [G+parametric_plot([x,y],(t,a,ts[k+1]),color='red',thickness=2) for k in range(n)] H = animate(pieces) H.show(delay=100) pretty_print(x) pretty_print(y) 
       

                                
                            

                                
var('t') x = (1+cos(3*t))*cos(2*t) y = (1+cos(5*t))*sin(3*t) a = 0 b = 2*pi G = parametric_plot([x,y],(t,a,b)) n = 20 delt = (b-a)/n ts = [a+k*delt for k in [0..n]] pieces = [G+parametric_plot([x,y],(t,a,ts[k+1]),color='red',thickness=3) for k in range(n)] H = animate(pieces) H.show(delay=100) pretty_print(x) pretty_print(y)