SUNY Geneseo Department of Mathematics
Monday, March 6
Math 230 02
Spring 2017
Prof. Doug Baldwin
I’m out of town from roughly noon Wednesday for the rest of this week.
So lab 5 has to be graded after break.
Nicole would like your help for Friday’s class...
Remember that you can’t write mathematical expressions such as 0 ≤ x ≤ 1 in
quite that form (e.g., 0 <= x <= 1
) in Matlab.
Why not? Because it is two comparisons, and they evaluate from left to right. In the
example, 0 <= x
yields a Boolean value, i.e., either 0 or 1, which is then
compared to 1. This last comparison always comes out true (both 0 and 1 are less than or
equal to 1), so the example is a round-about way to generate the value True, not a way to
see if x is between 0 and 1.
How do you write them? 0 <= x & x <= 1
An additional exercise, for extra credit. See handout for details.
Introduction to “while” loops - a way to repeat statements many times.
Read section 12.1