MAT 4830 Mathematical Modeling Section 1.3 Conditional Statements
Questions What is the purpose of a conditional statement?
Questions Describe a conditional statement in Maple.
Preview Review Poisson Distribution Introduces the conditional statements Allow the flow of control to branch into two or more sections of codes based on the truth values of a control expressions
Example 0 On average, random customers per hour come into a local Starbucks during the morning rush hours.
Example 0
Idea: Approximate the scenario by a binomial model
Idea: Approximate by a binomial model
Theorem 1
Why? Calculus Formula:
Why?
Team HW#1
Team Homework #1 Use the definition of expected value and the Taylor expansion Do not use the moment generating function.
Poisson Distribution
Team Homework #2 A newsboy sells newspapers outside Grand Central Station. He has on average 100 customers per day. He buys papers for 50 cents each, sells them for 75 cents each, but cannot return unsold papers for a refund. How many papers should he buy? To maximize the expected profit
Zeng Section 1.3
Example 1 Consider the piecewise defined function For each interval, we need a different formula to compute the function values
Example 1 Consider the piecewise defined function For each interval, we need a different formula to compute the function values Q: Input=?, Output=?
Example 1 Version 1
> fun(-2);fun(2); 4 2
Structure of the if-block Statements executed only if the condition is met. Otherwise, the statements will be skipped:
Example 1 Version 2
> fun(-2);fun(2); 4 2
Structure of the if-block There are two cases separated by one condition : the condition is met or else:
Example 2 We need 3 branches
Example 2
> fun(-3);fun(1);fun(3); e (-1)
Structure of the if-block
Homework Read 1.6 for formatting with printf See webpage