A Core Course on Modeling

1 / 32

# A Core Course on Modeling - PowerPoint PPT Presentation

A Core Course on Modeling. Week 4-The Function of Functions.      Contents     . What is a Formal Model? A Practical Route to Formal Models Example 1: The Detergent Problem Example 2: The Chimney Sweepers Problem Example 3: The Peanut Butter Problem The relation wizard

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'A Core Course on Modeling' - damia

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
A Core Course on Modeling

Week 4-The Function of Functions

   Contents    

• What is a Formal Model?
• A Practical Route to Formal Models
• Example 1: The Detergent Problem
• Example 2: The Chimney Sweepers Problem
• Example 3: The Peanut Butter Problem
• The relation wizard
• The function selector
• Summary
• References to lecture notes + book
• References to quiz-questions and homework assignments (lecture notes)
A Core Course on Modeling

Week 4-The Function of Functions

   What is a Formal Model?    

2

What is the meaning of + ?

resistors: Rtot = 1/(1/R1 + 1/R2)

springs: Ctot = C1 + C2

resistors: Rtot = R1 + R2

springs: Ctot = 1/(1/C1+1/C2)

A Core Course on Modeling

Week 4-The Function of Functions

   What is a Formal Model?    

3

What is the meaning of + ?

Conclusion: there is always a need for interpretation going from relations in ‘real world’ to mathematical relations

There is no simple, generic way to infer mathematical relations from relations in real world

We need a (heuristic) process to do so.

A Core Course on Modeling

Week 4-The Function of Functions

   A Practical Route to Formal Models    

4

Heuristics to arrive at formal expressions:

• meaningful names
• chain of dependencies
• todo-list
• dimensional analysis
• wisdom of the crowds
• two models is better than one model
• when is a model good enough?
• Baron von Münchhausen

In a conceptual model, properties are always part of a concept (‘myCar.wheel.diameter’). In a formal model, properties may be ‘just’ quantities (‘myCarWheelDiameter) with names that may be meaningfully abbreviated (‘mCWhD’).

General scheme: start with the quantitiy needed for your purpose, and try to express this in other quantities

• in the simplest possible form
• with as few as possible assumptions
• such that the quantity is written as function of the other quantities
• continue with the arguments of the function

Everytime when introducing a new quantity, add it to the todo list. When a quantity is expressed into in something known (= a value or another expression), take it off the todo list. When the todo list is empty, model’s first version is ready.

When seeking a mathematical expression,

• if possible, use dimensional considerations to find needed expression …
• … but at least verify expression with dimensional analysis
• … even if this may require inventing units and dimensions.

Often values need guessing. If you can involve a number of people, let them guess independently. This gives (a) a more accurate estimate if there are no systematic errors and (b) an idea of the variation.

Otherwise: try to relate the unknown values to values you (and your friends) may know.

Sometimes, there are two or more routes to (part) of your model. Implement them all, and compare the results. The spread in results is a clue to the reliability of the achievable outcome.

A model is never complete and fully accurate. But, given its purpose, it can be complete and accurate enough. (See chapter 6.) Regularly check if your purpose is met.

Once you have your first version running, you can:

• use it to find out which of the uncertainties of your inputs are the most dominant  try to get these more accurate if necessary
• find out which modifications could be worthwhile
A Core Course on Modeling

Week 4-The Function of Functions

    The Detergent Problem    

5

“What is the total amount of detergent

annually dumped in the

Environment in the Netherlnds?

A Core Course on Modeling

Week 4-The Function of Functions

    The Detergent Problem    

6

relations

dimensions

assumptions

todo

amAnDetDmp =

f(nrAnWshs , detPWsh)

[kg / year] =

F([wash / year] , [kg / wash])

amAnDetDmp

nrAnWshs

detPWsh

Det:detergent; An: annual; Wsh: wash; Fam: family; P: people; am: amount; Dmp: dump

A Core Course on Modeling

Week 4-The Function of Functions

    The Detergent Problem    

