MAT 4830 Mathematical Modeling Section 1.4 Conditional Statements

Slides:



Advertisements
Similar presentations
A method for addressing any large problem. Carefully consider the problem. Define the problem. Ask yourself the following questions: What is it that I.
Advertisements

Programming Methodology (1). Iteration Learning objectives explain the term iteration; repeat a section of code with a for loop; repeat a section of.
CS107 Introduction to Computer Science Loops. Instructions Pseudocode Assign values to variables using basic arithmetic operations x = 3 y = x/10 z =
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
1 Chapter 18 Recursion Dale/Weems/Headington. 2 Chapter 18 Topics l Meaning of Recursion l Base Case and General Case in Recursive Function Definitions.
Copyright © 2007 Pearson Education, Inc. Slide 8-1 Warm-Up Find the next term in the sequence: 1, 1, 2, 6, 24, 120,…
Infinite Series 9 Copyright © Cengage Learning. All rights reserved.
Multiplication Workshop
Exercise problems for students taking the Programming Parallel Computers course. Janusz Kowalik Piotr Arlukowicz Tadeusz Puzniakowski Informatics Institute.
COMPE 111 Introduction to Computer Engineering Programming in Python Atılım University
by Chris Brown under Prof. Susan Rodger Duke University June 2012
Agenda Control Flow Statements Purpose test statement if / elif / else Statements for loops while vs. until statements case statement break vs. continue.
MAT 4830 Mathematical Modeling Section 1.3 Conditional Statements
Factorial Notation For any positive integer n, n! means: n (n – 1) (n – 2)... (3) (2) (1) 0! will be defined as equal to one. Examples: 4! = =
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. C How To Program - 4th edition Deitels Class 05 University.
Nonvisual Arrays and Recursion by Chris Brown under Prof. Susan Rodger Duke University June 2012.
MAT 3237 Differential Equations Section 18.4 Series Solutions Part I
1 Chapter 13 Recursion. 2 Chapter 13 Topics l Meaning of Recursion l Base Case and General Case in Recursive Function Definitions l Writing Recursive.
Recursion Textbook chapter Recursive Function Call a recursive call is a function call in which the called function is the same as the one making.
For Loops 1 ENGR 1181 MATLAB 8. For Loops and Looped Programming in Real Life Looping within programs has long been a useful tool for completing mundane.
MAT 1236 Calculus III Appendix E Sigma Notations + Maple Lab
Developing an Algorithm
MAT 1236 Calculus III Section 11.6 Absolute Convergence and the Ratio and Root Tests
MAT 4830 Mathematical Modeling Section 1.3 Conditional Statements
PROGRAMMING ITERATION 2. Starter  Put the following code in order (write down the line numbers).  The program should display the numbers 1-24 on screen.
MAT 4725 Numerical Analysis Section 1.4 Loops with “do” statements
Notes Over 11.1 Sequences and Series A sequence is a set of consecutive integers. A finite sequence contains a last term Infinite sequences continue without.
Sequence – a function whose domain is positive integers. Section 9.1 – Sequences.
ITI 1120 Lab #5 Contributors: S. Boyd, R. Plesa, A. Felty, D. Inkpen, A. Williams, D. Amyot.
MAT 4830 Numerical Analysis Binomial Coefficients and Combinatorial Identities
Introduction to Strings Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg 1.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
MAT 1235 Calculus II Section 6.5 Exponential Growth and Decay
1 Recursion. 2 Chapter 15 Topics  Meaning of Recursion  Base Case and General Case in Recursive Function Definitions  Writing Recursive Functions with.
MAT 1234 Calculus I Section 1.6 Part II Using the Limit Laws
Advanced Engineering Mathematics, 7 th Edition Peter V. O’Neil © 2012 Cengage Learning Engineering. All Rights Reserved. CHAPTER 4 Series Solutions.
MAT 1221 Survey of Calculus Section 3.4 Optimization Problems
Mathematical Treasure-hunt: Sequences Cut out each of the question slides and place them around the room, stick them on the walls if you wish. Print out.
MAT 2401 Linear Algebra 2.5 Applications of Matrix Operations
Welcome to Mrs. Harton’s Math Class Date: 8/8/11 Bell Ringer (5 minutes) Fill out Book Card and Index Card (Print) Name:Period:Division: Address: Parent(s)/Guardian(s)
Iterations (aka Loops). 2 Loops Loops (iterations) are segments of code (loop body) that may be executed several times. Fixed-count (definite) loops repeat.
Infinite Series 9 Copyright © Cengage Learning. All rights reserved.
Algebra II Honors Problem of the Day Homework: p odds Find the first 6 terms of the sequence defined as: Fibonacci!
BO65: PROGRAMMING ITERATION 1. Starter  Write down what you think the code below outputs on screen: Dim intCounter as integer intCounter = 0 Do while.
CPSC 233 Tutorial 5 February 2 th /3 th, Java Loop Statements A portion of a program that repeats a statement or a group of statements is called.
CHAPTER 4 FUNCTIONS Dr. Shady Yehia Elmashad. Outline 1.Introduction 2.Program Components in C++ 3.Math Library Functions 4.Functions 5.Function Definitions.
Repetition Looping. Types for while do..while for The for loop allows you to iterate through a variable for a specific range of values. You must supply.
 2000 Prentice Hall, Inc. All rights reserved Program Components in C++ Function definitions –Only written once –These statements are hidden from.
CS 116 Object Oriented Programming II Lecture 13 Acknowledgement: Contains materials provided by George Koutsogiannakis and Matt Bauer.
Perkins Honors Precalculus Day 1 Section Write the first 5 terms for each sequence. Set of terms sequence. Calculator: LIST : OPS : seq( expression.
MAT 4725 Numerical Analysis Section 8.2 Orthogonal Polynomials and Least Squares Approximations (Part II)
4.2 Area. After this lesson, you should be able to: Use sigma notation to write and evaluate a sum. Understand the concept of area. Approximate the area.
MAT 1236 Calculus III Appendix E Sigma Notations + Maple Lab
Sequences and Series 9.1.
MAT 4725 Numerical Analysis
Chapter 5 - Functions Outline 5.1 Introduction
Learning to Program in Python
Sequences and Summations
Learning to Program in Python
To recall the doubles of all numbers to at least 10
Sigma/Summation Notation
9.1: Introduction to Sequences
MAT 4830 Mathematical Modeling
A LESSON IN LOOPING What is a loop?
AREA Section 4.2.
Repetition (While Loop) LAB 9
AREA Section 4.2.
Chapter 9 Section 1 (Series and Sequences)
Presentation transcript:

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**