Tag Archives: Function (mathematics)

This week in screencasting: The polar express

It’s been a little quiet on the screencasting front lately, but in the next couple of weeks my colleague teaching Calculus III will be hitting material for which I volunteered to provide some content: namely, using MATLAB to visualize some of the surfaces and solids used in multiple integration. Yesterday, I finished two of these. The first on is on polar coordinates and polar function plotting in MATLAB:

And the second one is on cylindrical coordinates and plotting two-variable functions in cylindrical coordinates:

MATLAB doesn’t provide a built-in function for plotting in cylindrical coordinates. Instead — and this is either ingenious or annoying depending on how you look at it — to plot something in cylindrical coordinates, you generate all the points you need in cylindrical coordinates and then use the pol2cart function to convert them en masse to cartesian coordinates, then plot the whole thing as usual in cartesian coordinates.

I think this is smart, since by avoiding the use of a specialized function for cylindrical plots and sticking instead to a single command for 3D plotting, you learn one command for all 3D plots and you get to use all the extras available, such as adding a contour plot onto the cylindrical plot. Overloading the pol2cart function so that it can accept and produce the third coordinate makes this all work. Overall I like how MATLAB doesn’t try to make a function for everything but rather creates a well-featured set of relatively simple tools that will do lots of things.

But I can see where some people — especially MATLAB novices — would find all this annoying, since the entire process takes several steps. There’s a workflow diagram for doing this in the screencast, but a better way is to make an M-file that holds all the steps. Here’s the one I flashed briefly at the end of the screencast:


% Script for plotting a cylindrical function.
% Written by Robert Talbert, Ph.D., 10/20/2010

% Theta: Change t1 and t2 to set the starting and ending values for theta.
t1 = 0;
t2 = pi/2;
theta = linspace(t1, t2);

% r: : Change r1 and r2 to set the starting and ending values for theta.
r1 = -5;
r2 = 5;
r = linspace(r1, r2);

% Create meshgrid for inputs:
[theta, r] = meshgrid(theta, r);

% Apply the function to create a matrix of z-values. Change the function to
% match what you want to plot.

z = r*cos(theta);

% Convert to cartesian and plot using mesh:

[x,y,z] = pol2cart(theta, r, z);
mesh(x,y,z)

It would be simple enough to modify this so that it’s a function rather than a script, accepting the arrays theta and r and a function handle for z, and then producing the 3D plot. Or, one could even make an “ez” version where the user just enters a string containing the function s/he wants. If somebody wants to try that out, and you want to share your results, just put the source code in the comments.

The third one in this series will be up later this weekend. It’s on spherical coordinates and it’s pretty much the same process, only using sph2cart instead of pol2cart. There might be a fourth one as well, dealing with some special cases like constant cylindrical/spherical functions (you can’t just say “rho = 5”, because rho has to be a matrix) and how to plot not just the surfaces but the volumes underneath them.

Comments Off on This week in screencasting: The polar express

Filed under Calculus, Engineering, Math, MATLAB, Teaching, Technology

This week (and last) in screencasting: Functions!

So we started  back to classes this past week, and getting ready has demanded much of my time and blogging capabilities. But I did get some new screencasts done. I finished the series of screencasts I was making for our calculus students to prepare for Mastery Exams, a series of short untimed quizzes over precalculus material that students have to pass with a 100% score. But then I turned around and did some more for my two sections of calculus on functions. There were three of them. The first one covers what a function is, and how we can work with them as formulas:

The second one continues with functions as graphs, tables, and verbal descriptions:

And this third one is all on domain and range:

The reason I made these was because we were doing the first section of the Stewart calculus book in one day of class. If you know this book, you realize this is impossible because there is an enormous amount of stuff crammed into this one section. Two items covered in that section are how to calculate and reduce the difference quotient \frac{f(a+h) - f(a)}{h} and doing word problems. Each of these topics alone can cover multiple class meetings, since many students are historically rusty or just plain bad at manipulating formulas correctly and suffer instantaneous brain-lock when put into the presence of a word problem. So, my thought was to go all Eric Mazur on them and farm out the material that is most likely to be easy review for them as an outside “reading” assignment, and spend the time in class on the stuff that on which they were most likely to need serious help.

Our first class was last Tuesday and the second class wasn’t until Thursday, so I assigned the three videos and three related exercises from the Stewart book for Thursday, along with instructions to email questions on any of this, or post to our Moodle discussion board. I made up some clicker questions that we used to assess their grasp of the material in these videos, and guess what? Many students didn’t have any problems at all with this material, and those who did got their issues straightened out through discussions with other students as part of the clicker activity.

They’ll be assessed in 2 or 3 other ways on this stuff this week to make sure they really have the material down and are not just being shy about not having it. But it looks like using screencasts to motivate student contact with the material outside of class worked fine, at least as effectively as me lecturing over it. And we had more time for the hard stuff that I wouldn’t expect students to be able to handle, not all of them anyway.

Enhanced by Zemanta

Comments Off on This week (and last) in screencasting: Functions!

Filed under Calculus, Education, Educational technology, Math, Peer instruction, Screencasts, Teaching