Homework #5

# 1. Numerical Integration

## 1.1. Tile Size

Suppose that you want to estimate the area of room by laying down tiles.

• What is an advantage of using small tiles to estimate the area?
• What is an advantage of using big tiles to estimate the area?

## 1.2. Rectangle motivation

When we are estimating area using a computer, we add up the area of rectangles instead of the area of a bunch of tiles (squares) or triangles. Why?

## 1.3. Algorithm for splitting rectangles

The image below shows how a student doubled the number of rectangles used to estimate the area in the blue box. They just drew a line through the middle of each rectangle.

1. Why is this approach not useful?
2. Suggest a better algorithm for doubling the number of rectangles.

## 1.4. Numerical Integration

 Estimate the area of the blue shape using 5 vertical rectangles. Draw the rectangles and show your calculations. State the algorithm that you used to determine the height of each rectangle. (Left, Middle, or Right) Did your algorithm lead to an over- or under-estimate of the area? If 10 rectangles are used How many more calculations are required to estimate the area? Will the answer be closer to the analytic value of the area?

## 1.5. Numerical Integration

 Estimate the area of the blue shape using 4 vertical rectangles. Draw the rectangles and show your calculations. State the algorithm that you used to determine the height of each rectangle. Did your algorithm lead to an over- or under-estimate of the area? If twice as many rectangles are used How many more calculations are required to estimate the area? Will the answer be closer to the analytic value of the area?

## 1.6. Numerical Integration

In this problem, we are given an equation that represents the height so we can compute the area by hand calculations and by iteration.

Compute the area between the lines y=0, x=3, and y=x2 using rectangles of width 1. Use this graph paper and let 1 unit be the width of a square.

Repeat the above using rectangles of width 1/2 of a square.

Write down your rule for selecting the heights of the rectangles in 1. and 2. What would an advantage be of having a simple rule or a rule that is the same for all rectangles as opposed to a rule that depends on x?

Write a program without a for to compute the area using w=1.

Re-write the program with a for loop.

Answer the last two questions using w = 0.5.

## 1.7. Numerical Integration

The following program is used to estimate the area under the curve y = x2/4 between x = 0 and x = 5:

A = 0;
for i = [1:5]
A = A+ (i)^2/4;
end


Sketch the curve and the rectangles that correspond to the program above. Label the height of each rectangle.

# 2. Computational Simulations

## 2.1. Logistic Map in Octave

• Write an Octave program that reproduces the four figures shown on the Google Spreadsheet shown in class on this spreadsheet [1]. You may want to refer back to Introduction_To_Octave for information on creating plots.
• Describe in 3-10 sentences what happens as r is increased above 3.5. The idea is to give a "science description" of the observation. That is, explain what you observe in the same way that you would when trying explain a painting to someone over the phone - the person on the other end should have a fairly good idea of what the main features of the painting are.

Extra Credit

# 3. Validation

## 3.1. Neuron Model

In the above, we gave a procedure for validating a model. In reality, these steps are rarely explicitly presented, and sometimes steps are left out.

In the paper "Simple Model of Spiking Neurons" by Izhikevich (pdf), simulation results from a model are presented and the author argues that the model reproduces the spiking and bursting observed in cortical neurons. You are not expected to understand many of the science or computational details given in this work. However, you should be able to answer the following basic questions that should be specified in any description of the results from a computational simulation:

1. What was the mathematical model?
2. Was the computational model given?
3. What are the model's adjustable parameters?
4. Write out any sentences in the paper that you feel are related to validation.

## 3.2. Dog Shaking Frequency Model

Read this "Physicists Discover Universal "Wet-Dog Shake" Rule - How fast should a wet dog rotate its body to dry its fur?" [2]

• What was the science/conceptual model for how fast a dog shakes?
• What was the mathematical model for how fast a dog shakes?
• How was the mathematical model validated?
• How could a computational model be used to figure out the reason the mathematical model did not match the data?

## 3.3. Validation in the Wild

In one of your science courses, you have worked with a science model. In the description of the model, was there any discussion of how it was validated? If you can't find a discussion there, do some searching on the web.

Write two or three sentences that describe the model and how the model was validated. If you could not find any discussion of validation, describe the research that you did in an attempt to find a model with a discussion of validation.

• Read the two papers (pdf | pdf) (only read the first two pages of each and the conclusions of the neuron paper, you can skim the rest)
• You are not expected to understand many of the science or computational details given in this work. However, you should be able to answer the following basic questions that should be specified in any description of the results from a computational simulation and be prepared to discuss:
• What is the conceptual/science model?
• What is the mathematical model?
• What is the computational model?
• How many adjustable parameters does each model have?
• How was the model verified?
• How was the model validated?
• Suggest your own verification test
• Suggest your own validation test