SUNY Geneseo Department of Mathematics
Math 230 02
Spring 2017
Prof. Doug Baldwin
Complete by Wednesday, March 8
Grade by Tuesday, March 21
This exercise begins developing your ability to write Matlab code that uses “if” statements to select different sections of code to execute under different circumstances. This lab also reinforces your ability to write Matlab functions.
Our book introduces “if” statements in chapter 11, particularly sections 11.1 and 11.4. We discussed this material in class on March 1 and 3. We also looked at some examples of “if” statements applied to piecewise function definitions as part of that discussion.
The last problem below asks you to implement a “recursive” or “inductive” piecewise definition. We will talk about such definitions and their implementation in Matlab in class on March 3.
Write Matlab functions that compute each of the mathematical functions described below.
The following piecewise linear approximation to x2 between x = 0 and x = 1:
For one point of extra credit, identify a connection between this function definition and the Mean Value Theorem from calculus.
When plotted, the following function looks like a hemispherical dent in an otherwise flat plane, so I call the function the “dent” function, d(x,y):
The factorial function for non-negative integers can be recursively defined piecewise as follows:
I will grade this exercise in a face-to-face meeting with you. During this meeting I will look at your solution, ask you any questions I have about it, answer questions you have, etc. Please bring your solution on your computer, as that will speed the process along.
Sign up for a meeting via Google calendar. Please make the meeting 15 minutes long, and schedule it to finish before the end of the “Grade By” date above.