MAT 4830 Mathematical Modeling Section 1.4 Conditional Statements
Preview Review Binomial Distribution Introduce the first type of repetition statements – the for loop Allow a specific section of code to be executed a number of times Introduces simple arrays
Example 0
Binomial Distribution B(n,p)
Team HW #1
Team Homework #1 Use the definition of expected value and the binomial theorem Do not use the moment generating function. You may need to recall how to shift indices in a summation (see the hidden slides below for review).
Index Shifting Sigma representation of a summation is not unique
Index Shifting Sigma representation of a summation is not unique
Index Shifting Sigma representation of a summation is not unique
Index Shifting Sigma representation of a summation is not unique
Index Shifting Rules
decrease the index by 1 increase the i in the summation by 1
Index Shifting Rules increase the index by 1 decrease the i in the summation by 1
Example
Team Homework #2 A campaign staff knows from experience that only one in every three volunteers called will actually show up to distribute leaflets.
Team Homework #2 How many phone calls must be made to guarantee at least 20 workers with a confidence of 90%?
Team Homework #2 How many phone calls must be made to guarantee at least 20 workers with a confidence of 90%? Minimum
Team Homework #2 Use a binomial model to solve the problem. You need to write a Maple program to help you solve the problem. You need to explain your methodologies, arguments, and conclusions carefully. Extra works are welcome – In the past, students had done more than they were asked to get bonus points.
Zeng Section 1.4 Introduce the first type of repetition statements – the for loop Allow a specific section of code to be executed/repeated a number of times Introduces simple arrays
Zeng Section 1.4 Please listen to the explanations before you type in the program. It takes one minute to explain.
Example 1 Print the square of the first 10 positive integers What is the task being repeated?
Example 1
Example 1 > sq(); 1 4 9
Structure of the for loop
The loop_index increase by the default step size 1 everytime the execution of block of statements to be repeated is finished. Different step size can be used by adding “ by stepsize ” feature.
Example 2 Print the square of the first 10 positive odd integers
Example 2
> sq2();
Example 3
> sq3(2); 1, 4 > sq3(5); 1, 4, 9, 16, 25
Example 4 Fibonacci sequence is defined by
Example 4
Why there is no print statement?
Example 4
Example 5
This is to demonstrate the basic form of “accumulation”.
Example 5
Homework See course webpage Read 1.3 All HW due next Monday Attempt your HW ASAP Individual HW**