7

relations

dimensions

assumptions

todo

amAnDetDmp =

nrAnWshs * detPWsh

[kg / year] =

[wash / year] * [kg / wash]

amAnDetDmp

nrAnWshs

detPWsh

Det:detergent; An: annual; Wsh: wash; Fam: family; P: people; am: amount; Dmp: dump

A Core Course on Modeling

Week 4-The Function of Functions

    The Detergent Problem    

8

relations

dimensions

assumptions

todo

amAnDetDmp =

nrAnWshs * detPWsh

[kg / year] =

[wash / year] * [kg / wash]

Washing laundry is the only way detergent gets into the environment

amAnDetDmp

nrAnWshs

detPWsh

nrAnWshsPFam

nrFamIH

nrPIH

nrPPFam

No institutional laundry washing, only families

nrAnWshs =

nrAnWshsPFam * nrFamIH

[wash / year] =

[wash / (fam *year)] * [fam]

Everybody belongs to exactly one family: families are disjoint

nrFamIH =

nrPIH / nrPPFam

[fam] =

[people] / [people / fam]

todo list is empty  model is ready

common knowledge

nrPIH = 17  0.5 million [people]

public domain

nrPPFam = 2.2  0.2 [people/fam]

nrAnWshsPFam = 100  20 [wash / year]

wisdom of the crowds

detPWsh = 0.17  0.03 [kg / wash]

wisdom of the crowds

Det:detergent; An: annual; Wsh: wash; Fam: family; P: people; am: amount; Dmp: dump

A Core Course on Modeling

Week 4-The Function of Functions

    The Detergent Problem    

9

todo

*

amAnDetDmp

amAnDetDmp

nrAnWshs

detPWsh

nrAnWshsPFam

nrFamIH

nrPIH

nrPPFam

detPWsh

nrAnWshs

*

/

nrFamIH

nrAnWshsPFam

nrPPFam

nrPIH

A Core Course on Modeling

Week 4-The Function of Functions

    The Detergent Problem    

10

todo

*

amAnDetDmp

1.31… million

amAnDetDmp

nrAnWshs

detPWsh

nrAnWshsPFam

nrFamIH

nrPIH

nrPPFam

detPWsh

nrAnWshs

*

0.170.03

772…million

/

7.72 … million

nrFamIH

nrAnWshsPFam

10020

nrPPFam

nrPIH

2.20.2

170.5 million

A Core Course on Modeling

Week 4-The Function of Functions

    The Detergent Problem    

11

This type of model is a ‘thumbnail calculation’:

