3D in Geogebra – a curve and tangent vector Paul Robinson, IT Tallaght Websites Geogebra Homepage: http://www.geogebra.org/cms/ Use the Appletstart Version of Geogebra or download a stand alone version. Geogebra Forum: http://www.geogebra.org/forum/ Community of Geogebra users, bug reports and feature requests Geogebra Facebook Group: http://www.facebook.com/home.php#!/geogebra Pretty active, conference news, lots of helpful stuff Geogebra Wiki: http://www.geogebra.org/en/wiki/index.php/English Collection of re-usable teaching resources University of Limerick: http://www.ul.ie/cemtl/resources.htm Excellent GeoGebra step by step demos – Math 247: http://math247.pbworks.com/Learn-and-Use-GeoGebra Fantastic Step-by-Step Help on How to Use GeoGebra by Dr Linda FahlbergStojanovska. Includes accessing Geogebra properties and methods using Javascript very cool. LaTeX online equation editor: http://www.numberempire.com/texequationeditor/equationeditor.php Indispensible if you want to put mathematics into Moodle and don’t know any LaTex! Introduction Geogebra can do a pretty good job of representing 3D objects, allowing rotations and dilations to view things from different angles and to zoom in. These notes are based on a construction by Michele Passante (http://www.mateblog.it/?p=372). px First a bit of theory: Let P py be a point in 3D space. The 3D rotation matrices about p z the x, y and z axis are 0 0 1 Rx 0 cos(a) sin(a) 0 sin(a) cos(a) cos(b) 0 sin(b) Ry 0 1 0 sin(b) 0 cos(b) cos(c) sin(c) 0 Rz sin(c) cos(c) 0 0 0 1 where a, b and c are angles between 0o and 360o. The rotation RX will rotate P in the horizontal plane anticlockwise about the vertical z axis through an angle of a, and similarly for Ry and Rz. If we rotate P and the x, y, z coordinate frame using R we can interpret the result as a rotated view of the original point P. This is what we will do in the construction which follows. We will write a general rotation as R Rz Ry Rx , which will allow us to rotate about the 3 axes. Note that the 3 rotations do not commute with each other, meaning that if we write them in a different order the result will generally be slightly different! This will not matter in terms of using rotations to view 3D objects. qx After rotation the point P will have 3D coordinate RP qy q z where the q coordinates now depend on the angles a, b and c. To see what this looks like in 2D (on the screen!) we simply want two of the coordinates of RP. If we imagine the x axis pointing out of the screen towards us then the screen coordinates are y, z. This qy means we need to plot the point Q . qz This construction is OK, but it is not very flexible. As well as Q we will want to extract some other information from the 3D point RP, and it is not easy to do in GeoGebra with RP in this form. Instead we will start with px 1 0 0 P py p x 0 py 1 p z 0 p x E x p y E y p z E z 0 0 1 p z Now RP px RE x py RE y pz RE z . We can now think of px as the component of the rotated P in the direction of the rotated axis RE x . If we let Wx be the 2D vector with components the y and z coordinates of REx , and similarly for Wy and Wz then we have Q pxWx pyWy pzWz The vectors pxWx , pyWy and pzWz are the components of the rotated P along the rotated axis as viewed on the screen. We will construct the rotation of a 3D point P with its axis frame. The point P does not change its position, just our rotated view of it changes. Creating a 3D axis frame 1. Put on sliders for angles a, b, c and another named d which will be used to lengthen and shorten our axes: Click on the slider tool then on the drawing pad. Call it a and select the angle option. Go with the default of 0o to 360o. Repeat for sliders b and c. Create another slider called d with a Number value from 0.5 to 5 in steps of 0.1. Right click the sliders (or their values in the left hand window) if you want to change their properties. click on the object selection tool if you want to move the sliders around. 2. Put in unit vectors along the x, y and z axes. In the input line at the bottom of the screen type E_x = {{1}, {0}, {0}} press return 1 This represents the column vector E x 0 . A row of numbers would be written as 0 {1, 0, 0}. We need a column as we want to multiply by a matrix. Repeat the input for E_y = {{0}, {1}, {0}} and E_z = {{0}, {0}, {1}} 3. Put in the rotation matrices Rx, Ry and Rz and the dilation matrix D In the input line type R_x = {{1, 0, 0}, {0, cos(a), -sin(a)}, {0, sin(a), cos(a)}} R_y = {{cos(b), 0, -sin(b)}, {0, 1, 0}, {sin(b), 0, cos(b)}} R_z = {{cos(c), -sin(c), 0}, {sin(c), cos(c), 0}, {0, 0, 1}} press return press return press return For the general rotation type R = R_z*R_y*R_x 4. Create our axes In the input line type V_x = R*E_x press return press return This will rotate (and dilate) the unit vector E_x which is pointing along the x-axis. Repeat for V_y = R*E_y and V_z = R*E_z Now we need to see what that looks like on the screen. The vectors V_x, V_y and V_z are column vectors. As mentioned in the introduction we want the 2nd and 3rd components of our 3D vectors to create a point on the screen. This is probably a good point to turn off labeling. Go to Options, labeling and click on No New Objects. In the input line type W_x = (Element[Element[V_x,2],1], Element[Element[V_x,3],1]) and press return. Element[V_x,2] is the second number in V_x, which is itself a list { } consisting of 1 number. We want the “first” number in that list. The round brackets in W_x mean that we now have a point in 2D which you should see on the screen. Repeat for W_y = (Element[Element[V_y,2],1], Element[Element[V_y,3],1]) W_z = (Element[Element[V_z,2],1], Element[Element[V_z,3],1]) In the input line type u = vector[d*W_x] press return Repeat for v = vector[d*W_y] and w = vector[d*W_z]. Hide the points W_x, W_y and W_z by clicking on the circles next to their definition in the left hand window. Click on the object Selection Tool then move sliders a and b to 30o, followed by moving c. See that d makes things bigger and smaller. 5. Make the axes look a bit nicer. Go to View and click on Axes to remove the default GeoGebra axes. Right click on the u vector (do it in the definition in the left hand window) and go to Properties at the bottom of the list. Use ctrl or shift to select u, v and w in the vector list simultaneously. Set the Colour to dark blue and the Style line thickness to 5. In the input line type –u and press return. Do the same for –v and –w. Select these 3 new vectors as before, leave the colour on black and the line thickness as thin but change the line style to fine dots. We also need to label our axes. Click on the small arrow at the bottom of the Slider Tool and select the Insert Text option. Click on the screen anywhere and type X for the text. Now right click the X text, go to Properties and Position. In the Starting Point box type 2*W_x. You may use the mouse to move the X text slightly but as you move the slider controls a, b, c and d it should follow the arrow head of the x-axis. Repeat this text insert for Y (Starting position 2*W_y) and Z (Starting position 2*W_z). As a final flourish type Polygon[d*(W_x+W_y), d*(-W_x+W_y), d*(-W_x-W_y), d*(W_x-W_y)] And press return. Right click each side of this polygon and click off Show Object. Use the Panning Tool (click it then drag on the screen) if you want to centre your construction a little. Click the little arrow on the panning tool to bring up the Zoom In and Zoom Out Tools (click then click the screen) if you want your picture bigger or smaller. We can now put other objects on our axes frame like points, lines and planes and see what they look like in 3D. We can also make geometric objects e.g. a cube made up of corners (points) and faces (polygons). Point plot of a 3D curve Creating constructions which require several points is most efficiently done using GeoGebra’s spreadsheet capability. We will construct a plot of the helix with parametric form r (cos(t),sin(t),t) This describes a point moving in a circle in the horizontal plane as t changes, while simultaneously moving up the z –axis. The result is a corkscrew type path winding round the z-axis. In GeoGebra go to View, Spreadsheet View and also click off Algebra View. Use the Panning Tool to move your axes if required. Type this, press Enter after typing in each formula. For x, y and z you should see the values 1, 0 and 0 respectively. By default, GeoGebra assumes that the t values are radians. As discussed in the introduction a point P with coordinates px, py, pz will have the screen coordinate Q pxWx pyWy pzWz . In the input line type E2 = B2*W_1 + C2*W_2 + D2*W_3 And press return. This will put a point in cell E2 and you will see that point on your axes. This point is (probably) a bit big; right click on cell E2, go to Properties.. and in Style set the point size to 1. Make this the Default style too. We want to see points for lots of t values. In the input line type A3 = A2 + 0.1 You will see 0.1 in cell A3. Click on A3 and hold the mouse on the small blue square in the bottom right hand corner of A3 (the fill handle), then drag down until you reach a value of 6.3 (cell A65). To create the corresponding points, highlight cells B2 to E2 with the mouse. Click and drag the blue fill handle in cell E2 down to copy all of the formulas for the corresponding t values from 0.1 to 6.3. With any luck, you should see your corkscrew! Rotate the axes to take a look at it. The Position and Tangent vectors of the curve Put a slider on the screen named t taking values from 0 to 6.3 in increments of 0.1. In the input line type P = cos(t)*W_1 + sin(t)*W_2 + t*W_3 press return Vector[P] press return Hide the point P and colour the vector red. You can animate t and the angle c (right click each slider and click on animate – you can also go to Properties.. and Slider and set the Repeat to Increasing to stop it animating backwards). If r (cos(t),sin(t),t) then the tangent vector (or velocity vector) to the curve at r is dr T ( sin(t),cos(t),1) dt In the input line type T = -sin(t)*W_1 + cos(t)*W_2 + W_3 vector[P, P + T] press return press return This form of the vector command produces a vector starting at P rather than at the origin. Hide the point T and colour this tangent vector green. Animating t (and possibly c to see what is going on) you can see that T points “along” the curve. You may want to hide the Algebra View and Spreadsheet View. Problems 1. The acceleration vector for the curve at r is A dT dr Construct vector[P, P + A] as above and satisfy yourself that the velocity and acceleration vectors are always at right angles to one another. 2. construct the following curves with their associated position, velocity and acceleration vectors by simply changing the formulas in B2 to D2 and the definitions of P, T and A. (a) r (t * cos(t),t * s in(t),t / 2) (b) r (cos(3 * t),2 * s in(3 * t),t) (c) r (1 t,t2 ,t) t from 0 to 6.3 t from 0 to 6.3 t from 0 to 6.3