/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/ /* [ Created with wxMaxima version 11.08.0 ] */ /* [wxMaxima: title start ] Radar Tracking of a Moving Object [wxMaxima: title end ] */ /* [wxMaxima: comment start ] Chapter 10 Technology Application Project [wxMaxima: comment end ] */ /* [wxMaxima: section start ] Introduction [wxMaxima: section end ] */ /* [wxMaxima: comment start ] OBJECTIVE: Explore how to compute velocity and acceleration of a moving object whose position is given in polar coordinates. Animate the trajectory of a moving object together with its position, velocity, and acceleration vectors. In many practical applications, including the radar detection of a moving object, the position of an object is specified in polar coordinates with an angle and a distance. In this module, you will learn how to convert the position specification from polar coordinates to Cartesian coordinates and how to calculate the velocity and acceleration vectors. Animations are used to study several different motions, showing the object's position, velocity, and acceleration vectors as time progresses. [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: Converting from Polar to Cartesian Coordinates [wxMaxima: section end ] */ /* [wxMaxima: comment start ] The location of an object in a two-dimensional plane can be specified with two coordinates, x and y. These are the familiar Cartesian coordinates of a point in a plane. When the Cartesian coordinate values are placed in an array like this [x, y], the array is called a position vector, and it is denoted by the symbol r. That is, r = [x, y]. The order of the entries in a vector is important. The position [1, 2] is different from the position [2, 1]. Note that r, the symbol used to represent the vector, is a bold, lowercase letter . In contrast, x and y, the symbols used to represent the single numbers in the vector, are in italics and are not bold. The numbers x and y are called the components of the vector. An alternative notation for a position vector, typically used in physics and engineering, is r = x i + y j. This representation of the position vector contains exactly the same information as the [x, y] notation, but represents it in a different way. Geometrically, a position vector, r, is shown as an arrow in the Cartesian plane, extending from the origin to the position with coordinates x and y, as shown in the next figure. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ load(draw)$ ratprint:false$ wxdraw2d( nticks=200, color=black, head_angle=10, vector([0,0],[10,8]), xrange=[0,15], yrange=[0,15], label(["r",5, 5],["(x, y)",11,9]), xlabel="x", ylabel="y", xtics=false, ytics=false); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] For further exploration of moving objects in Cartesian coordinates, refer to "Projectile Motion," a JAVA applet included in this supplement. [wxMaxima: comment end ] */ /* [wxMaxima: comment start ] POLAR COORDINATES Another natural way to specify the position of an object in a plane is with polar coordinates. One application of polar coordinates is in the use of radar (radio-detecting-and-ranging) to track a moving object. Radar tracks an object by bouncing a radio-frequency light wave off of the object to measure its distance from the radar detector and its angular position relative to some fixed reference line through the detector. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=black, head_angle=10, points_joined=true, point_type=circle, points([[0,0],[10,8]]), line_type=dots, explicit(0,x,0,10), xrange=[-5,15], yrange=[-5,15], label(["r",5, 5], ["distance from object to detector",3,7], ["(x, y)",11,9], ["theta",3,1], ["reference line for measuring angles",5,-1]), xlabel="x", yaxis=false, xtics=false, ytics=false); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The angle, theta, is positive if it is counterclockwise from the fixed reference line and negative if it is clockwise. Using polar coordinates, we specify positions or points in a plane by a distance r from some fixed reference point, called the pole, and an angle theta from a fixed reference line through the pole. The values of r and theta are called the polar coordinates of the position or point. In the strict sense, the r-coordinate of a point in polar coordinates can be positive, negative, or zero. (See Section 9.5, "Polar Coordinates and Graphs," in the textbook.) However, in this module we make the assumption that r measures distance from the pole, therefore, we restrict r to be greater than or equal to 0. [wxMaxima: comment end ] */ /* [wxMaxima: comment start ] CONVERTING FROM POLAR TO CARTESIAN COORDIANTES Given the location of an object specified in polar coordinates, we would like to find its Cartesian coordinates. Therefore, we write a pair of transformation equations that will convert a pair of polar coordinates (r, theta) into Cartesian coordinates (x, y). The positive x-axis in the Cartesian reference frame is taken to be along the polar reference line with the origin at the pole, and the positive y-axis is in the polar direction, theta = %pi/2. In addition, we treat the variables r and theta as parametric functions of time. First we take care of some housekeeping by loading packages into memory and restricting r to be nonnegative. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ reset()$ kill(all)$ load(draw)$ ratprint:false$ assume(r(t)>=0); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] If r = r(t) and theta = theta(t), then the transformations to Cartesian coordinates are: [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ x(t) := r(t)*cos(theta(t)); y(t) := r(t)*sin(theta(t)); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Let's consider an example. First, we specify the position of an object in polar coordinates. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ r(t):= t$ theta(t) := t^2$ rvectorpolar: [r(t), theta(t)]; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] And we convert the position to a vector in Cartesian coordinates using the transformation equations that we defined above. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ rvectorCartesian: [x(t), y(t)]; /* [wxMaxima: input end ] */ /* [wxMaxima: subsect start ] You Try It: Part I [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] Given the following time functions for the polar coordinates of a moving object, form expressions for the vector position of the object in polar and Cartesian coordinates. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ kill(r, theta, rvectorpolar, rvectorCartesian); x(t) := r(t)*cos(theta(t)); y(t) := r(t)*sin(theta(t)); rvectorCartesian: [x(t), y(t)]; /* [wxMaxima: input end ] */ /* [wxMaxima: section start ] Part II: Position, Velocity, Speed, and Direction [wxMaxima: section end ] */ /* [wxMaxima: comment start ] If a radar detector is tracking a moving object, then r and theta vary with time. The derivative dx/dt measures the rate of change of the x coordinate of the object. This derivative is called the velocity of the object in the x direction and is denoted by v[x]. Similarly, dy/dt is the rate of change of the y coordinate of the object; it is called the velocity of the object in the y direction and is denoted by v[y]. Next we determine expressions for v[x] and v[y] in terms of r and theta and their time derivatives, and we write an expression for the velocity vector. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ vx: diff(x(t),t,1); vy: diff(y(t),t,1); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ vvectorCartesian: [vx,vy]; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Or, more simply, we can take the time derivative of the position vector, rvectorCartesian(t). [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ vvectorCartesian: diff(rvectorCartesian,t,1); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The speed of the object is the magnitude of the velocity vector. First, we define a function to calculate the magnitude of a vector, and then we use it to calculate the speed of the moving object. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ magnitude(vec) := sqrt(vec[1]^2+vec[2]^2); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] We use magnitude( ) to find the speed of the object. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ speed: magnitude(vvectorCartesian); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The direction of motion of the object is the velocity divided by the speed. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ vdirection: vvectorCartesian/speed; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The magnitude of the position vector, rvectorCartesian(t), is the distance of the object or point from the pole. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ distance: trigsimp(magnitude(rvectorCartesian)),assume(r(t)>=0); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] And the direction of the position vector is the unit vector in the direction of rvectorCartesian(t). [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ rdirection: expand(rvectorCartesian/distance); /* [wxMaxima: input end ] */ /* [wxMaxima: section start ] Part III: A Specific Trajectory [wxMaxima: section end ] */ /* [wxMaxima: comment start ] The path of motion of a moving object is called its trajectory. Let's plot the trajectory of an object. First, we define a position function in terms of the parametric functions r(t) and theta(t) and then graph the trajectory. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ r: .5*t; theta: .5*t^(5/4); x: r*cos(theta); y: r*sin(theta); rvectorCartesian: [x,y]; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=red, parametric(rvectorCartesian[1],rvectorCartesian[2], t,0,15), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: section start ] Part IV: Visualizing Position, Velocity, and Acceleration [wxMaxima: section end ] */ /* [wxMaxima: comment start ] In Maxima, you can create several plot objects and plot them together using the draw and gr2d commands. You can then create an animated GIF file from these plots. We create a small loop to generate a series of graphs as time increases by a specified increment. Each graph in the sequence shows the path of motion up to time t and the position vector at time t. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ p1: []$ numer: true$ for i: 1 thru 40 do block( a1: subst(i*15/40,t,x), a2: subst(i*15/40,t,y), p1: append(p1,[gr2d( nticks=200, color=red, parametric(x,y,t,0,i*15/40), color=blue, head_angle=10, head_length=sqrt(a2^2+a1^2)*.2, vector([0,0],[a1,a2]), xrange=[-8,8], yrange=[-8,8])]))$ draw( terminal = animated_gif, file_name = "1001", p1)$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Now let's add the velocity vector to the animation. We want the tail of the velocity vector to be at the head of the position vector; therefore, the arrow should be drawn from rvectorCartesian(t) to rvectorCartesian(t) + vvectorCartesian(t). [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ vvectorCartesian: diff(rvectorCartesian,t,1)$ p1: []$ numer: true$ for i: 1 thru 40 do block( a1: subst(i*15/40,t,x), a2: subst(i*15/40,t,y), b1: subst(i*15/40,t,rvectorCartesian)+ subst(i*15/40,t,vvectorCartesian), db: b1-[a1,a2], p1: append(p1,[gr2d( nticks=200, color=red, parametric(x,y,t,0,i*15/40), color=blue, head_angle=10, head_length=sqrt(a2^2+a1^2)*.2, vector([0,0],[a1,a2]), color=red, vector([a1,a2],db), xrange=[-8,8], yrange=[-8,8])]))$ draw( terminal = animated_gif, file_name = "1002", p1)$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] What the heck, why not add the acceleration? [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ avectorCartesian: diff(vvectorCartesian,t,1)$ vvectorCartesian: diff(rvectorCartesian,t,1)$ p1: []$ numer: true$ for i: 1 thru 40 do block( a1: subst(i*15/40,t,x), a2: subst(i*15/40,t,y), b1: subst(i*15/40,t,rvectorCartesian)+ subst(i*15/40,t,vvectorCartesian), db: b1-[a1,a2], c1: subst(i*15/40,t,rvectorCartesian)+ subst(i*15/40,t,avectorCartesian), dc: c1-[a1,a2], p1: append(p1,[gr2d( nticks=200, color=red, parametric(x,y,t,0,i*15/40), color=blue, head_angle=10, head_length=sqrt(a2^2+a1^2)*.2, vector([0,0],[a1,a2]), color=red, vector([a1,a2],db), color=green, vector([a1,a2],dc), xrange=[-8,8], yrange=[-8,8])]))$ draw( terminal = animated_gif, file_name = "1003", p1)$ /* [wxMaxima: input end ] */ /* [wxMaxima: section start ] Part V: Speeding Up or Slowing Down? Turning Left or Turning Right? [wxMaxima: section end ] */ /* [wxMaxima: comment start ] A few things are worth noting at this point: 1) The velocity is always along the tangent to the path of motion. 2) The acceleration has a nonzero component in the direction of the velocity. We show this by plotting the dot or scalar product of the acceleration vector with the unit vector in the direction of the velocity over the interval of time during the motion. This gives the component of the acceleration in the direction of the velocity, which we call Avel. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ timel: 40$ speed: sqrt(vvectorCartesian[1]^2+vvectorCartesian[2]^2)$ vdirection: [vvectorCartesian[1]/speed, vvectorCartesian[2]/speed]$ temp: avectorCartesian.vdirection$ wxdraw2d( nticks=200, color=red, explicit(temp,t,0,timel), xlabel="t", ylabel="Avel"); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] You should note that Avel is always positive, indicating that the component of the acceleration along the line of the velocity is, in fact, in the same direction as the velocity (instead of opposite it, as would be the case if the dot product were negative). Whenever this situation occurs, the object is speeding up. If the dot product is negative, then the acceleration has a component in the direction opposite that of the velocity, and the object is slowing down. 3) The object turns in the direction of the component of the acceleration that is perpendicular to the velocity. In the preceding example, the object is turning to the left, and the acceleration points to the left. The opposite is true when the object is turning to the right. [wxMaxima: comment end ] */ /* [wxMaxima: subsect start ] You Try It: Part V [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] To assist you, we copy the commands you need in the following sections. Change the entries below and execute the commands in all of the sections that follow. Change the polar coordinate functions r and theta to generate the following motions. 1. The same motion in Part IV, with the spiral clockwise instead of counterclockwise. 2. The same motion as in Part IV, with the r-coordinate starting at 10 and decreasing at the same rate it increased in Part IV. 3. For each motion, use a plot of Avel to indicate when the object is speeding up and when it is slowing down. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ reset()$ kill(all)$ load(draw)$ ratprint:false$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ r: .5*t; theta: .5*t^(5/4); x: r*cos(theta); y: r*sin(theta); rvectorCartesian: [x,y]$ vvectorCartesian: diff(rvectorCartesian,t, 1)$ avectorCartesian: diff(vvectorCartesian,t, 1)$ speed: sqrt(vvectorCartesian[1]^2+vvectorCartesian[2]^2)$ vdirection: [vvectorCartesian[1]/speed, vvectorCartesian[2]/speed]$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ timel: 40$ window: 20$ speed: sqrt(vvectorCartesian[1]^2+vvectorCartesian[2]^2)$ vdirection: [vvectorCartesian[1]/speed, vvectorCartesian[2]/speed]$ temp: avectorCartesian.vdirection$ wxdraw2d( nticks=200, color=red, explicit(temp,t,0,timel), xlabel="t", ylabel="Avel"); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ p1: []$ numer: true$ for i: 1 thru 40 do block( a1: subst(i*timel/40,t,x), a2: subst(i*timel/40,t,y), b1: subst(i*timel/40,t,rvectorCartesian)+ subst(i*timel/40,t,vvectorCartesian), db: b1-[a1,a2], c1: subst(i*timel/40,t,rvectorCartesian)+ subst(i*timel/40,t,avectorCartesian), dc: c1-[a1,a2], p1: append(p1,[gr2d( nticks=200, color=red, parametric(x,y,t,0,i*timel/40), color=blue, head_angle=10, head_length=sqrt(a2^2+a1^2)*.2, vector([0,0],[a1,a2]), color=red, vector([a1,a2],db), color=green, vector([a1,a2],dc), xrange=[-window,window], yrange=[-window,window])]))$ draw( terminal = animated_gif, file_name = "1004", p1)$ /* [wxMaxima: input end ] */ /* [wxMaxima: section start ] Part VI: Circular Motion [wxMaxima: section end ] */ /* [wxMaxima: comment start ] We put all of the commands into the sections that follow so we can try some different curves without having to scroll back up to re-execute commands. First we generate a parametric plot of the trajectory. From this we select values for the window size and time limit for use in the following sections, which generate the graphs for the animation. The motion we consider as an example is along a circular path; the object moves clockwise, and it is speeding up. First, we plot the trajectory. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ reset()$ kill(all)$ load(draw)$ ratprint:false$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ timel: 16*%pi/3$ window: 12$ r: 5$ theta: -.05*t^2$ x: r*cos(theta)$ y: r*sin(theta)$ rvectorCartesian: [x,y]$ vvectorCartesian: diff(rvectorCartesian,t, 1)$ avectorCartesian: diff(vvectorCartesian,t, 1)$ speed: sqrt(vvectorCartesian[1]^2+vvectorCartesian[2]^2)$ vdirection: [vvectorCartesian[1]/speed, vvectorCartesian[2]/speed]$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=red, parametric(rvectorCartesian[1],rvectorCartesian[2], t,0,timel), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ temp: avectorCartesian.vdirection$ wxdraw2d( nticks=200, color=red, explicit(temp,t,0,timel), xlabel="t", ylabel="Avel", xrange=[-2,15], yrange=[-0.6,0.6]); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The dot product of the acceleration with the direction vector is positive, so the object is speeding up. Next, we animate the motion showing the position, velocity, and acceleration vectors on the moving point. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ p1: []$ numer: true$ for i: 1 thru 40 do block( a1: subst(i*timel/40,t,x), a2: subst(i*timel/40,t,y), b1: subst(i*timel/40,t,rvectorCartesian)+ subst(i*timel/40,t,vvectorCartesian), db: b1-[a1,a2], c1: subst(i*timel/40,t,rvectorCartesian)+ subst(i*timel/40,t,avectorCartesian), dc: c1-[a1,a2], p1: append(p1,[gr2d( nticks=200, color=red, parametric(x,y,t,0,i*timel/40), color=blue, head_angle=10, head_length=sqrt(a2^2+a1^2)*.2, vector([0,0],[a1,a2]), color=red, vector([a1,a2],db), color=green, vector([a1,a2],dc), xrange=[-window,window], yrange=[-window,window])]))$ draw( terminal = animated_gif, file_name = "1005", p1)$ /* [wxMaxima: input end ] */ /* [wxMaxima: subsect start ] You Try It: Part VI [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] To assist you, we copy the commands you need in the following sections. Change the polar coordinate functions r(t)and theta(t) to generate the following motions. 1. A counterclockwise circular path with a radius of 10 and the angle theta(t) increasing the same way it did in Part VI. 2. A clockwise circular path with a radius of 10 and the angle theta(t) decreasing at the same rate it increased in Part VI. 3. Try this one: r(t) = 10 and theta(t) = t*(14-t)/12. What do you notice about the component of the acceleration in the direction of the velocity? When is the component of the acceleration that is perpendicular to the velocity the largest? When is it the smallest? Is the velocity vector ever equal to the zero-vector? Is the acceleration vector ever equal to the zero-vector? 4. For each motion, use the plot of Avel to indicate whether the object is speeding up or slowing down. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ reset()$ kill(all)$ load(draw)$ ratprint:false$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ timel: 16*%pi/3$ window: 12$ r: 5$ theta: -.05*t^2$ x: r*cos(theta)$ y: r*sin(theta)$ rvectorCartesian: [x,y]$ vvectorCartesian: diff(rvectorCartesian,t, 1)$ avectorCartesian: diff(vvectorCartesian,t, 1)$ speed: sqrt(vvectorCartesian[1]^2+vvectorCartesian[2]^2)$ vdirection: [vvectorCartesian[1]/speed, vvectorCartesian[2]/speed]$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=red, parametric(rvectorCartesian[1],rvectorCartesian[2], t,0,timel), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ temp: avectorCartesian.vdirection$ wxdraw2d( nticks=200, color=red, explicit(temp,t,0,timel), xlabel="t", ylabel="Avel", xrange=[-2,15], yrange=[-0.6,0.6]); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ p1: []$ numer: true$ for i: 1 thru 40 do block( a1: subst(i*timel/40,t,x), a2: subst(i*timel/40,t,y), b1: subst(i*timel/40,t,rvectorCartesian)+ subst(i*timel/40,t,vvectorCartesian), db: b1-[a1,a2], c1: subst(i*timel/40,t,rvectorCartesian)+ subst(i*timel/40,t,avectorCartesian), dc: c1-[a1,a2], p1: append(p1,[gr2d( nticks=200, color=red, parametric(x,y,t,0,i*timel/40), color=blue, head_angle=10, head_length=sqrt(a2^2+a1^2)*.2, vector([0,0],[a1,a2]), color=red, vector([a1,a2],db), color=green, vector([a1,a2],dc), xrange=[-window,window], yrange=[-window,window])]))$ draw( terminal = animated_gif, file_name = "1006", p1)$ /* [wxMaxima: input end ] */ /* Maxima can't load/batch files which end with a comment! */ "Created with wxMaxima"$