• OK for quick order of magnitude estimations
• Uses straightforward substitutions, only based on dimension analysis
• Work with intervals to get an impression of the variation of the answers (143  67 M; correct value according to various sites such as http://wiki.watmooi.nl/pages/Wassen_en_onderhoud is 150 M kg)
• Purpose: pub quizzes, trivial pursuit, …

a.k.a. ‘sledgehammer estimation’

A Core Course on Modeling

Week 4-The Function of Functions

    The Detergent Problem    

12

model: outcome = function of inputs

y=f(x1,x2,…)

y=f/x1 x1 + f/x2 x2 + …

So:

|y|=|f/x1| |x1| + |f/x2| |x2| + …

This is a very pessimistic upperbound: all quantities need to conspire to give worst case deviation.

In chapter 6, we will get a more realistic estimate.

A Core Course on Modeling

Week 4-The Function of Functions

   The Chimney Sweepers Problem    

13

“How many chimney sweepers

work in Amsterdam?”

A Core Course on Modeling

Week 4-The Function of Functions

   The Chimney Sweepers Problem    

14

relations

dimensions

assumptions

todo

nrChSwIA =

nrChIA * nrSwPCh

[Sw / A] =

[Ch / A] * [SW / Ch]

Amsterdam ch.-sweepers sweep Amsterdam chimneys only

nrChSwIA

nrChIA

nrSwPCh

nrChPFam

nrFamIA

nrPIA

nrPPFam

ch.-sweepers sweep only chimneys on family houses

nrChIA =

nrChPFam * nrFamIA

[Ch / A] =

[Ch / Fam] * [Fam / A]

nrPPFam is the same everywhere (does not depend on ‘Amsterdam’)

nrFamIA =

nrPIA / nrPPFam

[Fam / A] =

[P / A] / [P / Fam]

common knowledge

nrPIA = 790000 [P]

public domain

nrPPFam = 2.2  0.2 [P/Fam]

nrChPFam (= 1/nrFamPCh) =0.10.02 [Ch/Fam]

wisdom of the crowds

Sw=sweeper; Ch=chimney;A=Amsterdam;Fam=Family;P=people;Se=Service;

To find an expression for nrSwPCh, ask: ‘what links the nr of sweepers to the nr chimneys?’. Answer: sweepers service chimneys. ‘How many services’ (1) relates to the capacity (=available resource) of a sweeper, and (2) to the need of a chimney (=needed resource). Here, ‘resource’=time. The capacity of a sweeper is expressed in the time he works ([Sw*year]); The ‘need’ of a chimney is therefore expressed ([Ch*year]).

A Core Course on Modeling

Week 4-The Function of Functions

   The Chimney Sweepers Problem    

15

Notice: two different units, both with dimension time. To verify that units are consistent, substitute back into expressions for nrSwPSe and nrSwPCh: check that all units multiply and divide to produce the correct final result.

In this case: nrSwPCh=timeP1Se * nrSePCh / timeP1Sw has unit ‘sweeper / chimney’ – which is correct.

relations

dimensions

assumptions

todo

nrSwPCh =

nrSwPSe * nrSePCh

[Sw / Ch] =

[Sw*year/Se] * [Se/(Ch*year)]

Introduce time to associate sweeper’s ca-pacity to chimney’s need

nrChSwIA

nrChIA

nrSwPCh

nrChPFam

nrFamIA

nrPIA

nrPPFam

nrSwPSe

nrSePCh

timeP1Se

timeP1Sw

assume average times (i.e., no season influences etc.)

nrSwPSe =

timeP1Se / timeP1Sw

[Sw * year / Se] =

[hour / Se] / [hour / (Sw*year)]

wisdom of the crowds

timeP1Se = 20.25 hour / Se

work year = 1600 hours

timeP1Sw = 1200100 hour / Sw * year)

insurance requirement

nrSePCh = 1 Se /( Ch * year)

todo list is empty  model is ready

but what does it mean ?  NOTHING, since we formulated no purpose

Sw=sweeper; Ch=chimney;A=Amsterdam;Fam=Family;P=people;Se=Service;

A Core Course on Modeling

Week 4-The Function of Functions

   The Chimney Sweepers Problem    

16

What purposes could we think of:

are there at least 300 Chimney Sweepers so that we can begin a professional journal?

so: we only need to know if NrChSwIA > 300

are there less than 50 Chimney Sweepers so that we can have next year’s ChSw convention meeting in the Restaurant ‘the Swinging Sweeper?’

so: we only need to know if NrChSwIA <50

are there about as many Chimney Sweepers as there are Sewer Cleaners so that we can form efficient ‘Chimney and Sewage Control and Service Units’?

so: we only need to know if NrChSwIA is between 50 and 60…

… each purpose poses different challenges / allows different approximations in our model.

but what does it mean ?  NOTHING, since we formulated no purpose

A Core Course on Modeling

Week 4-The Function of Functions

   The Chimney Sweepers Problem    

17

doing experiments: beyond the scope of modeling

To assess credibility of a model:

• confront with actual measurements
• confront with outcome of a second, independent model
• how much soot and ashes are disposed of by the municipal Ash & Soot Depot?
• how often do you see a chimney sweeper at work (wisdom of the crowds)?
• how much money do people in A. spend annually in cleaning their chimneys?

check out a model for the later case:

(notice: this model is not completely independent from the previous; it uses some common quantities)

