{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Algorithms

# Algorithms - Algorithms A Little MATLAB Programming Find at...

This preview shows pages 1–16. Sign up to view the full content.

Algorithms + A Little MATLAB Programming

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

View Full Document
( 29 0 2 3 2 = + - = x x x f Methods: 1. Quadratic Formula (analytic) 2. Factorization (analytic) 3. Iteration (algorithmic) Find at least one root of the following function:

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

View Full Document
When we solve problems, whether homework or extensive programming assignments a plan of action is needed. Algorithm Etymology: alteration of Middle English algorisme, from Old French & Medieval Latin; Old French, from Medieval Latin algorismus, from Arabic al-khuwArizmi, from al- KhwArizmI fl A.D. 825 Arabian mathematician A procedure for solving a mathematical problem (as of finding the greatest common divisor) in a finite number of steps that frequently involves repetition of an operation; broadly : a step-by-step procedure for solving a problem or accomplishing some end especially by a computer
Structured Programs Producing an algorithm for a particular programming problem is a very personal task. Two programmers can arrive equally valid solutions using very different approaches. Fortunately there are some programming/algorithm basic techniques that have been shown to produce efficient solutions. In 1968 Edgar Dijkstra outlined a technique called structured programming. He remarkable idea that algorithms could be constructed from only four types of structures.

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

View Full Document
Sequences of instructions
Branches

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

View Full Document
Loops
Modules

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

View Full Document
Algorithm Building Structures 1. Sequential – Steps executed one after another in a linear sequence. 2. Selection – Allows for decision processes based on conditional true/false tests. 3. Repetition – Allows parts of algorithm to be repeated. a. Number based – Steps repeated a specific number of times b. Condition based – Steps repeated until a true/false condition becomes false.
Actually there are a few more things that are needed to actually produce a working program that implements an algorithm. These are the “nuts and bolts” of any programming language and are specific to that language: Data Operations (add, subtract, compare etc.) Input/Output capability

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

View Full Document
Suppose that we wish to calculate the interest penalty added to an account after a payment is made. There are several steps involved in the solution: 1. Examine the problem to determine what information the problem is requesting. This determines a goal to be achieved. 2. Plan a strategy. Determine equations that are needed in solution. Hierarchy charts can be useful to prepare an overview of the solution. 3. Determine what information in the form of inputs is necessary to effect a solution. Express these inputs in general terms.
Interest Calculation Get original balance, rate and payment Calculate new balance Output new balance Apply payment to original balance Calculate interest to be applied Find new balance A hierarchy chart is a useful tool for getting an overview of how parts of an algorithm fit together and interact:

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

View Full Document
Once we have an overview of the problem it is time to work on the algorithm. Algorithm can be expressed in one of a couple of ways: Flowcharts Pseudocode
Flowcharts provide a graphical representation of the algorithm. There

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 78

Algorithms - Algorithms A Little MATLAB Programming Find at...

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

View Full Document
Ask a homework question - tutors are online