advertisement

IMPLEMENTING AN INTRODUCTORY MATHEMATICAL SOFTWARE COURSE Michael A. Karls Department of Mathematical Sciences Ball State University ABSTRACT We will look at the challenges of designing and implementing an introductory mathematical software course; Provide an overview of topics covered and resources used for each type of software; Give examples of homework problems, exam questions, and project topics chosen for the course; Address issues that have arisen. 2 INTRODUCTION In fall 2007, I piloted a course, entitled MATHS 159 Introduction to Mathematical Software at Ball State University. The course was designed to introduce mathematical science majors to “mathematical software” – in particular Excel, Mathematica, and MATLAB. MATHS 159 was a direct result of work done with colleagues Irene Livshits and Richard Stankewitz as part of an Enhanced Provost Initiative Grant. 3 DEPARTMENTAL RATIONALE (PORTION) Currently, most of our math majors have difficulty with the technology they encounter in many of their classes. One reason may be that most students in our programs don't have a solid foundation in both the mechanics of the software and the use of the software as a tool for doing mathematics. … MATHS 159 … taken early in a student’s program, will provide a systematic introduction to mathematical software packages that are used in many of our upper level courses. 4 DEPARTMENT OF MATHEMATICAL SCIENCES OVERVIEW Ball State University Public institution Located in Muncie, Indiana 20,000 students Program Enrollment (fall 2008) Majors and minors: Actuarial Science Mathematical Sciences (pure and applied mathematics options) Mathematics Teaching, (middle and secondary school options) Mathematical Economics (joint with Economics) Minor in Mathematics 240 undergraduate majors 97 Actuarial Science majors 112 Mathematics Teaching majors 31 Mathematical Sciences majors Common core for all majors Calculus (three semesters) Linear algebra Discrete mathematics Senior capstone course MATHS 159 (starting in fall 2008). 5 SOFTWARE USE IN DEPARTMENTAL COURSES Mathematical software use in courses varies by course, major, and instructor. Calculus sequence – approximately three Mathematica labs per course. Linear Algebra – Mathematica or MATLAB component. Mathematics Teaching majors take a junior-level course on teaching with software/technology that includes graphing calculators, Excel, Logo, and Geometer’s Sketchpad. Actuarial Science majors use Excel extensively in their courses Mathematical Science majors use MATLAB in their numerical analysis courses. Other courses that routinely integrate mathematical software include Most actuarial science and statistics courses (Excel, Minitab, SAS, R) Mathematical Models (Mathematica, Excel, MATLAB). Differential Equations (Mathematica) Operations Research (Mathematica, Excel, MPL, LINGO). 6 INITIAL CHALLENGES For MATHS 159, at first, all I had for a course guide/template was a master syllabus and a list of technology topics. From this, I had to create a set of course materials at a level appropriate to freshman who would be concurrently enrolled in first-semester calculus. 7 EXCEL RESOURCES Introductory Resources Ball State mini-course Greg, H., Excel 2003 for Dummies. Walkenbach, J., Excel 2007 Bible. Online Resources Microsoft Office Online. Microsoft Excel – math and trigonometry functions. http://office.microsoft.com/enus/excel/CH100645361033.aspx Microsoft Office Online. Microsoft Excel – list of worksheet functions. http://office.microsoft.com/enus/excel/HP100791861033.aspx James, B.W., Excel Tutorial. http://people.usd.edu/~bwjames/tut/ex cel/ French, T. Excel IF functions - Using IF functions in Excel Spreadsheets. About.com. http://spreadsheets.about.com/od/exce lfunctions/a/if_funct_hub.htm Solver Add-On Tutorial Finance and Simple Linear Programming Hillier, F. S. & Lieberman, G. J., Introduction to Operations Research (8th ed.). Lial, M. L., Miller, C. D., & Greenwell, R. N., Finite Mathematics and Calculus with Applications (4th). Mooney, D. & Swift, R., A First Course in Mathematical Modeling. Population Growth and Optimization Olinick, M., An Introduction to Mathematical Models in the Social and Life Sciences. Stewart, J., Calculus (early transcendentals). (5th). 8 MATHEMATICA RESOURCES Introductory Resources Built-in Help Files Burkhardt, W., First Steps in Mathematica. Help References Mathematica Tutorial and Lab Resources Karls, M., Mathematica Tutorial. http://www.bsu.edu/web/mk arls/MathematicaTutorial0 8.nb. Emert, J. & Nelson, R., Calculus and Mathematica. Wolfram, S., Mathematica: A System for Doing Mathematics by Computer (2cd) Calculus Resources Wolfram Research. Hollis, S., CalcLabs with http://www.wolfram.com/ Mathematica. Wolfram Research. Stewart, J., Calculus (early Wolfram Screencast and transcendentals). (5th). Video Gallery. http://www.wolfram.com/ broadcast/. 9 MATLAB RESOURCES Introductory Resources Calculus with MATLAB Built-in Help Files University of Utah. MATLAB Tutorial. http://www.math.utah.edu/lab/ ms/matlab/matlab.html/. Sigmon, K., MATLAB Primer (3rd) Jenson, G., Using MATLAB in Calculus. Most of the mathematics for this section was calculus based, at the level of differentiation, Riemann sums, and integration. We also touched on programming and graphing, using examples from the previous sections. Linear Algebra Resources (MATLAB is matrix-based) Anton, H. & Rorres, C., Elementary Linear Algebra (7th) Lewand, R.E. Cryptological Mathematics. To help tie the other software to MATLAB, we looked at how to solve linear systems in Excel and Mathematica. Systems of linear equations and matrices Excel files. Supplement to Finite Mathematics, (7th ed.), by Margaret Lial et al. http://wps.aw.com/aw_lial_finite math_7/0,1769,12520-,00.html 10 INTRODUCTORY SURVEY Given on the first day, 20-30 min allowed. Problems to be done by hand. All questions appear in the first Excel lecture! 1. For the integers n = 1, 2, 3, … 99, 100, find each of the following: a. b. c. d. n^2 n^3 4n^3 + n^2 -1 1 + 2 + … + n (Note: For n = 1, the sum is 1. For n = 2, the sum is 1 + 2.) 11 INTRODUCTORY SURVEY 2. The data in the following table are the land area in Australia colonized by the American marine toad (Bufo marinis). a. b. c. Plot this data with Year on the x-axis and Area on the y-axis. Find a function that can be used to predict this growth. Estimate when Australia will be overrun by the toads (Australia’s area is 7,619,000 km2). Year Area(km^2) 1939 32800 1944 55800 1949 73600 1954 138000 1959 202000 1964 257000 1969 301000 1974 584000 12 INTRODUCTORY SURVEY 3. Sort the following list of birthdays of famous mathematicians according to their a. b. c. Birth Year Name Birth Year followed by Name Birth Year Name Birth Year Name 1584 Vernier 1840 Henrici 1646 Flamsteed 1852 Le, P. 1736 Bring 1900 Aiken 1739 Klügel 1878 Bernstein, F. 1939 Baker 1909 Black 1852 Frattini 1920 Pillai 1888 Courant 1946 Margulis 1924 Cohn 1880 Bernstein, S. 1942 Hawking 1796 Bienaymé 1814 Wantzel 1801 Cournot 1867 Bôcher 1819 1883 Keynes 1883 Schouten 1816 Wolf 1910 Turán 1905 Dubreil-Jacotin 1910 Koopmans 1906 Feller 1911 Kakutani 1922 Marchenko 1939 Kingman 1818 Joachimsthal 13 TOPICS OVERVIEW Topics in Excel IN Definitions and Terminology Finance Applications – Simple and Compound Interest Finance Applications – Annuities and Amortization Logical Functions and Conditional Formatting Mathematical Functions Recurrence Relations Population Models The Excel Solver Topics in Mathematica Basic Syntax and Basic Commands Entering Text, Formatting, and Using the Help File Formatting and Working with Tables ORDER PRESENTED Topics in Mathematica (cont.) Calculus Commands Parametric Curves and Surfaces; Animation Importing and Exporting Data Optimization Numerical Computation Simple Programming Systems of Equations Topics in MATLAB Elementary Matrix Theory Numerical Differentiation and Integration in MATLAB; Function M-files Working with Data in MATLAB The Symbolic Toolbox Programming in MATLAB 14 SAMPLE EXCEL HOMEWORK QUESTION Using the data from the Toads Example, Create a table in Excel with a column for years and a column for area. Make a scatter plot that includes a labeled best-fit line. Find the area predicted by the Excel best-fit line, error, and relative error. Compare the best-fit line model values and resulting errors to the graphs. Repeat with y = 13568.1x -2.63405*10^7, found via Mathematica’s “Fit” command. Which linear model is better – Excel’s or Mathematica’s? Why? Use the “better” best-fit line to help estimate graphically when Australia will be overrun by toads (Australia total area is 7,619,000 km^2). I have gotten a lot of mileage out of this set of data – related questions and examples include: THEY DON’T AGREE – DUE TO ROUNDING IN THE TRENDLINE FORMULA! Calculating the best-fit line slope and y-intercept several different ways (formulas, built-in functions, Excel’s Solver); Treating toad growth as a recurrence relation; Fitting the data to exponential, logistic, or polynomial models (in all three types of software). Source: Blanchard, P. (1994). Teaching differential equations with a dynamical systems viewpoint. College Journal of Mathematics, 25 (5), 385-393. 15 SAMPLE MATHEMATICA LAB QUESTION For the function f(x) = x^3+x-4, Define the function f[x], Choose an x-coordinate x = a, Define a function m[h] that computes the slope of the secant line between (a,f(a)) and (a+h,f(a+h)) Reproduce the given graph that includes a tangent line at (1,-2) and secant lines that will converge to the tangent line as the slider controlling h is moved. The curves are made with a Plot command, the dots are made with a ListPlot command, and the two plots are combined with a Show command. h 0.632 f x 6 4 2 x 0 2 4 6 1 0 1 2 3 f[x_]:=x^3+x-4 a=1; m[h_]:=(f[a+h]-f[a])/h. 16 SAMPLE MATLAB EXAM QUESTION Let g(x) = exp[-(1/2) x^2]. Find the actual derivative of this function, g’(x). Find the numerical derivative of g(x) on the interval [-1, 1]. Use a Riemann sum to numerically estimate the definite integral of g(x) on the interval [-1,1]. Extra Credit: Find the integral of g(x) on the interval [-k, k] symbolically. Then find the value of this integral if we replace k with infinity, two ways – numerically with increasing k-values and symbolically with a limit. The idea for this problem comes from similar examples in Jenson’s Using MATLAB in Calculus. 17 FINAL PROJECT Part of a student’s course grade is based on a final group project which includes a class presentation. Each project applies ideas from calculus to real-world problems or situations and can be investigated with the software tools studied in the course. Source: Straffin, P. (Editor). Applications of calculus: Volume 3. MAA Notes (29). Washington, DC: Mathematical Association of America Press. Project 1 2 3 4 Calculus Area of Ideas Used Application Minimizing Derivatives to quadratic find local Fitting Lines polynomials extrema, Statistics to Data finds the logarithm and regression line exponential to a data set functions Minimizing Derivatives of Trigonometric trigonometric Somewhere functions to functions, Optics, within the explain finding Meteorology Rainbow properties of a maxima and rainbow minima Average Integrals of value of a Measuring polynomials function, Political Voting give a integration of Science Power measure of polynomials, voting power mathematical induction Differentiatio Trigonometric n& How to Tune integrals Signal integration of a Radio explain tuning Analysis sines and a radio cosines Title Topic 18 COURSE LOGISTICS The course meets 200 minutes per week, with at least one 100 minute (double) period. The double period works well for in-class exams. PowerPoint or other appropriate electronic formats as well as chalkboard are used for interactive lectures. Lectures and files for examples are posted on line before each class period. Three in-class exams, one for each type of software – software use is required. Students may use 5” by 8” index card (one side) Help files No other course material Electronic files for exam solutions are emailed to me (and a course graduate assistant for back up). 19 COURSE ISSUES Since the course is different than “traditional courses”, I have had to work out bugs as they arise – most of which can be classified as one of the following: Technological issues related to using computers in general, such as Not being able to log into a network to get to the class web page, Not knowing where a file is saved, Trouble with saving a file in a certain format, Not knowing how to email a file. Logistical issues related to running the course, such as Software issues related directly to specific course software, such as Getting errors while trying to work out an example in class or on homework problem. Mathematical issues related to the course content, especially questions on labs and exams, such as Being able to interpret a question, Knowing how to start a question, Figuring out how the question relates to the course lectures, Using the software to answer the question. Finding ways to effectively collect, grade, and return student lab work and exams. 20 COURSE SOLUTIONS Technological Many of these issues occur only once and are unpredictable, but can usually be “fixed” immediately. Having a graduate assistant in the course to help answer student questions has worked well. Logistical Several attempts were made, including submitting work to Blackboard (which doesn’t recognize Mathematica files), turning in hard copies of work to be graded by hand, and saving exam work to laptops. Overall, email has turned out the be the best way for students to turn in their work. Homework is graded electronically and returned via printed summary sheet. Software Most problems with the software boil down to entering incorrect syntax and are “easily” remedied once the syntax error is found. As each software section (and the semester) progresses, these errors occur less frequently. Mathematical Ignoring syntax issues, mathematical issues tend to arise from lab or exam questions that students do not understand or know how to interpret. Since I am making up or getting the questions from various sources, I revise, rewrite, or throw out questions as needed and provide liberal hints in lab, office hours, and via email. 21 COURSE SUCCESS Overall, I feel that the course has been a success, based on Feedback from students (in person and on evaluations), Comments from colleagues who have taught the course, Student performance on exams, Student pass rate (77% earned a grade of C or higher), Departmental support for the course, Student confidence in using the software by the end of the course, especially Mathematica. Informal input from colleagues who teach courses that use the software: More students in our introductory statistics course report familiarity with Excel, Our students in numerical analysis are more confident and fluent with MATLAB than in the past. 22 STUDENT PERCEPTIONS Fall 2007 students felt that the course was valuable to them and wished it would have been offered earlier in their college career. Mostly upper class majors, 12 students. Fall 2008 students indicated that they didn’t see the value of the course to their major. Mostly first-semester freshman, twice as many students. Similar sentiment for the versions taught in Fall 2009 – the course was a mix of upper and lower level students. 23 AN UNEXPECTED ISSUE MATHS 159 is required of all freshman majors. Sections are capped at 25 students. Only two sections offered per semester. This leads to a potential “bottleneck” for students entering our programs. For this reason, since fall 2010, the course is now taken in a students’ sophomore year after completing one semester each of calculus and discrete mathematics. In addition, since Mathematics Teaching majors already have a technology course, only Actuarial Science and Mathematical Science majors are required to take the course. 24 THE FUTURE! As the course progresses, in whatever form it takes, many more examples, homework problems, exam questions, and final projects will have to be created. I look forward to the challenge of continuing to find ways to help increase students’ awareness of the usefulness of software for their mathematical careers! 25 REFERENCES For more detail and a list of all references used for the course, please see: Implementing an Introductory Mathematical Software Course. The Electronic Journal of Mathematics and Technology. Vol. 4, No. 3, 232-250, October 2010. https://php.radford.edu/~ejmt/ 26 EXTRA SLIDES – COURSE TOPICS DETAIL 27 TOPICS IN EXCEL – DETAIL Finance Applications – Simple and Compound Interest: Simple Interest, Compound Interest, Present Value, What-If Analysis (Scenario Manager and Goal Seek) Finance Applications – Annuities and Amortization: Sequence (Fibonacci, geometric); Series (partial sum, closed form); Annuities as partial sums; Annuities (ordinary, annuities due); Future Value of an Ordinary Annuity; Sinking Fund; Using Excel’s built-in functions to perform these calculations; Present Value of an Annuity; Mortgage; periodic payments; Amortization Schedule Logical Functions and Conditional Formatting: Logical Functions (TRUE, FALSE, NOT, AND, OR, IF, IFERROR); Nested IF; LOOKUP; Conditional Formatting Mathematical Functions: Common Mathematical Functions (SQRT, ABS, EXP, LN, LOG10, POWER, ROUND, SIN, COS, TAN, CSC, SEC, COT, PI, RADIANS); Best-Fit Lines (SUMPRODUCT, SLOPE, INTERCEPT); Excel’s Trendline Feature (number of digits, exponential); Rates of Change (average, instantaneous, tangent line, derivative); Engineering Functions (BIN2DEC, HEX2DEC, CONVERTCOMPLEX, IMPRODUCT); Excel Add-Ins 28 TOPICS IN EXCEL – DETAIL Recurrence Relations: Recurrence Relation (factorial function, Fibonacci sequence, compound interest); Initial Conditions and Order; Closed-form solutions (compound interest, Fibonacci sequence); Exponential Function; Exponential Growth and Decay; Damped or Undamped Oscillation; Fixed Points and Stability Population Models: Finding a recurrence relation from a closed-form model (exponential growth for toad population data); The Logistic Model; Using Excel to study growth rates with different carrying capacities and a fixed growth rate; Fixed points in the logistic model; Two or more populations (predator-prey, host-parasite, competitive hunter, arms race); Predator-Prey (foxes and rabbits) in Excel – recurrence relations; Revised Predator-Prey Model which includes logistic growth The Excel Solver: Maximizing an area enclosed by a fence; Minimizing least squares error in an approximating function (SUMXMY2); Maximizing office storage space (simple linear programming, naming a range of cells); Excel’s Solver Add-In 29 TOPICS IN MATHEMATICA – DETAIL Basic Syntax and Basic Commands: Basic Syntax; Constants and Commands; Grouping Symbols (mathematical grouping, function syntax, list syntax); Types of Equals Signs (=, ==, :=); Calculator Commands (trigonometric functions, N); Symbol Manipulation (Clear, Expand, Factor, Solve, Apart, Together); Graphing Commands (Plot, ListPlot); Defining Functions ([ ], Simplify, /;) Entering Text, Formatting, and Using the Help File: Entering Text and Formatting (changing text, palettes, shortcuts); Using the Help Browser (Plot3D example); Formatting and Working with Tables: Table Command (TableForm, GridBox, FrameBox); Extracting or Working with Elements in Tables ([[ ]], Length); Tables of Graphs Calculus Commands: Finding a Limit (Limit); Differentiating a Function (D, prime notation, higher-order derivatives); Integrating a Function (Integrate, NIntegrate); Evaluating Sums and Series (Sum) 30 TOPICS IN MATHEMATICA – DETAIL Parametric Curves and Surfaces; Animation: Parameterized Curves and Surfaces (ParametricPlot, ParametricPlot3D); Real-Time 3D Graphics (rotating, zooming); Animation (ListAnimate, Animate, Manipulate) Importing and Exporting Data: Import and Export (Head, $Path); Filetypes (CSV, DAT, XLS, etc.); Put and Get (FilePrint, PutAppend, Needs, Flatten); Optimization: FindMinimum and FindMaximum (local); Minimize and Maximize (global); Constraints; NMinimize and Nmaximize; Replacement Operator (/.) Numerical Computation: FindRoot (Accuracy, WorkingPrecision, Chop); NSolve (solving polynomial equation or system polynomial of equations); NLimit vs. Limit; Nintegrate (Timing, MaxRecursion) 31 TOPICS IN MATHEMATICA – DETAIL Simple Programming: Definition of Computer Program; Logical Operators (And, Or, Not, Xor, Nor, Nand); If (piecewise defined function, absolute value function example using If vs. /;); Differentiating each version – which works better as a plot; Differentiating each version – which “works”; Which (piecewise defined function – more than two “pieces”, differentiating yields a function defined via Which); Switch; Nest (recurrence relations); Print (Hello World example, new line (\n)); Do (sum of squares, including a Print statement, adding an If statement, Return[ ]); For (local vs. global variables, Module, Continue[ ], Break[ ]); While (Coin Toss example, RandomInteger, using And to ensure While loop stops); Newton’s Method Example (by “hand”, simple Do loop, Do loop with intermediate outputs printed via Print, For loop, maximum 50 steps, tolerance checked via If) 32 TOPICS IN MATLAB – DETAIL Systems of Equations: System of two equations in two unknowns; Review of substitution and elimination; Solving a System of Equations with Technology (calculator, Mathematica, Excel); Using Excel’s Solver to solve a system of equations (2 x 2 case); Using Mathematica’s Solve command to solve a system of equations (2 x 2 case); General 2 x 2 system – what choices of coefficients are allowed?; Solving general 3 x 3 case (by hand, calculator, Mathematica, Excel, Other, when a solution is guaranteed, Mathematica solution) Elementary Matrix Theory: Matrix definition and examples (row, column, vector); Matrix Notation ([A]ij = aij, square matrix); Arithmetic with Matrices (addition and subtraction, matrix multiplication, scalar multiplication); Identities and Inverses; Review of Real Number Properties (additive identity, multiplicative identity, additive inverse, multiplicative inverse); Matrix Properties (zero matrix, identity matrix, additive inverse); Multiplicative Inverse (2 x 2 case, setting up algebraic system to solve to find inverse); When is matrix A invertible? (determinant of a matrix, how to check if a matrix is invertible via determinant.); Linear Systems of Equations Revisited (2 x 2 linear system in matrix form, solve via multiplication by multiplicative inverses.) 33 TOPICS IN MATLAB – DETAIL Introduction to MATLAB: MATLAB Basics (Desktop, help, lookfor, doc, type, up – arrow, clc, Command History window); Entering Matrices; The Colon Operator (pulling out parts of a matrix, concatenating matrices); Matrix Operations (+, -, *, ^, ’, .’, inv, \, / ); Array Operations with matrices A and B, scalar k (k*A, A.*B, A./B, A.^B); Special Matrices and Matrix Functions (eye, zeros, ones, det, clear, clear all); Linear Systems of Equations with MATLAB (2 x 2); Making a Table of Values for a Function; Creating an M-File; MATLAB’s Path and Running an M-File; The Plot Command (plot, title, xlabel, ylabel, grid, legend); Multiple plots and piecewise-defined functions Numerical Differentiation and Integration; Function M-files: Numerical Differentiation (linspace, diff, graphical comparison via subplot); Numerical Integration (Riemann sums via sum); Function M-Files 34 TOPICS IN MATLAB – DETAIL Working with Data: Useful built-in commands for data manipulation (fzero, sum, min, max, length, mean, median, std, sort); Finding minimum of a function on an interval (numerically, discretely, via fzero); Represent a polynomial as a vector of coefficients (polyval, polyfit); Fit a polynomial to a set of data via least squares; Importing data from text file into MATLAB via Import Wizard; Fit data with polynomial; Compare to Excel’s Trendline or Mathematica’s Fit command The Symbolic Toolbox: MATLAB’s built-in symbolic commands (syms, diff, int, simplify, pretty, subs, double, ezplot); MATLAB’s function calculator (funtool); Programming: Plotting Toad Data; Making a Loop; Working with Symbolic Functions; Newton’s Method; Competitive Hunters Model 35