A Core Course on Modeling

Week 4-The Function of Functions

   The Chimney Sweepers Problem    

18

Thusfar, all mathematical relations were obtained via dimension analysis.

Dimensions are more generic than just SI dimensions/units.

Dimensional analysis often works for models of a particular form:

y = x1n1 *x2n2 *x3n3 … = i xini,

where (integer) ni can be both larger and smaller than 0.

How to go about when other forms are needed?

PB

A Core Course on Modeling

Week 4-The Function of Functions

    The Peanut Butter Problem    

19

“How to get rich

by selling a new brand

of

peanut butter?”

A Core Course on Modeling

Week 4-The Function of Functions

    The Peanut Butter Problem    

20

relations

dimensions

assumptions

todo

profit

income

expenses

pricePerItem

nrSoldItems

nrSoldTotal

marketShare

profit = income - expenses

[Euro / year] = [Euro/year]

no taxes, no inflation

income =

pricePerItem * nrSoldItems

[Euro / year] =

[Euro/myPB] * [myPB/year]

no discount with larger quantities per purchase

nrSoldItems =

nrSoldTotal * marketShare

[myPB / year] =

[allPB / year] * [myPB/allPB]

my PB will not increase the total market

from a neutral marketing bureau

nrSoldTotal = … [allPB/year]

problems:

• I have a choice for pricePerItem
• marketShare depends on pricePerItem

pricePerItem = …

marketShare = …

1

marketShare

0

pricePerItem

A Core Course on Modeling

Week 4-The Function of Functions

    The Peanut Butter Problem    

21

Approach 1: glass box (glass jar …;-):

?

problems:

• I have a choice for pricePerItem
• marketShare depends on pricePerItem
1

marketShare

0

pricePerItem

A Core Course on Modeling

If something gets more expensive, the chance people will buy it decreases

A market share cannot be <0; it could be >1 but only if it creates additional request

Week 4-The Function of Functions

If something gets sufficiently expensive, nobody will buy it

If something gets sufficiently cheap, every potentially interested customer will buy (or get!) it

It would need a glass box model of customers’ brains to derive this dependency from first principles

    The Peanut Butter Problem    

22

Approach 1: glass box (glass jar …;-):

What mechanism determines marketShare(pricePerItem)?

• monotonically decreasing
• between 0 and 1
• asymptote: marketShare0 if pricePerItem 
• asymptote: marketShare1 if pricePerItem - 
• what sort of mathematical dependency ???

problems:

• I have a choice for pricePerItem
• marketShare depends on pricePerItem
cheapest

competitor

most expensive

competitor

1

marketShare

0

pricePerItem

A Core Course on Modeling

Week 4-The Function of Functions

    The Peanut Butter Problem    

23

Approach 1: glass box (glass jar …;-):

1st guess: straight lines

• uncertain: does this represent the actual behavior?

problems:

• I have a choice for pricePerItem
• marketShare depends on pricePerItem
cheapest

competitor

most expensive

competitor

1

marketShare

0

pricePerItem

A Core Course on Modeling

Week 4-The Function of Functions

Depending on what you are going to DO with the math (e.g., optimisation), smoothness can be important

    The Peanut Butter Problem    

24

Approach 1: glass box (glass jar …;-):

2nd, 3rd guess: arctan, logistic, …?

• what values for the parameters?
• uncertain if this follows the actual behaviour

problems:

• I have a choice for pricePerItem
• marketShare depends on pricePerItem
cheapest

competitor

most expensive

competitor

1

marketShare

0

pricePerItem

A Core Course on Modeling

Week 4-The Function of Functions

    The Peanut Butter Problem    

25

Approach 1: glass box (glass jar …;-):

problems:

• I have a choice for pricePerItem
• marketShare depends on pricePerItem
1

do a smooth curve fit (e.g., splines) that satisfies 0  marketShare 1

marketShare

0

pricePerItem

A Core Course on Modeling

