Project2 - CS100M Fall 2006 Project 2 Due: September 21,...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS100M Fall 2006 Project 2 Due: September 21, 2006 (Thursday) at 6pm Submit your files on-line in CMS before the project deadline. Both correctness and good programming style contribute to your project score. You must work either on your own or with one partner. You may discuss background issues and general solution strategies with others, but the project you submit must be the work of just you (and your partner). If you work with a partner, you and your partner must register as a group in CMS and submit your work as a group. In this assignment, you will work with loops , write and call user-defined functions , and experiment with Matlab graphics. Along the way, you will explore some mathematical ideas and learn about the Bisection Method for root approximation. The last question talks about decomposition and modular design . We’ve done the decomposition for you in this project. Learn from this example and apply decomposition (modular design) in the future. Do not use arrays (vectors) in this project. 1. Mode The mode of a sequence of numbers is the number that occurs most frequently. For example, 87, 92, 92, 98, 98, 98, 100 mode is 98 3, 4, 4, 6, 8, 9, 9 mode is 4 or 9 Write a script to determine the mode of a user-entered sequence of numbers. If there are multiple modes you may report any one of them. You may assume that the sequence is non-negative and is entered one number at a time (prompted by the program) in non-decreasing order. The user enters a negative number to terminate the sequence, but the negative number is a stopping signal only and does not belong to the sequence. (The question has been discussed in lecture—refer to your lecture notes. The notes also show examples of the “interactive framework” for soliciting user input repeatedly.) Submit your script file findMode.m . 2. Root approximation using the Bisection Method Approximation is an important solution strategy for many problems. When an “exact” solution for a problem is too difficult or too computationally expensive to obtain, one may turn to approximation techniques. Simple numerical methods can be used to approximate roots or extrema (minimum or maximum). Some well-known root finding methods include Newton-Raphson, fixed-point iteration, and
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/15/2011 for the course COM S 100 at Cornell.

Page1 / 4

Project2 - CS100M Fall 2006 Project 2 Due: September 21,...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online