/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/ /* [ Created with wxMaxima version 11.08.0 ] */ /* [wxMaxima: title start ] Parametric and Polar Equations with a Figure Skater [wxMaxima: title end ] */ /* [wxMaxima: comment start ] Chapter 13 Technology Application Project [wxMaxima: comment end ] */ /* [wxMaxima: section start ] Introduction [wxMaxima: section end ] */ /* [wxMaxima: comment start ] OBJECTIVE: Represent curves and analyze motion in parametric and polar form. Parametric equations are very powerful, and the purpose of this module is to help you get used to the idea of expressing curves using parametric equations and analyzing motion in the plane using these parametric equations. Polar plots can also be expressed parametrically, and that can be translated easily into Cartesian coordinates. [wxMaxima: comment end ] */ /* [wxMaxima: subsect start ] Technology Guidelines [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] NOTE: If you have just finished a document, restart Maxima before executing a new document. This can be done by choosing "Restart" from the Maxima menu. TO OPEN OR CLOSE CELLS Click on the arrow at the top of the cell bracket. TO STOP AN EXECUTION Click on STOP button from the toolbar. ORDER OF EXECUTION Execute commands in the order given. Do not skip any Maxima Input lines within a given document. Alternatively, you can execute the entire worksheet by selecting the "Evaluate All Cells" command from the "Cell" drop down menu or simply press Ctrl-r. SAVING WORKSHEETS You can save anytime to any directory you choose, and it is wise to save often. EXPERIENCING MAJOR PROBLEMS Save if appropriate, and then shut down Maxima and start it up again. [wxMaxima: comment end ] */ /* [wxMaxima: section start ] Part I: Parametric Equations of a Curve in Two- Dimentional Space [wxMaxima: section end ] */ /* [wxMaxima: comment start ] DEFINING THE FUNCTION First, we define the x and y coordinates parametrically. Suppose that time, t, is the independent variable. Once x and y are defined, we can write the position vector r(t). [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ reset()$ kill(all)$ load(draw)$ ratprint:false$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ x(t) := cos(t)^3$ y(t) := 1-exp(sin(t))$ r(t) := [x(t), y(t)]$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Now we plot the resulting curve in blue. In what direction are you moving on the curve as t increases? [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ print("")$ print("The position vector is: ")$ print(r(t))$ wxdraw2d( nticks=200, color=blue, parametric(x(t), y(t), t, 0, 2*%pi), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] TAKING THE VELOCITY AND ACCELERATION INTO ACCOUNT If you consider the parametric equation as a vector equation for the motion of a particle, the velocity vector is found by differentiating each component of the position vector. Similarly, the acceleration vector is found by differentiating the components of the position vector twice. We do this with Maxima and plot the velocity in red and the acceleration in green. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ xd1: diff(x(t),t,1)$ yd1: diff(y(t),t,1)$ vel: parametric(xd1,yd1,t,0,2*%pi)$ print("")$ print("The velocity function is: ")$ print([xd1, yd1])$ wxdraw2d( nticks=200, color=red, vel, xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ xd2: diff(x(t),t,2)$ yd2: diff(y(t),t,2)$ acc: parametric(xd2,yd2,t,0,2*%pi)$ print("")$ print("The acceleration function is: ")$ print( [xd2, yd2])$ wxdraw2d( nticks=200, color=green, acc, xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Note that the components of the velocity and acceleration functions are more complicated than the components of the postion function. Let's look at the speed function and see what it tells us. The following plot shows the speed in black, the x-coordinate in orange, and the y-coordinate in magenta. Contrasting that to your parametric plot, identify the places where the speed function is 0. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ speed(t) := sqrt((diff(r(t),t,1).diff(r(t),t)))$ print("The speed is: ")$ print(speed(t))$ wxdraw2d( nticks=200, color=black, explicit(speed(t), t, 0, 2*%pi), color=orange, explicit(x(t), t, 0, 2*%pi), color=magenta, explicit(y(t), t, 0, 2*%pi)); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ print("")$ print("The position vector is: ")$ print(r(t))$ wxdraw2d( nticks=200, color=blue, parametric(x(t), y(t), t, 0, 2*%pi), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Identify the places on your path where the speed is 0 and the speed is a maximum. [wxMaxima: comment end ] */ /* [wxMaxima: comment start ] COMPUTING THE DISTANCE TRAVELED ON A CURVED PATH Suppose that you are walking along the path given above. The distance traveled can be found by integrating the speed function over a particular interval. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ distance: quad_qags(speed(t), t, 0, 2*%pi)[1]$ wxdraw2d( nticks=200, color=blue, parametric(x(t), y(t), t, 0, 2*%pi), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=black, explicit(speed(t), t, 0, 2*%pi), xlabel="t", ylabel="speed"); print("")$ print("The distance traveled around the closed path is ")$ print(distance, " units")$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Think of this answer as either the distance around the curve or as the area under the speed function over the interval t from 0 to 2*%pi. [wxMaxima: comment end ] */ /* [wxMaxima: subsect start ] You Try It: Part I [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] DEFINING A FUNCTION Select your own functions for x(t) and for y(t) in the cell below, and then execute the command below. You need not select a closed path, and you may wish to change the bounds for the parameter to something other than 0 to 10. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ x(t) := sin(t/3.2)$ y(t) := exp(-t)*t^2$ r(t) := [x(t),y(t)]$ print("")$ print("The position vector is: ")$ print(r(t))$ wxdraw2d( nticks=200, color=blue, parametric(x(t), y(t), t, 0, 10), xlabel="x", ylabel="y")$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] COMPUTING THE VELOCITY AND ACCELERATION VECTORS AND ANALYZING THE SPEED [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ xd1: diff(x(t),t,1)$ yd1: diff(y(t),t,1)$ vel: parametric(xd1,yd1,t,0,10)$ print("")$ print("The velocity function is: ")$ print([xd1, yd1])$ wxdraw2d( nticks=200, color=red, vel, xlabel="x", ylabel="y")$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ xd2: diff(x(t),t,2)$ yd2: diff(y(t),t,2)$ acc: parametric(xd2,yd2,t,0,10)$ print("")$ print("The acceleration function is: ")$ print( [xd2, yd2])$ wxdraw2d( nticks=200, color=green, acc, xlabel="x", ylabel="y")$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ speed(t) := sqrt((diff(r(t),t,1).diff(r(t),t)))$ print("The speed is ", speed(t))$ wxdraw2d( nticks=200, color=black, explicit(speed(t), t, 0, 2*%pi), color=orange, explicit(x(t), t, 0, 2*%pi), color=magenta, explicit(y(t), t, 0, 2*%pi)); print("speed(t): black, x(t): orange, y(t): magenta")$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ print("")$ print("The position vector is: ")$ print(r(t))$ wxdraw2d( nticks=200, color=blue, parametric(x(t), y(t), t, 0, 10), xlabel="x", ylabel="y")$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Identify the places on your path where the speed is 0 and the speed is a maximum. [wxMaxima: comment end ] */ /* [wxMaxima: comment start ] FIND THE DISTANCE ALONG THE CURVED PATH Adjust the values of the parameter in the integration you did so earlier. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ distance: quad_qags(speed(t), t, 0, 10)[1]$ wxdraw2d( nticks=200, color=blue, parametric(x(t), y(t), t, 0, 10), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=black, explicit(speed(t), t, 0, 10), xlabel="t", ylabel="speed"); print("")$ print("The distance traveled around the closed path is ")$ print(distance, " units")$ /* [wxMaxima: input end ] */ /* [wxMaxima: section start ] Part II: A Figure Skater Tracing a Polar Plot [wxMaxima: section end ] */ /* [wxMaxima: comment start ] FOUR-PETAL PATTERN Think of a figure skater who is tracing out a four-petal flower on the ice. The first set of commands gives the parametric equations of the figure skater in terms of a path that would be traced in the x-y plane. It is easiest to start with the equations in polar form. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ kill(all)$ load(draw)$ ratprint:false$ r(t) := 16*sin(t)^2; theta(t) := t/2; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ p1: polar(r(2*theta),theta,0,2*%pi)$ wxdraw2d( nticks=200, color=blue, p1, xlabel="East/West", ylabel="North/South"); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ parx(t) := r(t) * cos(theta(t))$ pary(t) := r(t) * sin(theta(t))$ position: [parx(t),pary(t)]$ print("")$ print("The position vector is: ")$ print(position)$ velocity: diff(position,t,1)$ print("")$ print("The velocity vector is: ")$ print(velocity)$ speed(t) := sqrt(velocity.velocity)$ arr1: vector([parx(1), pary(1)], [parx(1.1)-parx(1),pary(1.1)-pary(1)])$ arr2: vector([parx(2.5), pary(2.5)], [parx(2.6)-parx(2.5),pary(2.6)-pary(2.5)])$ arr3: vector([parx(4), pary(4)], [parx(4.1)-parx(4),pary(4.1)-pary(4)])$ arr4: vector([parx(5.5), pary(5.5)], [parx(5.6)-parx(5.5),pary(5.6)-pary(5.5)])$ arr5: vector([parx(7), pary(7)], [parx(7.1)-parx(7),pary(7.1)-pary(7)])$ arr6: vector([parx(8.5), pary(8.5)], [parx(8.6)-parx(8.5),pary(8.6)-pary(8.5)])$ arr7: vector([parx(10), pary(10)], [parx(10.1)-parx(10),pary(10.1)-pary(10)])$ arr8: vector([parx(11.5), pary(11.5)], [parx(11.6)-parx(11.5),pary(11.6)-pary(11.5)])$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=blue, p1, head_angle=15, color=black, arr1,arr2,arr3,arr4,arr5,arr6,arr7,arr8); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Can you tell in what direction the skater is moving right at the origin? Let's look at the speed function and see what it tells us. The following plot shows the speed in black, the x-coordinate in orange, and the y-coordinate in violet. Contrasting that to your parametric plot, identify the places where the speed function is 0. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ tickst: [0,1,15]$ ticksf: [-15,5,20]$ print("")$ print("The speed is: ")$ print(speed(t))$ wxdraw2d( nticks=200, color=black, explicit(speed(t), t, 0, 4*%pi), color=orange, explicit(parx(t), t, 0, 4*%pi), color=magenta, explicit(pary(t), t, 0, 4*%pi), xtics=tickst, ytics=ticksf); print("speed(t): black, x(t): orange, y(t): magenta")$ print("")$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=blue, p1, head_angle=15, color=black, arr1,arr2,arr3,arr4,arr5,arr6,arr7,arr8); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Where are the places on your four-petal plot that the speed is 0? [wxMaxima: comment end ] */ /* [wxMaxima: comment start ] VELOCTIY AND ACCELERATION: WHEN ARE THEY PERPENDICULAR? Suppose we wish to determine for which values of t certain vectors describing the equations of motion are orthogonal. To do this, we will use the dot product, since perpendicular vectors yield a dot product of 0. Here we will examine when the velocity and acceleration vectors are perpendicular to one another. We begin by computing the dot product of the two vectors and we plot the resulting function of t to get an idea of when the dot product might be 0. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ acceleration: diff(velocity,t,1)$ vdota: velocity.acceleration$ print("")$ print("velocity=")$ print(velocity)$ print("")$ print("acceleration=")$ print(acceleration)$ print("")$ print("velocity dotted into acceleration=")$ print(vdota)$ wxdraw2d( nticks=200, color=black, explicit(vdota,t,0,4*%pi), xlabel="t", ylabel="vdota"); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] As you can see from the graph, there are many times when the velocity and acceleration vectors are perpendicular to each other. The following commands find some of the places where the velocity and acceleration vectors are perpendicular. Notice that we use seed values in solve that seem close to some of the places where our function crosses the horizontal axis. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ sol1: []$ for i: 0.785 thru 12 step 0.785 do block( temp: find_root(vdota, t, i-0.3925, i+0.3925), sol1: append(sol1, [temp]))$ sol1; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Now we evaluate x and y at the values of t we have found. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ sol2: makelist([parx(sol1[i]),pary(sol1[i])],i,1,length(sol1)); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] We can now see where those points are relative to our petals. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ psol: points(sol2)$ wxdraw2d( nticks=200, color=blue, p1, color=red, point_type=circle, psol); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The dots show where the velocity and acceleration vectors are perpendicular to each other. Can you describe what is happening to the figure skater at those points? [wxMaxima: comment end ] */ /* [wxMaxima: subsect start ] You Try It: Part II [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] Try your own functions for r(t) and theta(t). Remember to solve for t as a function of theta before you attempt to do a polar plot in the form of r as a function of theta. Replace the terms in r(t) and theta(t). [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ kill(t,x,y)$ r(t) := cos(t)^3$ theta(t) := t^2/8$ pp1: polar(cos(sqrt(8*theta))^3,theta,0,3)$ wxdraw2d( nticks=200, color=blue, pp1, xlabel="East/West", ylabel="North/South", xrange=[-1.5,1.5], yrange=[-1.5,1.5]); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ parx(t) := r(t)*cos(theta(t))$ pary(t) := r(t)*sin(theta(t))$ position: [parx(t), pary(t)]$ velocity: diff(position, t, 1)$ speed: sqrt(velocity. velocity)$ print("Position Vector: ", position)$ print("Speed: ", speed)$ wxdraw2d( nticks=200, color=black, explicit(speed,t,0,5), color=orange, explicit(parx(t),t,0,5), color=magenta, explicit(pary(t),t,0,5), xlabel="t", ylabel="function")$ print("speed: black")$ print("x-coordinate of the path of motion: orange")$ print("y-coordinate of the path of motion: magenta")$ print("")$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=blue, pp1, xlabel="East/West", ylabel="North/South", xrange=[-1.5,1.5], yrange=[-1.5,1.5])$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] What is happening to your speed as t increases? [wxMaxima: comment end ] */ /* Maxima can't load/batch files which end with a comment! */ "Created with wxMaxima"$