Week 4-The Function of Functions

    The Peanut Butter Problem    

26

Approach 2: black box:

problems:

• I have a choice for pricePerItem
• marketShare depends on pricePerItem
1

do a smooth curve fit (e.g., splines) that satisfies 0  marketShare 1

marketShare

0

pricePerItem

A Core Course on Modeling

Week 4-The Function of Functions

    The Peanut Butter Problem    

27

Approach 2: black box:

problems:

• I have a choice for pricePerItem
• marketShare depends on pricePerItem

but, anyway:

let us assume we have some function:

then the model predicts the income

as function of the pricePerItem.

A Core Course on Modeling

Week 4-The Function of Functions

    The Peanut Butter Problem    

28

Revisit the peanut butter example:

income=pricePerItem * nrSoldItems

nrSoldItems=nrSoldTotal * marketShare

marketShare=f(pricePerItem)

for convenience, introduce abbreviations:

A Core Course on Modeling

Week 4-The Function of Functions

    The Peanut Butter Problem    

29

This is irrelevant if all customers would buy equal amounts of peanutbutter. But: there are mega-consumers and mini-consumers !

Realize that the decision to choose MY peanutbutter is taken by a customer. Suppose that the majority of mega customers would decide against my peanutbutter – then the original model with mSh(pPI) instead of mSh(pPI,i) would give an overestimate  misleading.

So: think about which arguments a function should depend on!

Revisit the peanut butter example:

inc =pPI * nSI (inc=income; pPI=pricePerItem; nSI=nrSoldItems)

nSI = nST * mSh (nST=nrSoldTotal; mSh=marketShare)

mSh=f(pPI)

So: inc = pPI * nST * mSh(pPI)

This is naive: first, realize that nST = i nSTi, i ranges over customers.

So: inc = pPI * mSh(pPI) * i nST(i)

Improved model: inc = pPI * i nST(i) * mSh(pPI, i)

A Core Course on Modeling

Week 4-The Function of Functions

    The Peanut Butter Problem    

30

To go from conceptual model to formal model:

while your purpose is not satisfied:

• put this on the to-do list
• while the todo list is not empty:
• take a quantity from the todo list
• think: what does it depend on?
• if depends on nothing  substitute constant value (perhaps with uncertainty bounds)
• else give an expression for it
• if possible, use dimensional analysis
• propose suitable mathematical expression
• in any case, verify dimensions
• add newly introduced quantities to the todo list
• todo list is empty: evaluate your model
• check if purpose is satisfied; if not, refine your model
function selector

relation wizard

A Core Course on Modeling

Week 4-The Function of Functions

    The Peanut Butter Problem    

31

To go from conceptual model to formal model:

while your purpose is not satisfied:

• put this on the to-do list
• while the todo list is not empty:
• take a quantity from the todo list
• think: what does it depend on?
• if depends on nothing  substitute constant value (perhaps with uncertainty bounds)
• else give an expression for it
• if possible, use dimensional analysis
• propose suitable mathematical expression
• in any case, verify dimensions
• add newly introduced quantities to the todo list
• todo list is empty: evaluate your model
• check if purpose is satisfied; if not, refine your model

logistic function

spline

arctan

asymptote

optimisation

A Core Course on Modeling

Week 4-The Function of Functions

    Summary    

32

• Conceptual model formal model : not in a formally provable correct way;
• Appropriate naming
• Structure
• Chain of dependencies: the formal model as a directed acyclic graph;
• What mechanism?
• What quantitiesdrive this mechanism?
• What is the qualitative behavior of the mechanism?
• What is the mathematical expression to describe this mechanism?
• To-do-list: all intermediate quantities are found and elaborated in turn;
• Formationofmathematical expressions:
• dimensional analysis mathematical expressions, e.g in the case of proportionality
• the Relation Wizardcan help finding appropriate fragments of mathematics;
• the Function Selectorcan help finding an appropriate expression for a desired behavior;
• wisdom of the crowdscan help improve the accuracy of guessed values;