Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computational Biology, Part 13 Spreadsheet Basics II Robert F. Murphy Copyright  1996, 1999, 2000, 2001. All rights reserved.

Similar presentations


Presentation on theme: "Computational Biology, Part 13 Spreadsheet Basics II Robert F. Murphy Copyright  1996, 1999, 2000, 2001. All rights reserved."— Presentation transcript:

1 Computational Biology, Part 13 Spreadsheet Basics II Robert F. Murphy Copyright  1996, 1999, 2000, 2001. All rights reserved.

2 Recalculation When a cell value is changed, what determines whether other cells are recalculated? There are two options: When a cell value is changed, what determines whether other cells are recalculated? There are two options:  Automatic  The program recalculates every cell (if necessary) every time a cell changes  This is the default for most spreadsheet programs  Manual  The program waits for a user command before recalculating

3 Recalculation order When cells refer to each other, what determines the order in which the calculations are done? When cells refer to each other, what determines the order in which the calculations are done? Some (older) spreadsheets calculate cell values in a set order. Some (older) spreadsheets calculate cell values in a set order.  Columnwise  Top to bottom for 1st column then 2nd column...  A1 to An, B1 to Bn, C1 to Cn, etc.  Rowwise  Left to right for 1st row then 2nd row...

4 Forward References A formula that refers to a cell “ahead” in the recalculation order of the cell containing the formula is called a forward reference. A formula that refers to a cell “ahead” in the recalculation order of the cell containing the formula is called a forward reference. If the recalculation order is columnwise, references to cells to the right of the cell containing the formula are forward references. If the recalculation order is columnwise, references to cells to the right of the cell containing the formula are forward references. If the recalculation order is rowwise, references to cells below the cell containing the formula are forward references. If the recalculation order is rowwise, references to cells below the cell containing the formula are forward references.

5 Example of forward reference Given the following formulas, are there any forward references if the recalculation order is rowwise? Given the following formulas, are there any forward references if the recalculation order is rowwise?

6 Example of forward reference Given the following formulas, are there any forward references if the recalculation order is rowwise? Given the following formulas, are there any forward references if the recalculation order is rowwise? Yes, cell B2 has a forward reference to A3. Yes, cell B2 has a forward reference to A3.

7 Example of forward reference? Given the following formulas, are there any forward references if the recalculation order is columnwise? Given the following formulas, are there any forward references if the recalculation order is columnwise?

8 Example of forward reference? Given the following formulas, are there any forward references if the recalculation order is columnwise? Given the following formulas, are there any forward references if the recalculation order is columnwise? No, the results are No, the results are

9 Dynamic recalculation Modern spreadsheets do not recalculate in any set order. They dynamically determine which cells need to be updated. Modern spreadsheets do not recalculate in any set order. They dynamically determine which cells need to be updated.

10 Circular references A formula that refers to a cell containing a reference to the original cell is called a circular reference. A formula that refers to a cell containing a reference to the original cell is called a circular reference. Circular references can only be resolved by iteration, following the recalculation order. Circular references can only be resolved by iteration, following the recalculation order. Circular references may either converge or diverge, depending on whether they approach a limiting value or not. Circular references may either converge or diverge, depending on whether they approach a limiting value or not.

11 Example of circular references The following cells contain circular references. Are they convergent or divergent? The following cells contain circular references. Are they convergent or divergent?

12 Enabling iterations If we enter these formulas into cells A1 and B1, the program will give an error message If we enter these formulas into cells A1 and B1, the program will give an error message In order to use a spreadsheet with circular references, we need to set the program to use iterations to attempt to resolve the references. In order to use a spreadsheet with circular references, we need to set the program to use iterations to attempt to resolve the references.

13 Enabling iterations For Excel, select Options... from Tools and select the Calculation tab. The default settings should be shown. For Excel, select Options... from Tools and select the Calculation tab. The default settings should be shown.

14 Enabling iterations Check the Iteration box and leave the default of 100 for Maximum Iterations. Note that calculation options are saved along with the spreadsheet and set when loading a spreadsheet IF IT IS THE FIRST ONE LOADED. Check the Iteration box and leave the default of 100 for Maximum Iterations. Note that calculation options are saved along with the spreadsheet and set when loading a spreadsheet IF IT IS THE FIRST ONE LOADED. The program should begin calculating values, ending with a number very close to 1 in cell A1 and a number very close to 2 in cell B1. The program should begin calculating values, ending with a number very close to 1 in cell A1 and a number very close to 2 in cell B1.

15 Convergent circular references Here is a graph of the values in the cells versus iteration number. Here is a graph of the values in the cells versus iteration number.

16 Another example Are the following circular references convergent or divergent? Are the following circular references convergent or divergent?

17 Divergent circular references Here is a graph of the values in the cells versus iteration number. Here is a graph of the values in the cells versus iteration number.

18 Self references and initial values Cells can make circular references to themselves (called self references). Cells can make circular references to themselves (called self references). Excel assumes a value of zero for a cell before the first iteration of a self reference (or a circular reference to a cell that has not yet been evaluated). Excel assumes a value of zero for a cell before the first iteration of a self reference (or a circular reference to a cell that has not yet been evaluated). Thus, entering =A1+1 into cell A1 will result in the value 100 (assuming maximum iterations is set to 100). Thus, entering =A1+1 into cell A1 will result in the value 100 (assuming maximum iterations is set to 100).

19 Using manual recalculation for circular references In a complicated model involving circular references, it is often useful to turn off automatic recalculation so that you can control when recalculation is done (e.g., after all formulas have been entered). Recalculation can be initiated using  =. In a complicated model involving circular references, it is often useful to turn off automatic recalculation so that you can control when recalculation is done (e.g., after all formulas have been entered). Recalculation can be initiated using  =.

20 Summary: Recalculation Recalculation Timing Recalculation Timing  Automatic or Manual Recalculation Order Recalculation Order  Columnwise, Rowwise or Dynamic Circular References Circular References  Resolved by iteration  Convergent or divergent

21 Goal Seek Varies one cell in order to have another cell reach a particular value Varies one cell in order to have another cell reach a particular value Uses a non-linear fitting method with empirical derivatives Uses a non-linear fitting method with empirical derivatives

22 Lookup Functions HLOOKUP HLOOKUP VLOOKUP VLOOKUP

23 Basic Spreadsheet Functions (Demonstration D1) (Demonstration D1) (Exercise C1) (Exercise C1)


Download ppt "Computational Biology, Part 13 Spreadsheet Basics II Robert F. Murphy Copyright  1996, 1999, 2000, 2001. All rights reserved."

Similar presentations


Ads by Google