popcorn: Simulation of stovetop popcorn cooking

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

A fixed number of popcorn kernels are cooked are heated at the same temperature. This simulation returns the number of kernels that are edible when the pot is left on the stove for a given number of T seconds.

Usage

1
popcorn(T=120)

Arguments

T

the number of seconds that the pot is left on the stove. The default amount, if not provided, is 120 seconds.

Details

This function simulates the number of edible popcorn kernels that are made when cooking a fixed number of kernels at the same heat setting for a given amount of T seconds.
Time durations less than 77 seconds are not supported. A vector (list) of time values is not permitted, since the goal is to perform sequential experimentation to determine the optimum time, with the fewest number of function calls.

Value

Returns the number of edible popcorn kernels. Random noise is added for some realism.

Author(s)

Kevin Dunn, <kgdunn@gmail.com>

References

Please see Chapter 5 of the following book: Kevin Dunn, 2010 to 2019, Process Improvement using Data, https://learnche.org/pid

See Also

grocery, manufacture

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Cooking for a very short duration is not supported.
# For example, popcorn(T=50) will fail

# Cooking from 77 seconds onwards is supported
popcorn(T=120)

# What happens if we leave the pot on the stove for too long?
popcorn(T=500)

# Can you find the optimum time to cook on the stove
# using the fewest number of function calls?

Example output

[1] 75
[1] 0

pid documentation built on May 2, 2019, 2:22 a.m.