text:
# Hyperlinked list of Shelah's papers: the 000's

Prepared on 2017-09-10

This is only a partial list. The full list is elsewhere.

Sh:1
Shelah, Stable theories -- Israel J Math 7 (1969) 187-202
Sh:2
Shelah, Note on a min-max problem of Leo Moser -- J Combinatorial Theory 6 (1969) 298-300
Sh:3
Shelah, Finite diagrams stable in power -- Annals Math Logic 2 (1970) 69-118
Sh:4
Shelah, On theories $T$ categorical in $|T|$ -- J Symbolic Logic 35 (1970) 73-82
Sh:5
Shelah, On languages with non-homogeneous strings of quantifiers -- Israel J Math 8 (1970) 75-79
Sh:6
Shelah, A note on Hanf numbers -- Pacific J Math 34 (1970) 541-545
Sh:7
Shelah, On the cardinality of ultraproduct of finite sets -- J Symbolic Logic 35 (1970) 83-84
Sh:8
Shelah, Two cardinal compactness -- Israel J Math 9 (1971) 193-198
Sh:9
Shelah, Remark to local definability theory'' of Reyes -- Annals Math Logic 2 (1970) 441-447
Sh:10
Shelah, Stability, the f.c.p., and superstability; model theoretic properties of formulas in first order theory -- Annals Math Logic 3 (1971) 271-362
Sh:11
Shelah, On the number of non-almost isomorphic models of $T$ in a power -- Pacific J Math 36 (1971) 811-818
Sh:12
Shelah, The number of non-isomorphic models of an unstable first-order theory -- Israel J Math 9 (1971) 473-487
Sh:13
Shelah, Every two elementarily equivalent models have isomorphic ultrapowers -- Israel J Math 10 (1971) 224-233
Sh:14
Shelah, Saturation of ultrapowers and Keisler's order -- Annals Math Logic 4 (1972) 75-114
Sh:15
Shelah, Uniqueness and characterization of prime models over sets for totally transcendental first-order theories -- J Symbolic Logic 37 (1972) 107-113
Sh:16
Shelah, A combinatorial problem; stability and order for models and theories in infinitary languages -- Pacific J Math 41 (1972) 247-261
Sh:17
Shelah, For what filters is every reduced product saturated? -- Israel J Math 12 (1972) 23-31
Sh:18
Shelah, On models with power-like orderings -- J Symbolic Logic 37 (1972) 247-267
ErSh:19
Erdos+Shelah, Separability properties of almost-disjoint families of sets -- Israel J Math 12 (1972) 207-214
ScSh:20
Schmerl+Shelah, On power-like models for hyperinaccessible cardinals -- J Symbolic Logic 37 (1972) 531-537
ErSh:21
Erdos+Shelah, On problems of Moser and Hanson -- Graph theory and applications (Proc. Conf., Western Michigan Univ., Kalamazoo, Mich., 1972; dedicated to memory J. W. T. Youngs) (1972) 75--79
Sh:22
Shelah, A note on model complete models and generic models -- Proc American Math Soc 34 (1972) 509-514
GlSh:23
Galvin+Shelah, Some Counterexamples in the Partition Calculus -- J Combinatorial Theory. Ser. A 15 (1973) 167-174
Sh:24
Shelah, First order theory of permutation groups -- Israel J Math 14 (1973) 149-162
Sh:25
Shelah, Errata to: First order theory of permutation groups -- Israel J Math 15 (1973) 437-441
Sh:26
Shelah, Notes on combinatorial set theory -- Israel J Math 14 (1973) 262-277
MoSh:27
Moran+Shelah, Size direction games over the real line. III -- Israel J Math 14 (1973) 442-449
Sh:28
Shelah, There are just four second-order quantifiers -- Israel J Math 15 (1973) 282-300
Sh:29
Shelah, A substitute for Hall's theorem for families with infinite sets -- J Combinatorial Theory. Ser. A 16 (1974) 199-208
MzSh:30
McKenzie+Shelah, The cardinals of simple models for universal theories -- Proc Tarski Symposium (Univ. California, Berkeley, Calif., 1971) (1974) 53--74
Sh:31
Shelah, Categoricity of uncountable theories -- Proc Tarski Symposium (Univ. of California, Berkeley, Calif., 1971) (1974) 187--203
EHSh:32
Erdos+Hajnal+Shelah, On some general properties of chromatic numbers -- Topics in topology (Proc. Colloq., Keszthely, 1972) (1974) 243--255
Sh:33
Shelah, The Hanf number of omitting complete types -- Pacific J Math 50 (1974) 163-168
Sh:34
Shelah, Weak definability in infinitary languages -- J Symbolic Logic 38 (1973) 399-404
MlSh:35
Milner+Shelah, Sufficiency conditions for the existence of transversals -- Canadian J Math Journal Canadien de Mathematiques 26 (1974) 948-961
Sh:36
Shelah, Remarks on cardinal invariants in topology -- General Topology and Applications 7 (1977) 251-259
Sh:37
Shelah, A two-cardinal theorem -- Proc American Math Soc 48 (1975) 207-213
Sh:38
Shelah, Graphs with prescribed asymmetry and minimal number of edges -- Infinite and finite sets (Colloq., Keszthely, 1973; dedicated to P. Erd\H{o}s on his 60th birthday) (1975) 1241--1256
Sh:39
Shelah, Differentially closed fields -- Israel J Math 16 (1973) 314-328
Sh:40
Shelah, Notes on partition calculus -- Infinite and finite sets (Colloq., Keszthely, 1973; dedicated to P. Erd\H{o}s on his 60th birthday) (1975) 1257--1276
MlSh:41
Milner+Shelah, Some theorems on transversals -- Infinite and finite sets (Colloq., Keszthely, 1973; dedicated to P. Erd\H{o}s on his 60th birthday) (1975) 1115--1126
Sh:42
Shelah, The monadic theory of order -- Annals Math 102 (1975) 379-419
Sh:43
Shelah, Generalized quantifiers and compact logic -- Transactions American Math Soc 204 (1975) 342-364
Sh:44
Shelah, Infinite abelian groups, Whitehead problem and some constructions -- Israel J Math 18 (1974) 243-256
Sh:45
Shelah, Existence of rigid-like families of abelian $p$-groups -- Model theory and algebra (A memorial tribute to Abraham Robinson) (1975) 384--402
Sh:46
Shelah, Colouring without triangles and partition relation -- Israel J Math 20 (1975) 1-12
MShS:47
Makowsky+Shelah+Stavi, $\Delta$-logics and generalized quantifiers -- Annals Math Logic 10 (1976) 155-192
Sh:48
Shelah, Categoricity in $\aleph _{1}$ of sentences in $L_{\omega _{1},\omega}(Q)$ -- Israel J Math 20 (1975) 127-148
Sh:49
Shelah, A two-cardinal theorem and a combinatorial theorem -- Proc American Math Soc 62 (1977) 134-136
Sh:50
Shelah, Decomposing uncountable squares to countably many chains -- J Combinatorial Theory. Ser. A 21 (1976) 110-114
Sh:51
Shelah, Why there are many nonisomorphic models for unsuperstable theories -- Proc International Congress of Math (Vancouver, B. C., 1974) (1974) 259--263
Sh:52
Shelah, A compactness theorem for singular cardinals, free algebras, Whitehead problem and transversals -- Israel J Math 21 (1975) 319-349
LtSh:53
Litman+Shelah, Models with few isomorphic expansions -- Israel J Math 28 (1977) 331-338
Sh:54
Shelah, The lazy model-theoretician's guide to stability -- Logique et Analyse 18 (1975) 241-308 see also F632
Sh:54a
Shelah, The lazy model theorist's guide to stability -- Six days model theory (1978) 9-76
McSh:55
Macintyre+Shelah, Uncountable universal locally finite groups -- J Algebra 43 (1976) 168-175
Sh:56
Shelah, Refuting Ehrenfeucht conjecture on rigid models -- Israel J Math 25 (1976) 273-286
AmSh:57
Amit+Shelah, The complete finitely axiomatized theories of order are dense -- Israel J Math 23 (1976) 200-208
Sh:58
Shelah, Decidability of a portion of the predicate calculus -- Israel J Math 28 (1977) 32-44
HiSh:59
Hiller+Shelah, Singular cohomology in $L$ -- Israel J Math 26 (1977) 313-319
HLSh:60
Hodges+Lachlan+Shelah, Possible orderings of an indiscernible sequence -- Bulletin London Math Soc 9 (1977) 212-215
Sh:61
Shelah, Interpreting set theory in the endomorphism semi-group of a free algebra or in a category -- Ann. Sci. Univ. Clermont 13 (1976) 1-29
MwSh:62
Makowsky+Shelah, The theorems of Beth and Craig in abstract model theory. I. The abstract setting -- Transactions American Math Soc 256 (1979) 215-239
SeSh:63
Stern+Shelah, The Hanf number of the first order theory of Banach spaces -- Transactions American Math Soc 244 (1978) 147-171
Sh:64
Shelah, Whitehead groups may be not free, even assuming CH. I -- Israel J Math 28 (1977) 193-204
DvSh:65
Devlin+Shelah, A weak version of $\diamondsuit$ which follows from $2^{\aleph _{0}}<2^{\aleph _{1}}$ -- Israel J Math 29 (1978) 239-247
Sh:66 [abstract]
Shelah, End extensions and numbers of countable models -- J Symbolic Logic 43 (1978) 550-562 see also F1031
Sh:67
Shelah, On the number of minimal models -- J Symbolic Logic 43 (1978) 475-480
Sh:68
Shelah, Jonsson algebras in successor cardinals -- Israel J Math 30 (1978) 57-64
Sh:69
Shelah, On a problem of Kurosh, Jonsson groups, and applications -- Word problems, II (Conf. on Decision Problems in Algebra, Oxford, 1976) (1980) 373--394
GuSh:70
Gurevich+Shelah, Modest theory of short chains. II -- J Symbolic Logic 44 (1979) 491-502
Sh:71
Shelah, A note on cardinal exponentiation -- J Symbolic Logic 45 (1980) 56-66
Sh:72
Shelah, Models with second-order properties. I. Boolean algebras with no definable automorphisms -- Annals Math Logic 14 (1978) 57-72
Sh:73
Shelah, Models with second-order properties. II. Trees with no undefined branches -- Annals Math Logic 14 (1978) 73-87
Sh:74
Shelah, Appendix to: Models with second-order properties. II. Trees with no undefined branches'' (Annals of Mathematical Logic 14(1978), no. 1, 73--87) -- Annals Math Logic 14 (1978) 223-226
Sh:75
Shelah, A Banach space with few operators -- Israel J Math 30 (1978) 181-191
Sh:76
Shelah, Independence of strong partition relation for small cardinals, and the free-subset problem -- J Symbolic Logic 45 (1980) 505-509
Sh:77
Shelah, Existentially-closed groups in $\aleph _{1}$ with special properties -- Bulletin de la Soc Math de Grece. Nouvelle Serie 18 (1977) 17-27
Sh:78
Shelah, Hanf number of omitting type for simple first-order theories -- J Symbolic Logic 44 (1979) 319-324
Sh:79
Shelah, On uniqueness of prime models -- J Symbolic Logic 44 (1979) 215-220
Sh:80
Shelah, A weak generalization of MA to higher cardinals -- Israel J Math 30 (1978) 297-306
Avraham (Abraham)+Devlin+Shelah, The consistency with CH of some consequences of Martin's axiom plus $2^{\aleph _{0}}>\aleph _{1}$ -- Israel J Math 31 (1978) 19-33
Sh:82
Shelah, Models with second order properties. III. Omitting types for $L(Q)$ -- Archiv fur Math Logik und Grundlagenforschung 21 (1981) 1-11
GgSh:83
Giorgetta+Shelah, Existentially closed structures in the power of the continuum -- Annals Pure and Applied Logic 26 (1984) 123-148
RuSh:84
Rubin+Shelah, On the elementary equivalence of automorphism groups of Boolean algebras; downward Skolem-Lowenheim theorems and compactness of related quantifiers -- J Symbolic Logic 45 (1980) 265-283
DvSh:85
Devlin+Shelah, A note on the normal Moore space conjecture -- Canadian J Math Journal Canadien de Mathematiques 31 (1979) 241-251
DvSh:86
Devlin+Shelah, Souslin properties and tree topologies -- Proc London Math Soc Third Series 39 (1979) 237-252
Sh:87
Shelah, See [Sh:87a] and [Sh:87b]
Sh:87a
Shelah, Classification theory for nonelementary classes, I. The number of uncountable models of $\psi \in L_{\omega _{1},\omega }$. Part A -- Israel J Math 46 (1983) 212-240
Sh:87b
Shelah, Classification theory for nonelementary classes, I. The number of uncountable models of $\psi \in L_{\omega _{1},\omega }$. Part B -- Israel J Math 46 (1983) 241-273
Sh:88
Shelah, Classification of nonelementary classes. II. Abstract elementary classes -- Classification theory (Chicago, IL, 1985) (1987) 419--497 see also 88r
Sh:88a
Shelah, Appendix: on stationary sets (in Classification of nonelementary classes. II. Abstract elementary classes'') -- Classification theory (Chicago, IL, 1985) (1987) 483--495
Sh:88r 2015-01-23 [pdf] [ps] [abstract] [arXiv:0705.4137]
Shelah, Abstract elementary classes near $\aleph_1$
Sh:89
Shelah, Boolean algebras with few endomorphisms -- Proc American Math Soc 74 (1979) 135-142
Sh:90
Shelah, Remarks on $\lambda$-collectionwise Hausdorff spaces -- Topology Proc 2 (1977) 583-592
HHSh:91
Hiller+Huber+Shelah, The structure of ${\rm Ext}(A, {\bf Z})$ and $V=L$ -- Math Zeitschrift 162 (1978) 39-50
Sh:92
Shelah, Remarks on Boolean algebras -- Algebra Universalis 11 (1980) 77-89
Sh:93
Shelah, Simple unstable theories -- Annals Math Logic 19 (1980) 177-203
Sh:94
Shelah, Weakly compact cardinals: a combinatorial proof -- J Symbolic Logic 44 (1979) 559-562
Sh:95
Shelah, Canonization theorems and applications -- J Symbolic Logic 46 (1981) 345-353
ShZi:96 [arXiv:arXiv]
Shelah+Ziegler, Algebraically closed groups of large cardinality -- J Symbolic Logic 44 (1979) 522-532
ShRd:97
Shelah+Rudin, Unordered types of ultrafilters -- Topology Proc 3 (1979) 199-204
Sh:98
Shelah, Whitehead groups may not be free, even assuming CH. II -- Israel J Math 35 (1980) 257-285
HrSh:99
Harrington+Shelah, Some exact equiconsistency results in set theory -- Notre Dame J Formal Logic 26 (1985) 178-188
1-99 100-199 200-299 300-399 400-499 500-599 600-699 700-799 800-899 900-999 1000-

Back to Shelah's Archive


text:
# Why is the output of my limit expression an interval?

Why is the output of the limit below an interval? It should be precisely $1$.

Limit[(2/Pi) ((2 n + 2)!!/(2 n + 1)!!) Integrate[(1 - x^2)^(n + 1/2), {x, 0, 1}],
n -> Infinity]
-

You have made an assumption without telling Mathematica about it. Namely, that $n$ is an integer. You can add this assumption like so:

format: plain


text:
# Starting with MUDIM

The second part of this text is devoted to the synoptic description of MUDIM, which is a system for handling with probabilistic multi-dimensional distributions in the form of compositional models. The MUDIM (MUlti-DImensional Models) system is written as a package of R . It is based on R.oo package that implements methods and functions for object-oriented programming in R. It contains a set of functions to construct and support discrete probability distribution. Two or more probability distributions can be composed together - to create the so-called compositional model. The package contains a set of functions to support work with compositional models.

In the following text, we will speak about probability distributions and compositional models. Probability distributions are defined over random variables. Similarly, some objects in R are usually called variables. E.g. having a probability distribution $$Pi$$ over finite discrete variables $$A,B$$, it can be also stored in R using mudim object od class Distribution(). The object is stored in computer memory and it can be referenced by R variable Pi that is nothing else that a pointer to that object - a pointer to the specific place in computer memory.

## Install R

R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and Mac-OS. To download and install R, please go to R project website https://www.r-project.org/ and download the latest version based on your operating system.

To work with our package, we strongly recommend using RStudio , which is a free and open-source integrated development environment for R, a programming language for statistical computing and graphics. To install RStudio, please go to the project website https://www.rstudio.com/ and download the latest version of the product.

## Install MUDIM

Once R and RStudio are installed, you can proceed and install mudim. To do so, start RStudio and type the following command in the console.

install.packages("http://gogo.utia.cas.cz/mudim_0.1.0.tar.gz",
repos = NULL)

Once the package is installed, you can easily load it to make all its functionality available. To load the package, type:

library(mudim)

# Probability distribution

mudim package works with discrete random variables with finitely many values. By a state of a group of variables, we understand a combination of values of the respective variables. Recall Example 1.2 about three coins where the first two are randomly tossed and the third one is laid on a table in the way that the number of ‘$$1$$’ is odd. Probability distribution fully describing such an experiment can be defined as a table - see Table 1.1. A possible representation of this distribution in mudim package is as follows. It appears in the console when you type

data(coins)
dTable(coins)
##    X Y Z MUDIM.frequency
## 1: 0 0 1            0.25
## 2: 0 1 0            0.25
## 3: 1 0 0            0.25
## 4: 1 1 1            0.25

You can see that columns of the table, except for the last one, correspond to random variables. Rows correspond to various states of random variables. In this case, the three first columns of the table correspond to random variables $$\{X,Y,Z\}$$. The last column is rather special. It denotes the frequency/probability of each row - state of the variables. It is denoted as MUDIM.frequency - it is a keyword and no random variable should be called by this name. The states with zero probability may be omitted.

## R object

When creating a probability distribution, it is good to start with an empty distribution - i.e. a probability distribution defined for an empty set of variables. In R, even an empty distribution is an object of class Distribution.

d <- Distribution("test", info = "my first distribution")

By performing the above command, you have created an empty distribution referenced by d in R. It has a name “test” and additional information “my first distribution” for internal purposes. The parameter info in Distribution() function is auxiliary.

Each object of class Distribution has several slots. In case of a distribution referenced by d the slots look like this:

• name - "test"
• info - "my first distribution"
• data - NULL
• variables - NULL
• dim - 0

Of course, in case of distribution coins, the slots look like this

• name - "3coin"
• info - "3 coins X,Y,Z. X and Y are randomly tossed and the third one is laid on the table in the way that the number of 1 is odd"
• data - This slot contains a 4x4 matrix (the rows corresponding to states, three columns corresponding to variables and the fourth one containing the probabilities) - accessible using command dTable(coins)
• variables - "X" "Y" "Z" - accessible using command variables(coins)
• dim - 3 - accessible using command dim(coins)

To read more about the internal structure of the Distribution class object, type ?Distribution in the console of your RStudio.

### Probability table

Generally, probability tables and probability distributions are used as synonyms. The probability table is represented by a mudim object of class Distribution. To create a probability distribution over a set of random variables, you should design its defining table first. This can be done either manually or you can use some external data/measurements. To check, whether a distribution is empty, you can use functions is.empty() or dim():

is.empty(d)
## [1] TRUE
# number of dimensions of the probability distribution
# i.e. number of random variables the distribution is defined
# for
dim(d)
## [1] 0

#### Create manually

Let us try to create manually a table that would describe 3-coin example mentioned above. We have three random variables $$X,Y,Z$$. To describe their possible states, use the following code:

# X and Y are binary, all combinations are allowed
table <- expand.grid(X=c(0,1), Y=c(0,1))
# Z is defined by X and Y
table[,"Z"] <- apply(table, 1, function(x) {
return((sum(x)+1) %% 2)})
# print the table
table
##   X Y Z
## 1 0 0 1
## 2 1 0 0
## 3 0 1 0
## 4 1 1 1

Now, we have all possible outcomes of the 3 coins example as illustrated by distribution coins. Because we want to create a uniform distribution over the possible outcomes, we can either add a new column denoted by MUDIM.frequency with respective probabilities or we can let the system do it automatically. When you assign a probability table without a column named MUDIM.frequency, mudim automatically assumes that each row of the given table has the same probability and adds the frequency column with weight $$1$$ for each row. Because each row is unique, the resulting distribution is uniform over the possible outcomes.

# assign the table to an empty distribution referenced by d
dTable(d) <- table
# show the table
dTable(d)
##    X Y Z MUDIM.frequency
## 1: 0 0 1               1
## 2: 1 0 0               1
## 3: 0 1 0               1
## 4: 1 1 1               1

Note that MUDIM.frequency column denotes frequencies, not probabilities. To change that, call normalize(d).

We can add the frequency column to table by ourselves. To do that, add a column called MUDIM.frequency, continue as above, and then e.g. normalize it:

table[,"MUDIM.frequency"] <- c(1,3,4,2)
dTable(d) <- table
normalize(d)
dTable(d)
##    X Y Z MUDIM.frequency
## 1: 0 0 1             0.1
## 2: 1 0 0             0.3
## 3: 0 1 0             0.4
## 4: 1 1 1             0.2

#### Use data

Another possibility is to create a probability distribution from data. The data can have their origin from various sources. The easiest way how to load data to R environment is using a CSV (comma separated) file. For illustration, we have prepared a data-set X defined over seven variables $$D,N,R,T,W,U,B$$. Similarly, you can load a data set from an external CSV file using functions read.csv or read.csv2 etc. When creating a respective distribution over a subset of variables, one can use function dTable as well. As mentioned above, when assigning a new table to distribution using function dTable, if column MUDIM.frequency is missing, equal weights are assigned to all rows. I.e., if rows are not unique, but one of them is repeated several times, then the weights sum up appropriately. When calling dTable function, unique rows are stored and MUDIM.frequency column denotes the numbers of appearances in the source file.

# load the dataset - it is referenced by variable X
data(X)

# show the first few rows of the dataset
head(X)
##   D N R T W U B
## 1 1 2 1 2 2 1 1
## 2 1 2 1 1 2 1 1
## 3 2 2 1 1 2 1 1
## 4 2 2 1 2 2 2 2
## 5 2 2 2 1 2 2 2
## 6 2 2 1 1 2 1 1
# create an empty distribution with appropriate comments
dNRT <- Distribution("XNRT", info =
"Distribution from data-set X defined over variables N,R,T")
# and load the data into it
dTable(dNRT) <- X[,c("N", "R", "T")]
dTable(dNRT)
##    N R T MUDIM.frequency
## 1: 2 1 2             143
## 2: 2 1 1             250
## 3: 2 2 1             175
## 4: 1 2 2             207
## 5: 1 2 1             131
## 6: 1 1 2              34
## 7: 2 2 2              50
## 8: 1 1 1              10
# in case of need, normalize the frequency column to
# probabilities
normalize(dNRT)
dTable(dNRT)
##    N R T MUDIM.frequency
## 1: 2 1 2           0.143
## 2: 2 1 1           0.250
## 3: 2 2 1           0.175
## 4: 1 2 2           0.207
## 5: 1 2 1           0.131
## 6: 1 1 2           0.034
## 7: 2 2 2           0.050
## 8: 1 1 1           0.010

### Names of random variables

Each distribution is defined over a set of random variables. Each variable is supposed to have a unique name. If two random variables have the same name, we consider them to be the same variable. The names can be set in two ways. Using column names of the probability table used in dTable function, or using function variables.

# read names of the variables the respective distribution
# is defined for
variables(dNRT)
## [1] "N" "R" "T"
# change the names
variables(dNRT) <- c("A","B","C")
# respective table is changed as well
head(dTable(dNRT))
##    A B C MUDIM.frequency
## 1: 2 1 2           0.143
## 2: 2 1 1           0.250
## 3: 2 2 1           0.175
## 4: 1 2 2           0.207
## 5: 1 2 1           0.131
## 6: 1 1 2           0.034
table <- dTable(dNRT)
# changing the names of the columns - except the last one
colnames(table)[-ncol(table)] <- c("x","y","z")
# set the table to the distribution
dTable(dNRT) <- table

variables(dNRT)
## [1] "x" "y" "z"

As mentioned above, each probability distribution in mudim is an object in computer memory. Such an object can have many R variables pointing at it. To simplify distribution identification, each object of class Distribution can have a name and info parameter. To handle these parameters, use functions name and info

# load demo Distribution Pi
data(Pi)

# read and write name parameter of a distribution object
name(Pi)
## [1] "pi"
name(Pi) <- "distribution 123"
name(Pi)
## [1] "distribution 123"
# read and write info parameter of a distribution object
info(Pi) <-
"probability distribution over two binary variables A,B"
info(Pi)
## [1] "probability distribution over two binary variables A,B"

## Manipulations with probability distributions

### Marginal distribution

A probability distribution is defined over a certain set of variables. Sometimes, we are interested in a probability distribution defined over just a subset of them. As defined in Section 1.1, the probability distribution over the subset is known as the marginal probability distribution.

To compute a marginal distribution, specify the distribution and a subset of variables of interest.

PiMarginal <- marginalize(Pi, variables = variables(Pi)[1])
variables(PiMarginal)
## [1] "A"

Sometimes, you want to remove a set of variables from the distribution. To do that, you can easily use parameter keep

PiMarginal <- marginalize(Pi,
variables = variables(Pi)[1],
keep = FALSE)
variables(PiMarginal)
## [1] "B"

If you want to change the probability distribution without making its copy, you can use parameter new

variables(Pi)
## [1] "A" "B"
marginalize(Pi, variables = variables(Pi)[1], new = FALSE )
## Probability distribution
## * Name:distribution 123
## * Info:probability distribution over two binary variables A,B
## * Variables:A
## * Non-empty items:2
## NULL
variables(Pi)
## [1] "A"

### Product

Let us have two probability distribution $$\pi(K)$$ and $$\kappa(L)$$. Then we can define their product as $$\lambda(K \cup L)$$ such that $$\lambda(x) = \pi(x^{\downarrow K}) * \kappa(x^{\downarrow L})$$ for each $$x \in \mathbb{X}_{K\cup L}$$. Please, note that in case of $$K \cap L \neq \emptyset$$ the resulting object does not have to be a probability distribution.

Lambda <- multiply(Pi, Kappa)
# similarly, you can write
Lambda <- Pi * Kappa

### Composition

The key operator of the package is the operator of composition $$\triangleright$$ defined in Definition 2.1. Consider two probability distributions $$\kappa(\mathbf{K})$$ and $$\lambda(\mathbf{L})$$, for which all the compositions appearing in the following statements are defined. The most important properties of the operator are:

• (Domain) $$\kappa \triangleright \lambda$$ is a probability distribution for variables $$\mathbf{K} \cup \mathbf{L}$$.
• (Conditional independence): $$\mathbf{K} \setminus \mathbf{L} \ind \mathbf{L} \setminus \mathbf{K} | \mathbf{K} \cap \mathbf{L}\ [\kappa \triangleright \lambda]$$.
• (Composition preserves first marginal): $$(\kappa \triangleright \lambda)^{\downarrow \mathbf{K}} = \kappa$$.

To compose two distributions, use function compose

PiKappa <- compose(Pi, Kappa)
# the result is a probability distribution
class(PiKappa)
## [1] "Distribution" "Object"
# defined over the union of variables of the input
# distributions
variables(PiKappa)
## [1] "A" "B" "C"
# and the operator preserves the first marginal
KL.divergence(Pi, marginalize(PiKappa,
variables = variables(Pi)))
## [1] 0
# and does not generally preserves the second marginal
KL.divergence(Kappa, marginalize(PiKappa,
variables = variables(Kappa)))
## [1] 0

Note that function compose is generic. It means that you can have more functions with the same name and the compiler choose the function based on the context – more specifically, based on the class of the function parameters. In this case, if the first parameter is of class ‘Distribution’ then a function corresponding to the operator of composition is called and the result is of class ‘Distribution’. On the other hand, if the first parameter is of class ‘Model’, then another function is called and the result is different.

### Anticipating operator

The so-called anticipating composition of two probability distribution is a generalized version of the operator of composition, for which the following property holds: If $$\kappa(\mathbf{K})$$, $$\lambda(\mathbf{L})$$ and $$\mu(\mathbf{M})$$ are such that $$\mu \triangleright (\kappa \cirtr_{\mathbf{M}} \lambda)$$ is defined, then $(\mu \triangleright \kappa) \triangleright \lambda = \mu \triangleright (\kappa \cirtr_{\mathbf{M}} \lambda).$ For details see Section 2.2.

d <- anticipate(Pi, Kappa, M = c("A","B","C", "D"))
dTable(d)
##    B C A MUDIM.frequency
## 1: 0 0 0            0.15
## 2: 0 0 1            0.35
## 3: 0 1 0            0.15
## 4: 0 1 1            0.35

## Information-theoretic notions

Package ‘mudim’ allows us to compute the most important information-theoretic characteristics of probability distributions described in Section 1.4. Recall that these characteristics are important for the construction of compositional models. Fro their meaning and application to model construction see Section 1.4 and, mainly, Chapter 6.

### Shannon entropy

Shannon entropy can be used to quantify the amount of uncertainty in an entire probability distribution

entropy(Pi, base = 2)
## [1] 0.8812909

In other words, the Shannon entropy of a distribution is the expected amount of information in an event drawn from that distribution. It gives a lower bound on the number of bits (if the logarithm is base 2, otherwise the units are different) needed on average to encode symbols drawn from a given distribution.

Recall that the entropy of nearly deterministic distributions (where the outcome is almost certain) is close to zero; distributions that are close to uniform have high entropy.

### Kullback-Leibler divergence

Having two probability distributions $$\pi$$ and $$\kappa$$ over the same set of random variables, we can measurethe difference between these two distributions using the Kullback-Leibler (KL) divergence:

data(Pi); data(Kappa);
variables(Kappa) <- variables(Pi)
KL.divergence(Kappa, Pi)
## [1] 1.821928
KL.divergence(Pi, Kappa)
## Warning in KL.divergence.Distribution(Pi, Kappa):
absolute continuity of
## input distributions not satisfied
## [1] Inf
# in case of different sets of random variables,
# the KL divergence cannot be computed
data(Kappa)
KL.divergence(Pi, Kappa)
## Error in KL.divergence.Distribution(Pi, Kappa): Unable
to compute KL divergence for distributions over different
sets variables.

Recall that the KL divergence defined in Section 1.4 has many useful properties:

• It is non-negative.
• It is 0 if and only if $$\pi$$ and $$\kappa$$ are the same distribution in the case of discrete variables (or equal almost everywhere in the case of continuous variables).

Recall also that the compared distributions must be defined for the same set of variables, and if distribution $$\nu$$ does not dominate $$\pi$$, then $$Div(\pi \shortparallel \nu) = + \infty$$. Therefore, if the user tries to compute a divergence between two distributions that are defined for different variables, the function will stop and return an error message. Analogously, if the distribution in the second argument does not dominate the distribution in the first argument, the function return $$+\infty$$ and show a warning message.

### Mutual information

Mutual information (MI) (also known as the information gain) of two disjoint sets of random variables is a measure of the mutual dependence between the two groups of variables. More specifically, it quantifies the “amount of information” obtained about one set of variables through observing the other set of variables; for more properties see Section1.4.

The higher the value, the stronger dependence exists between the considered two disjoint sets of variables.

data(coins)
MI(coins, K = "X", L = "Y")
## [1] 0
MI(coins, K = c("X","Y"), L = "Z")
## [1] 1

In case that the user tries to compute the mutual information between non-disjoint groups of variables, then function will stop and return an error message.

### Conditional mutual information

Analogously to mutual information, one can compute also conditional mutual information. More precisely, for three disjoint groups of variables, and a corresponding probability distribution one can compute conditional mutual information (see Section 1.4). As an example we can take Example 1.2 with three coins. In this case, of course, variables $$X$$ and $$Y$$ are conditionaly dependent by $$Z$$. Note that if one puts M = c() then the function coincides with MI().

data(coins)
conditionalMI(coins, K = "X", L = "Y", M = "Z")
## [1] 2

### Multi-information

Multi-information, sometimes called also dependence tightness, total correlation, or informational content (IC) is a relative entropy of a distribution concerning the product of its one-dimensional marginals. Simply, it expresses the loss when substituting a distribution by a product of its one-dimensional marginals.

IC(Pi)
## [1] 0.005802149

### Conditional multiinformation

Analogously to multi-information, one can compute also conditional multi-information. More precisely, for three disjoint groups of variables, and a corresponding probability distribution one can compute conditional mutual information (see Section 1.4).

conditionalIC(Pi, cond = "A", base = 2)
## [1] -0.8812909

# Compositional model

The main purpose of mudim is to enable the users comfortable handling multidimensional compositional models, i.e., multidimensional probability distributions assembled from sequences of low-dimensional distributions using the operator of composition. The result of the composition (if defined) is a new distribution. We can iteratively repeat the process of composition to obtain a multidimensional distribution. That is why such a multidimensional distribution can be called a compositional model.

For the purpose of model processing, we will understand by a compositional model the sequence of low-dimensional distribution. Assume a system of $$n$$ probability distributions $$\pi_1, \pi_2, \ldots, \pi_n$$ defined over sets of variables $$K_1, K_2, \ldots, K_n$$, respectively. Thus, in agreement with Chapter 3 the formula $$\pi_1 \triangleright \pi_2 \triangleright \ldots \triangleright \pi_n$$, is understood as $\pi_1 \triangleright \pi_2 \triangleright \pi_3 \triangleright \ldots \triangleright \pi_n = (((\pi_1 \triangleright \pi_2) \triangleright \pi_3) \ldots \triangleright \pi_n)$

To construct such a model it is sufficient to determine a sequence of low-dimensional distributions $$\pi_1, \pi_2, \ldots , \pi_n$$ (sometimes called a generating sequence). Note that there are situations in which the result of the composition is not defined. To be able to store a compositional model of dozens or hundreds of variables, a compositional model is kept using its generating sequence in the computer memory. This, on the other side, brings some troubles when making elementary operations like marginalization, conditioning, etc.

## R Object

To start creating your compositional model, it is good to start with creating an empty model - i.e. a compositional model whose generating sequence is empty. Doing this, you create an object of class Model.

m <- Model("test", info = "my first compositional model")
class(m)
## [1] "Model"  "Object"

By doing this, you have created an empty compositional model referenced by variable m in R. It has a name “test” and additional information “my first compositional model” for internal purposes. The parameter info in Model() function is auxiliary.

Each object of class Model has several slots. In case of a compositional model referenced by m the slots look like this:

• name - "test"
• info - "my first compositional model"
• distributions - list()
• variables - list()
• length - 0
• dim - 0
• perfect - FALSE

To read more about the internal structure of the Model class object, type ?Model in the console of your RStudio.

## Insert distribution

To insert a probability distribution into the generating sequence of a compositional model, we can use functions insert or compose.

# creat a compositional model whose generating
# sequence has two distributions
insert(model = m, distribution = Pi)
insert(model = m, distribution = Kappa, position = 2)

Similarly, you can access an arbitrary distribution in a compositional model by calling function getDistribution() that has three parameters

• model respective compositional model
• k index of the required distribution in the generating sequence
• ref: logical. If TRUE then a reference is returned and by changing respective probability distribution, you change the generating sequence as well. Otherwise, a copy of the distribution is returned. The default value is TRUE.
getDistribution(m, k = 2)
## Probability distribution
## * Name:Kappa
## * Info:uniform discrete probability distribution over two variables
## * Variables:B, C
## * Non-empty items:2
## NULL

## Model properties

Every compositional model has several properties. Some of them are related to its structure.

### Basic overview

To see the basic statistics about the model, it is enough to type the name of the model, or call function as.character().

m
## Compositional model
## * Name:test
## * Info:my first compositional model
## * Variables:B, C, A
## * Length:2
## NULL

### Name and information

For an easier handling of a compositional mode, you case set/change its name and aditional information about it. The usage is the same as in case of an object of Distribution class.

name(m)
## [1] "test"
info(m) <- "different information"

### Length

By the length of a model, we understand the number of elements of its generating sequence. I.e. in case of a model with a generating sequence $$\pi_1, \pi_2$$ we say that its length is $$2$$. To find the length of the model, use function length().

length(m)
## [1] 2

### Dimension

By the dimension of a model $$\pi_1, \ldots, \pi_n$$, we understand the dimension of the space of the composed probability distribution $$\pi_1 \triangleright \ldots \triangleright \pi_n$$. In other words, the dimension corresponds to the number of unique random variables probability distributions $$\pi_1, \ldots, \pi_n$$ are defined for.

dim(m)
## [1] 3

### Structure

Let $$\pi_1(K_1), \pi_2(K_2), \ldots, \pi_n(K_n)$$ be the generating sequence of a compositional model. Then the sequence of sets of variables $$K_1, K_2, \ldots, K_n$$ is its structure.

getStructure(m)
## [[1]]
## [1] "A" "B"
##
## [[2]]
## [1] "B" "C"

### Random variables

To get the set of all random variables the given compositional model is defined for, call variables() function.

variables(m)
## [1] "B" "C" "A"

To get the model structure - which is a sequence of sets of variables the

### Decomposability

As discussed in Section 3.1, the perfectness of a compositional model is a strong property, however, its validity is not easy to check. Note that the fact whether the model is perfect or not depends on the “numbers” defining the probability distributions, not on the structure of the compositional model. By a structure, we denote the sequence of sets of variables the distributions in the generating sequence are defined for. The ordering of the sets coincides with the ordering of the generating sequence.

If the structure meets the so-called Running Intersection Property (RIP) then a compositional model is called decomposable. To check this, one can use function is.decomposable().

is.decomposable(m)
## [1] TRUE

## Manipulations with model

Even though the compositional model is internally represented using its generating sequence, it is a probability distribution. Therefore one can manipulate it as a probability distribution

### Marginalization

The task studied in this section is the following: for a compositional model $$\pi_1 \triangleright \pi_2 \triangleright \ldots \triangleright \pi_n$$, and a subset of variables $$M \subset K_1 \cup K_2 \cup \ldots \cup K_n$$ find a compositional model $$\kappa_1 \triangleright \kappa_2 \triangleright \ldots \triangleright \kappa_m$$ such that $(\pi_1 \triangleright \pi_2 \triangleright \ldots \triangleright \pi_n)^{\downarrow M} = \kappa_1 \triangleright \kappa_2 \triangleright \ldots \triangleright \kappa_m$

To do that with mudim package, use function marginalize with the respective compositional model as its first parameter. The function has five parameters:

• x: compositional model
• variables: vector of variables to be either removed or kept in the compositional model
• keep: logical variable. If TRUE the resulting compositional model is defined over variables. If FALSE, variables are removed from the compositional model. The default value is TRUE.
• perfect: logical variable. If TRUE, the marginalization algorithm expects a perfect compositional model on the input and some special techniques speeding up the marginalization process can be used. The default value is FALSE.
• new: logical variable. If TRUE, a compositional model referenced by x is left unchanged and a new compositional model is created and returned by the function. If FALSE, the compositional model referenced by x is changed. The function marginalize does not return anything in that case. The default value is TRUE.
## Model class
data(m)
variables(m)
## [1] "D" "N" "R" "T" "W" "U" "B"
# create a new marginalized compositional model
newModel <- marginalize(m,
variables = c("W","U"),
keep = FALSE,
new = TRUE)
variables(newModel)
## [1] "D" "N" "R" "T" "B"

Note that the original compositional model loaded from the package using the command data(m) remains unchanged. To see that, let us print the vector of random variables the compositional model is defined for.

variables(m)
## [1] "D" "N" "R" "T" "W" "U" "B"

To change the original model referenced by m, set the parameter new to FALSE.

marginalize(m, variables = c("W","U"), keep = FALSE, new = FALSE)
variables(m)
## [1] "D" "N" "R" "T" "B"

### Perfectization

Not all compositional models are equally efficient when used for the representation of multidimensional distributions. Among them, so-called perfect models hold an important position. Recall from Section 3.1 that the importance of these models arises from the fact that having a compositional model, each probability distribution from its generating sequence is a marginal of the compositional model. In other words, one can say that a perfect compositional model perfectly reflects all the local information stored in probability distributions of its generating sequence.

If a compositional model is not perfect, one can easily convert it into a perfect one by replacing each member of its generating sequence by a respective marginal as shown in Theorem 3.6. To do it in mudim, one can use the function perfect

mPerfect <- perfect(m, new = TRUE)

### Conditioning

We can calculate a conditional compositional model in the case of decomposable models only. This is given by the fact that the conditioning variable has to appear among variables of the first distribution in the model (its generating sequence). In the case of a decomposable model, it is guaranteed that the generating sequence can be always reordered in a way that a given variable appears among arguments of the first distribution in the sequence.

mDecomposable <- toDecomposable(m)
conditioning(mDecomposable, variable = "T", value = 2)

Note that the original model has been changed. If you want to keep the original model, you have to use function copy first.

m2 <- copy(mDecomposable)

### Decomposibility

The importance of decomposable models is hidden in the fact that most of the computational procedures can be done efficiently using so-called local computations. By this term, one usually denotes computational process realized as a sequence of steps, in which each step performs computations with only one of the distributions, from which the multidimensional model is composed.

To convert a compositional model into its decomposable version type:

mDecomposable <- toDecomposable(m)
is.decomposable(mDecomposable)
## [1] TRUE

Note that in case of some special operations (like conditioning), it is necessary to reorder a decomposable model (its generating sequence) in a way that a specific variable appears among variables of the first distribution in the generating sequence. To do that, use function reorderRIP:

# structure of the compositional model
getStructure(mDecomposable)
## [[1]]
## [1] "T" "R" "N"
##
## [[2]]
## [1] "B" "R"
##
## [[3]]
## [1] "N" "D"
reorderRIP(mDecomposable, root = "D")
# after reordering
getStructure(mDecomposable)
## [[1]]
## [1] "N" "D"
##
## [[2]]
## [1] "T" "R" "N"
##
## [[3]]
## [1] "B" "R"

### Convert to distribution

A compositional model is kept in a form of a generating sequence, e.g. $$\pi_1, \ldots, \pi_n$$. If you want to apply all the operators of composition and create a multidimensional probability distribution $$\pi_1 \triangleright \ldots \triangleright \pi_n$$, call function toDistribution().

d <- toDistribution(m)
d
## Probability distribution
## * Name:composition
## * Info:
## * Variables:N, T, R, B, D
## * Non-empty items:48
## NULL

# Others

For other functionality of the package, it is useful to know the following:

To save and load probability distribution as defined in MUDIM package, use R internal functions save() and load() with parameter file to specify the location of the stored object.

data(Pi)

d <- copy(Pi)

# save distribution Pi
save(d, file = "d.RData")
# remove the object from R
rm(d)
# check if the object Pi exists
exists("d")
## [1] FALSE
# load the saved object back to R
load(file = "d.Rdata")

## Referencing

mudim package is based on R.oo package that implements methods and classes for object-oriented programming in R. When calling constructor function d <- Distribution("name"), an object of class "Distribution" is created and a pointer to that object is stored in variable d. I.e. if one wants to make a copy of distribution d using command d.copy <- d, just the pointer is copied. I.e. d.copy still points to the same location in memory as d. Therefore modifying d.copy, say by changing variables names, d will also get updated. To avoid this, one has to explicitly copy: d.copy <- copy(d).

# load demo distribution Pi
data(Pi)
# show names of the random variables in Pi
variables(Pi)
## [1] "A" "B"
# create a new R variable Pi.copy
Pi.copy <- Pi
# change variable names in Pi.copy
variables(Pi.copy) <- c("C","D")
# variables in Pi are changed as well. Pi and Pi.copy are
# referencing the same object
variables(Pi)
## [1] "C" "D"
# to avoid that, copy an entire object first
Pi.copy <- copy(Pi)
variables(Pi.copy) <- c("E","F")
variables(Pi)
## [1] "C" "D"


text:
266 views

Two bicyclists travel in opposite directions. One travels $5$ miles per hour faster than the other. In $2$ hours they are $50$ miles apart. What is the rate of the faster bicyclist?

1. $11.25$ mph
2. $15$ mph
3. $20$ mph
4. $22.5$ mph

Ans is option (B)

Let the speed of the slower bicyclist be  $x$  miles per hour. Then the speed of faster bicyclist would be  $x+5$  miles per hour.

Using the concept of relative motion here, let’s keep the slower bicyclist at rest. Then the faster bicyclist would be traveling towards the slower bicyclist with a speed of  $x+5-(-x)=2x+5$  miles per hour.

Now, the faster bicyclist travels  $50$ miles in  $2$ hours.

$\therefore$  $2=\frac{50}{2x+5}$       ($\because$  time  $=$  distance/ speed)

$\Rightarrow$   $x=10$  miles per hour.

So, the speed of the faster bicyclist is,  $10+5=15$ miles per hour.

by
438 points

1
325 views


text:
What is the cube root of 297?

Sep 21, 2015

$\sqrt[3]{297} = 3 \sqrt[3]{11}$

Explanation:

$\sqrt[3]{297}$

Factor it out, sice $2 + 9 + 7 = 18$ we know 297 is divisible by 9.

$\sqrt[3]{297} = \sqrt[3]{33 \cdot 9}$

Since $3 + 3 = 6$ we know 33 is divisible by 3

$\sqrt[3]{33 \cdot 9} = \sqrt[3]{11 \cdot 3 \cdot 9}$

11 is a prime number so there's no more factoring do. We know that $9 = {3}^{2}$, so we can rewrite $3 \cdot 9 = 3 \cdot {3}^{2} = {3}^{3}$

$\sqrt[3]{33 \cdot 9} = \sqrt[3]{11 \cdot {3}^{3}}$

The ${3}^{3}$ can go out of the root, so

$\sqrt[3]{297} = 3 \sqrt[3]{11}$


text:
# Read the following set of facts and explain: How would you use the UCC to help address this claim?..

Read the following set of facts and explain: How would you use the UCC to help address this claim? Please be sure to cite the specific sections of the UCC that you would apply, and explain why and how those sections would apply This set of facts is to be addressed using the relevant sections of the UCC that you have read and are familiar with thus far in the course. Phillip Eugene Wendling, a Harvey County farmer and stockman, met Ted Puls, an active cattle buyer, in July 1973, at the Central Livestock Sale in Hutchinson, Kansas. Wendling indicated to Puls he might have some cattle for sale around the middle of August 1973. Puls asked Wendling to call him when he decided to sell. On August 13, 1973, Wendling called Puls and informed him he had 103 head of cattle for sale. Puls associated himself with George Watson, a veterinarian, for financial assistance and on August 14, 1973, the two drove to Wendling’s farm and inspected the cattle. As a result of negotiation, the parties agreed on a price of 61 cents per pound for 98 head and 59 cents per pound on the remaining 5 head. The cattle were to be officially weighed August 16, 1973, on Puls’ trucks with 3% off for shrinkage. At the time of the agreement, Watson gave Wendling his check for $1,000.00 as a down payment on the cattle with the notation thereon, “103 cattle.” Wendling deposited the check on August 20, 1973. On August 16, 1973, Puls went to Wendling’s farm and requested an additional week to take delivery. Wendling granted the additional week, providing the same terms and conditions applied. Puls assured him they did. Wendling rounded up the cattle and penned them on August 23, 1973, in preparation for delivery pursuant to the agreement. However, Puls never appeared, sent trucks, or called on that day. Consequently, Wendling attempted to telephone Puls, but was advised Puls was not in and was putting up hay. Wendling then called Watson, who said he didn’t know why delivery hadn’t been taken but he would check with Puls. Finally, on August 27, 1973, Wendling reached Puls by telephone and demanded an explanation. Puls stated he was still working on his (previously undisclosed) problem of finding a place to put the cattle. Wendling requested additional down payment and Puls refused and suggested that maybe he should sell the cattle to someone else. Wendling told Puls he would need a written release before he was free to negotiate another sale. Puls made no response to the release suggestion. On August 28, 1973, Wendling sought legal advice and was advised he should obtain a written release from Puls and Watson before reselling the cattle. The next day Wendling could not locate Puls but was able to talk to Dr. Watson. Wendling requested Watson and Puls meet him at his lawyer’s office to give him a release so he could sell the cattle. They did not appear at the law office as requested, leaving Wendling uncertain as to their intentions. Thereafter, on September 11, 1973, Wendling caused the following notice to be served on both men: “Gentlemen: This is to notify you, Ted Puls and George Watson, D.V.M., individually and jointly that I, the undersigned, Phillip Eugene Wendling, at 10:00 a.m., on the 21st day of September, 1973, at the Farmers Coop Elevator, at Halstead, Kansas, will consider you to have breached the contract entered into with me unless on or before said date and time, you fulfill the terms of said contract entered into on the 14th day of August, 1973, at my farm in Harvey County, Kansas, which contract was as follows: “You did purchase for cash and were to take delivery of 103 head of feeder cattle on August 16, 1973, at 7:30 a.m. on your trucks at my farm in Harvey County, Kansas and pay for the same in cash after the same were weighed on the trucks at the scales in Halstead, Kansas, as follows: “98 head at$61.00 per cwt; 5 head at average weight at $59.00 per cwt; all at 3% shrinkage, which cattle at your later requests made from time to time and for your convenience, I have in good faith continued to hold and feed for your convenience awaiting for your compliance with said contract; and I will on the date at the time and place stated above, cause said cattle to be weighed and cause the same to be appraised and a fair market price of said cattle to be established at said time and place and will thereafter pursue such remedies for the breach of said contract as are afforded to me under the uniform commercial code, as provided by the statutes of the State of Kansas. /s/ Phillip Eugene Wendling” Neither Puls nor Watson responded to the notice. Wendling proceeded to comply with the terms of the notice. He weighed the cattle on September 21, 1973. They weighed 85,540 pounds. Wendling asked three qualified livestock dealers to make a bid on the cattle that same day. The market was so unstable on that date only one of the buyers made an offer. He bid 42 cents per pound. Applying the 3% shrinkage provided in the contract, the net weight for sale was 82,974 pounds. At 42 cents a pound, the total selling price on September 21, 1973, would have been$34,849.08 compared to $50,533.50 as a selling price applying the original contract terms to the same weight. The$50,533.50 contract amount does not include the $1000 down payment paid by defendants on August 14, 1973. Wendling later actually sold the cattle for$39,978.49 in two lots on October 18, 1973, and November 1, 1973. Wendling is contemplating filing a civil action to recover damages for breach of an oral contract for the purchase and sale of cattle. He would ask for the price differential of what was originally agreed with Puls and what he actually sold the cattle for, which would be the amount of \$14,755.02. .

## Plagiarism Checker

Submit your documents and get free Plagiarism report

Free Plagiarism Checker


text:
PREPRINT
4077FFC0-1859-46F8-82C1-0B884CB1533B

A millimeter-multiwavelength continuum study of VLA 1623 West

Arnaud Michel, Sarah I. Sadavoy, Patrick D. Sheehan, Leslie W. Looney, Erin G. Cox

Submitted on 14 September 2022

Abstract

VLA 1623 West is an ambiguous source that has been described as a shocked cloudlet as well as a protostellar disk. We use deep ALMA 1.3 and 0.87 millimeter observations to constrain its shape and structure to determine its origins better. We use a series of geometric models to fit the uv visibilities at both wavelengths with GALARIO. Although the Real visibilities show structures similar to what has been identified as gaps and rings in protoplanetary disks, we find that a modified Flat-Topped Gaussian at high inclination provides the best fit to the observations. This fit agrees well with expectations for an optically thick, highly inclined disk. Nevertheless, we find that the geometric models consistently yield positive residuals at the four corners of the disk at both wavelengths. We interpret these residuals as evidence that the disk is flared in the millimeter dust. We use a simple toy model for an edge-on flared disk and find that the residuals best match a disk with flaring that is mainly restricted to the outer disk at $R\gtrsim 30$ au. Thus, VLA 1623W may represent a young protostellar disk where the large dust grains have not yet had enough time to settle into the mid-plane. This result may have implications for how disk evolution and vertical dust settling impact the initial conditions leading to planet formation.

Preprint

Comment: Accepted by ApJ, 12 pages, 13 figures

Subjects: Astrophysics - Earth and Planetary Astrophysics; Astrophysics - Solar and Stellar Astrophysics


text:
Previous: [Chapter 6](Chapter 6.ipynb) [Learning Computing with Robots](Learning Computing with Robots.ipynb) Next: [Chapter 8](Chapter 8.ipynb)

# 7: Behavior Control¶

My Traffic Lights
Illustration by Yingshun Wong (http://yingshun.co.uk)

Oh, Behave!

Austin Powers (played by Mike Myers) in the movie Austin Powers: International Man of Mystery, New Line Cinema, 1997.

Writing programs is all about exercising control. In the case of a robot’s brain your program directs the operations of a robot. However, it is also important to realize that the program itself is really controlling the computer. That is, when you write Python programs you are controlling the computer that is then communicating with the robot. Your program is directing the computer to control the robot. If you take Myro out of the picture you are writing programs to control the computer. This is the sense in which learning with robots also leads to learning computing. Every program you write is doing computation. Contrary to popular misconceptions computing is not just about doing calculations with numbers. Controlling your robot is also computing, as is predicting the world’s population, or composing an image, etc. This is one aspect of control.

When writing robot control programs, the structure you use to organize the program itself is a control strategy. Programming a robot is specifying automated control. As a programmer or behavior designer you structure your program to accomplish the goals of the behavior: how the sensors are used to decide what to do next. This is another aspect of control. So far, you have seen how to write control programs using Braitenberg style sensor-motor wiring. You have also seen how to specify reactive control. These are examples of two robot control paradigms.

In this chapter we delve further into the world of computation and robot control paradigms. We will learn how to write robot control programs for more complex and more robust robot tasks. We will also see how, using the concepts learned so far, we can write useful and interesting computer applications.

# Behavior-based Control¶

When writing robot control programs, so far, you have used a very basic technique in designing control programs:

def main():

# do forever or for some time
# or until a certain condition is satisfied

# sense and transform sensor values
# reason or decide what to do next
# do it

As you have seen, such a control program works well for many simple tasks. However, you may have already run into many situations where, once the task gets a little complex, it becomes difficult to structure a program in terms of a single stream of control as shown above. For example, the corral exiting behavior from the last chapter requires you to combine two simple behaviors: solve a maze (avoid obstacles) and seek light to get out of the corral. As you have seen before, it is fairly easy to program each of the individual behaviors: obstacle avoidance; light following. But, when you combine these behaviors to accomplish the corral exiting behavior two things happen: you are forced to amalgamate the two control strategies into a single one and it may become difficult to decide which way to combine them; additionally, the resulting program is not very pretty and hard to read. In reality, hardly any robot programs are written that way. In this section, we will look at a different way of structuring robot programs that makes designing behaviors easy, and yet, the resulting structure of the overall program is also clean and straightforward. You can design some very sophisticated behaviors using these ideas.

People in the robotics community call the style of programming shown above as reactive control or direct control. Also referred to as sensor fusion, the resulting programs are purely sensor driven and hence appear to be too bottom-up. That is, the values of the sensors drive the logic of control as opposed to the goals of the robot tasks themselves. In behavior-based control you get away from sensors and focus the design of your robot programs based on the number and kinds of behaviors your robot has to carry out.

Let us look at how behavior-based control enables us to design the corral exiting behavior. The robot essentially has to carry out three kinds of behaviors: cruise (in the absence of any obstacles and/or light), avoid obstacles (if present), and seek light (if present). In a behavior-based style of writing programs, you will define each of these behaviors as an individual decision unit. Thus, each is quite simple and straightforward to write. Next, the control program has to fuse the behaviors recommended by each individual behavior unit. Look at the picture shown below:

In the diagram above, we have shown the three basic behaviors that we are trying to combine: Cruise, Avoid, SeekLight. Each of these behaviors outputs a triple: Yes/No, Translate Speed, Rotate Speed. A Yes implies that the behavior module has a recommendation. No implies that it doesn't. That is, it allows the possibility of a behavior having no recommendation. For example, in the corral exiting situation, in the absence of a light source being sensed by the robot, the SeekLight module will not have any recommendation. It then becomes the task of the arbitrator (or the decision module) to decide which of the available recommendations to use to drive the robot. Notice that in the end to control the robot, all one has to do is decide how much to translate and rotate. Many different arbitration schemes can be incorporated. We will use a simple but effective one: Assign a priority to each behavior module. Then the arbitrator always chooses the highest priority recommendation. This style of control architecture is also called subsumption architecture. In the figure above, we have actually drawn the modules in the order of their priority: the higher the module is in the figure, the higher its priority. The lowest behavior, cruise does not require any sensors and is always present: it wants the robot to always go forward.

Arranging a control based on combining simple behaviors has several advantages: you can design each individual behavior very easily; you can also test each individual behavior by only adding that behavior and seeing how well it performs; you can incrementally add any number of behaviors on top of each other. In the scheme above, the control regime implies that the robot will always cruise forward. But, if there is an obstacle present, it will override the cruise behavior and hence try to avoid the obstacle. However, if there is a light source detected, it will supersede all behaviors and engage in light seeking behavior. Ideally, you can imagine that all the behaviors will be running simultaneously (asynchronously). In that situation, the arbitrator will always have one or more recommendations to adopt based on priority.

Let us develop the program that implements behavior-based control. First, we define each behavior:

In [2]:
from Myro import *

cruiseSpeed = 0.8
turnSpeed = 0.8
lightThresh = 80

def cruise():
# is always ON, just move forward
return [True, cruiseSpeed, 0]

def avoid():
# see if there are any obstacles
L, R = getIR()
L = 1 - L
R = 1 - R

if L:
return [True, 0, -turnSpeed]
elif R:
return [True, 0, turnSpeed]
else:
return [False, 0, 0]

def seekLight():
L, C, R = getLight()

if L < lightThresh:
return [True, cruiseSpeed/2.0, turnSpeed]
elif R < lightThresh:
return [True, cruiseSpeed/2.0, -turnSpeed]
else:
return [False, 0, 0]

In the above, you can see that each individual behavior is simple and is easy to read (and write). There are several ways to incorporate these into a behavior-based program. Here is one:

In [ ]:
# list of behaviors, ordered by priority (left is highest)
behaviors = [seekLight, avoid, cruise]

def main():

while True:
T, R = arbitrate()
move(T, R)

main()

The main program calls the arbitrate function that returns the chosen translate and rotate commands which are then applied to the robot. The function arbitrate is simple enough:

In [3]:
# Decide which behavior, in order of priority
# has a recommendation for the robot
def arbitrate():
for behavior in behaviors:
output, T, R = behavior()
if output:
return [T, R]

That is, it queries each behavior in order of priority to see if it has a recommendation. If it does, that is the set of motor commands returned.

Do This: Run the program above and see how well the robot behaves in navigating around and exiting the corral. What happens if you change the priority (ordering in the list) of behaviors? In writing the program above, we have used two new Python features. We will review these next.

## Names and Return values¶

In Chapter 3 you learned that in Python names can be used to represent functions as well as numbers and strings. You also saw in Chapter 5 that lists, and even pictures or images could be represented using names. A name is an important programming concept. In Python a name can represent anything as its value: a number, a picture, a function, etc. In the program above, when we defined the variable behaviors as:

In [4]:
behaviors = [seekLight, avoid, cruise]

we used the names seekLight, avoid, and cruise to denote the functions that they represented. We named these functions earlier in the program (using def). Thus, the list named behaviors is a list of function names each of which denote the actual function as its value. Next, look at the way we used the variable behaviors in the function arbitrate:

for behavior in behaviors:
output, T, R = behavior()
...

Since behaviors is a list it can be used in the loop to represent the sequence of objects (in this case functions). Thus in each iteration of the loop, the variable behavior takes on successive values from this list: seekLight, avoid, and cruise. When the value of the variable is seekLight, the function seekLight is called in the statement:

output, T, R = behavior()

There is no function named behavior() defined anywhere in the program. However, since the value of the variable name behavior is set to one of the functions in the list behaviors, the corresponding function is invoked.

The other new aspect of Python that we have used in the program above is the fact that a function can return any object as its value. Thus the functions cruise, avoid, seekLight, and arbitrate all return lists as their values.

Both of these are subtle features of Python. Many other programming languages have restrictions on the kinds of things one can name as variables and also on the kinds of values a function can return. Python gives uniform treatment to all objects.

## The Python Math Library¶

Most programming languages, Python included, provide a healthy selection of libraries of useful functions so you do not have to write them. Such libraries are often termed as an application programming interface or an API. Earlier you were introduced to the random library provided by Python. It contains several useful functions that provide facilities for generating random numbers. Similarly, Python also provides a math library that provides often used mathematical functions. In Chapter 6, we used the function expfrom the math library to normalize sensor values. Some of the commonly used functions in the math library are listed below:

Commonly used functions in the math module

ceil(x) Returns the ceiling of x as a float, the smallest integer value greater than or equal to x.

floor(x) Returns the floor of x as a float, the largest integer value less than or equal to x.

exp(x) Returns $e^x$.

log(x[, base]) Returns the logarithm of x to the given base. If the base is not specified, return the natural logarithm of x (i.e., $\log_e{x}$).

log10(x) Returns the base-10 logarithm of x (i.e. $\log_{10}{}$x).

pow(x, y) Returns $x^y$.

sqrt(x) Returns $\sqrt{x}$.

Some of the other functions available in the math module are listed at the end of the chapter. In order to use any of these all you have to do is import the math module:

In [6]:
import math

In [7]:
math.ceil(5.34)

Out[7]:
6
In [8]:
math.floor(5.34)

Out[8]:
5
In [9]:
math.exp(3)

Out[9]:
20.0855369231877
In [10]:
math.log10(1000)

Out[10]:
3
In [11]:
math.log(1024, 2)

Out[11]:
10
In [12]:
math.pow(2, 10)

Out[12]:
1024
In [13]:
math.sqrt(7.0)

Out[13]:
2.64575131106459

Alternately, you can import the math module as shown below:

In [14]:
from math import *

In [15]:
ceil(5.34)

Out[15]:
6
In [16]:
floor(5.34)

Out[16]:
5
In [17]:
exp(3)

Out[17]:
20.0855369231877
In [18]:
log10(1000)

Out[18]:
3
In [19]:
log(1024,2)

Out[19]:
10
In [20]:
sqrt(7.0)

Out[20]:
2.64575131106459

In Python, when you import a module using the command:

import <module>

You have to prefix all its commands with the module name (as the case in the first set of examples above). We have also been using the form

from <module> import *

This imports all functions and other objects provided in the module which can then be used without the prefix. You can also individually import specific functions from a module using:

from <module> import <this>, <that>, …

Which version you use may depend on the context in which you use the imported functions. You may run into a situation where two different modules define functions with the same name but to do different things (or to do things in a different way). In order to use both functions in the same module you will have to use the module prefix to make clear which version you are using.

## Doing Computations¶

Lets us weave our way back to traditional style computing for now. You will see that the concepts you have learned so far will enable you to write lots of different and more interesting computer applications. It will also give you a clear sense of the structure of typical computer programs. Later, in Chapter 11, we will also return to the larger issue of the design of general computer programs.

## A Loan Calculator¶

Your current car, an adorable 1992 SAAB 93 was bought used and, for past several months, you have had nothing but trouble keeping the car on the road. Last night the ignition key broke off in the key slot when you were trying to start it and now the broken piece would not come out (this used to happen a lot with older SAAB's). The mechanic has to dismantle the entire ignition assembly to get the broken key out and it could cost you upwards of $\$500$. The car's engine, which has done over$185,000$miles, has left you stranded on the road many times. You have decided that this is it; you are going to go out and get yourself a brand new reliable car. You have been moonlighting at a restaurant to make extra money and have managed to save$\$5500.00$ for exactly this situation. You are now wondering what kind of new car you can buy. Obviously, you will have to take a loan from a bank to finance the rest of the cost but you are not sure how big a loan, and therefore what kind of car, you can afford. You can write a small Python program to help you try out various scenarios.

You can either dream (realistically) of the car you would like to buy, or you can go to any of the helpful car buying sites on the web (http://www.edmunds.com) is a good place to start). Let us say that you have spent hours looking at features and options and have finally narrowed your desires to a couple of choices. Your first choice is going to cost you $\$22,000.00$and your second choice is priced at$\$18,995.00$. Now you have to decide which of these you can actually afford to purchase.

First, you go talk to a couple of banks and also look at some loan offers on the web. For example, go to bankrate.com and look for current rates for new car loans.

Suppose the loan rates quoted to you are: $6.9\%$ for $36$ months, $7.25\%$ for $48$ months, and $7.15\%$ for $60$ months.

You can see that there is a fair bit of variation in the rates. Given all this information, you are now ready to write a program that can help you figure out which of the two choices you may be able to make. In order to secure the loan, you have to ensure that you have enough money to pay the local sales tax (a $6\%$ sales tax on a $\$20,000$car will add up to a hefty$\$1200$!). After paying the sales tax you can use the remainder of the money you have saved up towards the down payment. The remainder of the money is the amount that you would borrow. Depending on the type of loan you choose, your monthly payments and how long you will make those payments will vary. There is a simple formula that you can use to estimate your monthly payment:

$\Large{MonthlyPayment = \frac{Loan Amount \times MonthlyInterestRate}{1 - e^{-LoanTerm\times\log(1 + MonthlyInterestRate)}}}$

Whoa! That seems complicated. However, given the formula, you can see that it really requires two mathematical functions: $\log(x)$ and $e^x$, both of which are available in the Python math module. Suddenly, the problem seems not that hard.

Let us try and outline the steps needed to write the program: First, note the cost of the car, the amount of money you have saved, and the sales tax rate Also, note the financials: the interest rate, and the term of the loan. The interest rate quoted is generally the annual percentage rate (APR) convert it to monthly rate (by dividing it by $12$). Next, compute the sales tax you will pay. Use the money left to make a down payment. Then determine the amount you will borrow. Plug in all of the values in the formula and compute the monthly payment. Also, compute the total cost of the car. Output all the results. Next, we can take each of the above steps and start to encode them into a program. Here is a first order refinement:

def main():
# First, note the cost of the car (Cost),
# the amount of money you have saved (Cash),
# and the sales tax rate (TaxRate)
# Also, note the financials: the interest rate (APR),
# and the term of the loan (Term)
# The interest rate quoted is generally the annual
# percentage rate (APR)
# Convert it to monthly rate (by dividing it by 12) (MR)

# Next, compute the sales tax you will pay (SalesTax)
# Use the money left to make a down payment (DownPayment)
# Then determine the amount you will borrow (LoanAmount)

# Plug in all of the values in the formula and compute
# the monthly payment (MP)

# Also, compute the total cost of the car. (TotalCost)

# Output all the results

main()

Above, we have taken the steps and converted them into a skeletal Python program. All the steps are converted to Python comments and where needed, we have decided the names of variables that will hold the values that will be needed for the calculations. This is useful because this also helps determine how the formula will be encoded and also helps determine what values can be programmed in and which ones you will have to supply as input. Making the program require inputs will easily enable you to enter the different parameters and then based on the outputs you get, you can decide which car to buy. Let us encode all the inputs first:

In [21]:
def main():
# First, note the cost of the car (Cost),
Cost = float(ask("Enter the cost of the car: $")) # the amount of money you have saved (Cash), Cash = float(ask("Enter the amount of money you saved:$"))

# and the sales tax rate (TaxRate) (6% e.g.)
SalesTaxRate = 6.0

# Also, note the financials: the interest rate (APR),
# and the term of the loan (Term)
# The interest rate quoted is generally the annual
# percentage rate (APR)
APR = float(ask("Enter the APR for the loan (in %): "))

# Convert it to monthly rate (by dividing it by 12) (MR)

# Next, compute the sales tax you will pay (SalesTax)
# Use the money left to make a down payment (DownPayment)
# Then determine the amount you will borrow (LoanAmount)

# Plug in all of the values in the formula and compute
# the monthly payment (MP)

# Also, compute the total cost of the car. (TotalCost)

# Output all the results

main()

Enter the cost of the car: $1234 Enter the amount of money you saved:$2
Enter the APR for the loan (in %): 12

We have refined the program to include the inputs that will be needed for each run of the program. Notice that we chose not to input the sales tax rate and instead just assigned it to the variable SalesTaxRate. If you wanted, you could also have that be entered as input. What you choose to have as input to your program is your design decision. Sometimes the problem may be framed so it explicitly specifies the inputs; sometimes you have to figure that out. In general, whatever you need to make your program more versatile is what you have to base your decisions on. For instance, fixing the sales tax rate to $6.0$ will make the program usable only in places where that rate applies. If, for example, you wanted your friend in another part of the country to use the program, you should choose to make that also an input value. Let us go on to the next steps in the program and encode them in Python. These are mainly computations. The first few are simple. Perhaps the most complicated computation to encode is the formula for computing the monthly payment. All of these are shown in the version below.

In [ ]:
from math import *

def main():
# First, note the cost of the car (Cost),
Cost = float(ask("Enter the cost of the car: $")) # the amount of money you have saved (Cash), Cash = float(ask("Enter the amount of money you saved:$"))

# and the sales tax rate (TaxRate) (6% e.g.)
SalesTaxRate = 6.0

# Also, note the financials: the interest rate (APR),
# and the term of the loan (Term)
# The interest rate quoted is generally the annual
# percentage rate (APR)
APR = float(ask("Enter the APR for the loan (in %): "))

# Input the term of the loan (Term)
term = float(ask("Enter length of loan term (in months): "))

# Convert it (APR) to monthly rate (divide it by 12) (MR)
# also divide it by 100 since the value input is in %
MR = APR/12.0/100.0

# Next, compute the sales tax you will pay (SalesTax)
SalesTax = Cost * SalesTaxRate / 100.0

# Use the money left to make a down payment (DownPayment)
DownPayment = Cash - SalesTax

# Then determine the amount you will borrow (LoanAmount)
LoanAmount = Cost - DownPayment

# Plug in all of the values in the formula and compute
# the monthly payment (MP)
MR = (LoanAmount * MR) / (1.0 - exp(-term * log(1.0+MR)))

# Also, compute the total cost of the car. (TotalCost)
TotalCost = SalesTax + DownPayment + MR * term

# Output all the results
print ("------------------------------------------")
print ()
print ("Money you have saved $", Cash) print ("Cost of the car$", Cost)
print ("Sales Tax rate is", SalesTaxRate, "%")
print ("Sales Tax on the car $", SalesTax) print ("Your down payment will be$", DownPayment)
print ("You will be borrowing $", LoanAmount) print ("A", term, "month loan at", APR, "% APR") print ("Your monthly payment will be$", MP)
print ("Total cost will be $", TotalCost) print () main()  Do This: When you enter the above program and run it in Python, you can enter the data about your car. Here is a sample run: Enter the cost of the car:$20000.00
Enter the amount of money you saved: $5500.00 Enter the APR for the loan (in %): 6.9 Enter the length of loan term (in months): 36 Here are the details about your new car... ------------------------------------------ Money you have saved$ 5500.0
Cost of the car $20000.0 Sales Tax rate is 6.0 % Sales Tax on the car$ 1200.0
Your down payment will be $4300.0 You will be borrowing$ 15700.0
A 36 month loan at 6.9 % APR
Your monthly payment will be $484.052914723 Total cost will be$ 22925.90493

It appears that at for the $\$20000.00$car, for a$36$month$6.9\%$loan you will end up paying$\$484.05$ (or $\$484.06$depending upon how your loan company round pennies!). When you need to restrict your output values to specific decimal places (two in the case of dollars and cents, for example), you can use the string formatting features built into Python. For example, in a string, you can specify how to include a floating point value as follows: In [1]: import math "Value of PI %5.3f in 3 places after the decimal" % (math.pi)  Out[1]: Value of PI 3.142 in 3 places after the decimal The above is a Python expression that has the syntax: <string> % <expression>  Inside the <string> there is a format specification beginning with a %-sign and ending in an f. What follows the %-sign is a numerical specification of the value to be inserted at that point in the string. The f in the specification refers to the fact it is for a floating point value. Between the %-sign and the f is a number,$5.3$. This specifies that the floating point number to be inserted will take up at least$5$spaces,$3$of which will be after the decimal. One of the spaces is always occupied by the decimal. Thus, the specification %5.3f specifies a value to be inserted in the following manner: "This is the value of PI -.--- expressed in three places after the decimal"  You can see the result of executing this in Python below: In [3]: "Value of PI %5.3f in 3 places after the decimal" % (math.pi)  Out[3]: Value of PI 3.142 in 3 places after the decimal In [4]: "Value of PI %7.4f in 4 places after the decimal" % (math.pi)  Out[4]: Value of PI 3.1416 in 4 places after the decimal In the second example above, we replaced the specification with %7.4f. Notice that the resulting string allocates seven spaces to print that value. If there are more spaces than needed they get padded by blanks on the leading edge (notice the extra space before 3 in the second example above). If the space specified is less, it will always be expanded to accommodate the number. For example: In [5]: "Value of PI %1.4f in 4 places after the decimal" % (math.pi)  Out[5]: Value of PI 3.1416 in 4 places after the decimal We deliberately specified that the value be$1$space wide with$4$spaces after the decimal (i.e. %1.4f). As you can see, the space was expanded to accommodate the value. What is assured is that the value is always printed using the exact number of spaces after the decimal. Here is another example: In [6]: "5 is also %1.3f with 3 places after the decimal." % 5  Out[6]: 5 is also 5.000 with 3 places after the decimal. Thus, the value is printed as$5.000(i.e. the three places after the decimal are always considered relevant in a specification like %1.3f). Similarly, for specifying whole number or integer values you can use the letter-d, and for strings you can use the letter-s: In [7]: "Hello %10s, how are you?" % "Arnold"  Out[7]: Hello Arnold, how are you? By default, longer specifications are right-justified. You can use a %- specification to left-justify. For example: In [8]: "Hello %-10s, how are you?" % "Arnold"  Out[8]: Hello Arnold , how are you? Having such control over printed values is important when you are trying to output tables of aligned values. Let us modify our program from above to use these formatting features: In [ ]: from math import * def main(): # First, note the cost of the car (Cost), Cost = float(ask("Enter the cost of the car:"))

# the amount of money you have saved (Cash),
Cash = float(ask("Enter the amount of money you saved: $")) # and the sales tax rate (TaxRate) (6% e.g.) SalesTaxRate = 6.0 # Also, note the financials: the interest rate (APR), # and the term of the loan (Term) # The interest rate quoted is generally the annual # percentage rate (APR) APR = float(ask("Enter the APR for the loan (in %): ")) # and the term of the loan (Term) term = float(ask("Enter length of loan term (in months): ")) # Convert it (APR) to monthly rate (divide it by 12) (MR) # also divide it by 100 since the value input is in % MR = APR/12.0/100.0 # Next, compute the sales tax you will pay (SalesTax) SalesTax = Cost * SalesTaxRate / 100.0 # Use the money left to make a down payment (DownPayment) DownPayment = Cash - SalesTax # Then determine the amount you will borrow (LoanAmount) LoanAmount = Cost - DownPayment # Plug in all of the values in the formula and compute # the monthly payment (MP) MP = (LoanAmount * MR) / (1.0 - exp(-term * log(1.0+MR))) # Also, compute the total cost of the car. (TotalCost) TotalCost = SalesTax + DownPayment + MP * term # Output all the results print ("Here are the details about your new car...") print ("------------------------------------------") print () print ("Money you have saved$%1.2f" % Cash)
print ("Cost of the car $%1.2f" % Cost) print ("Sales Tax rate is %1.2f" % SalesTaxRate) print ("Sales Tax on the car$", SalesTax, "%")
print ("Your down payment will be $%1.2f" % DownPayment) print ("You will be borrowing$%1.2f" % LoanAmount)
print ("A %2d month loan at %1.2f APR" % (term, APR))
print ("Your monthly payment will be $%1.2f" % MP) print ("Total cost will be$%1.2f" % TotalCost)
print ()

main()

When you run it again (say for a slightly different loan term), you get:

Enter the cost of the car: $20000.00 Enter the amount of money you saved:$5500.00
Enter the APR for the loan (in %): 7.25
Enter the length of loan term (in months): 48
Money you have saved $5500.00 Cost of the car$20000.00
Sales Tax on the car $1200.0 % Your down payment will be$4300.00
You will be borrowing $15700.00 A 48 month loan at 7.25 APR Your monthly payment will be$377.78


text:
Search by Topic

Filter by: Content type:
Stage:
Challenge level:

There are 30 results

Broad Topics > Sequences, Functions and Graphs > Fibonacci sequence

1 Step 2 Step

Stage: 3 Challenge Level:

Liam's house has a staircase with 12 steps. He can go down the steps one at a time or two at time. In how many different ways can Liam go down the 12 steps?

Fibs

Stage: 3 Challenge Level:

The well known Fibonacci sequence is 1 ,1, 2, 3, 5, 8, 13, 21.... How many Fibonacci sequences can you find containing the number 196 as one of the terms?

Fibonacci Surprises

Stage: 3 Challenge Level:

Play around with the Fibonacci sequence and discover some surprising results!

Farey Fibonacci

Stage: 5 Short Challenge Level:

Investigate Farey sequences of ratios of Fibonacci numbers.

Cellular

Stage: 2, 3 and 4 Challenge Level:

Cellular is an animation that helps you make geometric sequences composed of square cells.

Building Gnomons

Stage: 4 Challenge Level:

Build gnomons that are related to the Fibonacci sequence and try to explain why this is possible.

Simple Train Journeys

Stage: 1 and 2 Challenge Level:

How many different journeys could you make if you were going to visit four stations in this network? How about if there were five stations? Can you predict the number of journeys for seven stations?

Golden Trail 1

Stage: 3, 4 and 5 Challenge Level:

A first trail through the mysterious world of the Golden Section.

First Forward Into Logo 11: Sequences

Stage: 3, 4 and 5 Challenge Level:

This part introduces the use of Logo for number work. Learn how to use Logo to generate sequences of numbers.

Whirling Fibonacci Squares

Stage: 3 and 4

Draw whirling squares and see how Fibonacci sequences and golden rectangles are connected.

Plus or Minus

Stage: 5 Challenge Level:

Make and prove a conjecture about the value of the product of the Fibonacci numbers $F_{n+1}F_{n-1}$.

Pythagorean Fibs

Stage: 5 Challenge Level:

What have Fibonacci numbers got to do with Pythagorean triples?

Fibonacci Fashion

Stage: 5 Challenge Level:

What have Fibonacci numbers to do with solutions of the quadratic equation x^2 - x - 1 = 0 ?

Golden Mathematics

Stage: 5

A voyage of discovery through a sequence of challenges exploring properties of the Golden Ratio and Fibonacci numbers.

The Golden Ratio, Fibonacci Numbers and Continued Fractions.

Stage: 4

An iterative method for finding the value of the Golden Ratio with explanations of how this involves the ratios of Fibonacci numbers and continued fractions.

Golden Fractions

Stage: 5 Challenge Level:

Find the link between a sequence of continued fractions and the ratio of succesive Fibonacci numbers.

Sheep Talk

Stage: 2 Challenge Level:

In sheep talk the only letters used are B and A. A sequence of words is formed by following certain rules. What do you notice when you count the letters in each word?

Got a Strategy for Last Biscuit?

Stage: 3 and 4 Challenge Level:

Can you beat the computer in the challenging strategy game?

Leonardo of Pisa and the Golden Rectangle

Stage: 2, 3 and 4

Leonardo who?! Well, Leonardo is better known as Fibonacci and this article will tell you some of fascinating things about his famous sequence.

Fibonacci's Three Wishes 2

Stage: 2 and 3

Second of two articles about Fibonacci, written for students.

Golden Fibs

Stage: 5 Challenge Level:

When is a Fibonacci sequence also a geometric sequence? When the ratio of successive terms is the golden ratio!

Fibonacci Factors

Stage: 5 Challenge Level:

For which values of n is the Fibonacci number fn even? Which Fibonnaci numbers are divisible by 3?

Ordered Sums

Stage: 4 Challenge Level:

Let a(n) be the number of ways of expressing the integer n as an ordered sum of 1's and 2's. Let b(n) be the number of ways of expressing n as an ordered sum of integers greater than 1. (i) Calculate. . . .

Stringing it Out

Stage: 4 Challenge Level:

Explore the transformations and comment on what you find.

Stage: 3 and 4 Challenge Level:

Using logo to investigate spirals

LOGO Challenge - Circles as Bugs

Stage: 3 and 4 Challenge Level:

Here are some circle bugs to try to replicate with some elegant programming, plus some sequences generated elegantly in LOGO.

Continued Fractions I

Stage: 4 and 5

An article introducing continued fractions with some simple puzzles for the reader.

Gnomon Dimensions

Stage: 4 Challenge Level:

These gnomons appear to have more than a passing connection with the Fibonacci sequence. This problem ask you to investigate some of these connections.

Golden Powers

Stage: 5 Challenge Level:

You add 1 to the golden ratio to get its square. How do you find higher powers?

Room Doubling

Stage: 2 Challenge Level:

Investigate the different ways you could split up these rooms so that you have double the number.


text:
## anonymous one year ago Find the area of the shaded portion https://flyingeaglesnv.sooschools.com/media/g_geo_2014/8/groupi60.gif Answer box would only allow this as the answer: A = x x (square root)x - xxPi

1. jim_thompson5910

|dw:1437528564446:dw|

2. jim_thompson5910

if we cut the quadrilateral into 2 pieces, we get 2 congruent triangles |dw:1437528642207:dw| the 120 degree angle is also cut in half

3. jim_thompson5910

this triangle is a 30-60-90 triangle what is the value of x? |dw:1437528698301:dw|

4. anonymous

the x is the hypotenuse and that is 12. cuz the short leg (6) is 1/2 the size of the hypotenuse. right?

5. jim_thompson5910

x is the long leg actually. The hypotenuse is 2*6 = 12

6. anonymous

so then the long leg is 6(square root 3)

7. jim_thompson5910

it turns out that x = 6*sqrt(3) template for a 30-60-90 triangle |dw:1437529004578:dw|

8. jim_thompson5910

correct

9. jim_thompson5910

|dw:1437529045712:dw|

10. jim_thompson5910

What is the area of the triangle?

11. anonymous

area of the triangle is 1/2 (base x height) so it is 1/2 (6 square root (3)) (6) = 18 square root 3.

12. jim_thompson5910

correct

13. jim_thompson5910

there are 2 of these triangles (one just mirrored over the hypotenuse to get the other) so the total area of this quadrilateral is 2*(18*sqrt(3)) = 36*sqrt(3)

14. jim_thompson5910

|dw:1437529313280:dw|

15. jim_thompson5910

to find the area of this shaded portion |dw:1437529356277:dw| use the formula A = (x/360)*pi*r^2 x = central angle r = radius leave the area in terms of pi

16. anonymous

so the area of the sector would be 12pi. So the area of the segment = area of sector - area of triangle. so A(segment) = 12pi - 36(sqrt3) am I on the right track??

17. jim_thompson5910

you subtracted in the wrong order the "12pi" area is smaller, so it needs to come second $\large \text{area of shaded region} = \text{large area} - \text{small area}$ $\large \text{area of shaded region} = \text{area of quadrilateral} - \text{area of sector}$ $\large \text{area of shaded region} = 36\sqrt{3} - 12\pi$

18. jim_thompson5910

and you should change "area of triangle" to "area of quadrilateral"

19. anonymous

Oh, so that is why i am coming up with a negative number. Thank you so much for your help. :)

20. jim_thompson5910

you're welcome


text:
Search for long-lived, massive particles in events with displaced vertices and multiple jets in $pp$ collisions at $\sqrt{s} = 13$ TeV with the ATLAS detector

The collaboration
CERN-EP-2023-002, 2023.

Abstract (data abstract)
A search for long-lived particles decaying into hadrons ispresented. The analysis uses 139 fb$^{-1}$ of $pp$ collision datacollected at $\sqrt{s} = 13$ TeV by the ATLAS detector at the LHCusing events that contain multiple energetic jets and a displacedvertex. The search employs dedicated reconstruction techniques thatsignificantly increase the sensitivity to long-lived particlesdecaying in the ATLAS inner detector. Background estimates forStandard Model processes and instrumental effects are extracted fromdata. The observed event yields are compatible with those expectedfrom background processes. The results are used to set limits at95% confidence level on model-independent cross sections forprocesses beyond the Standard Model, and on scenarios withpair-production of supersymmetric particles with long-livedelectroweakinos that decay via a small $R$-parity-violatingcoupling. The pair-production of electroweakinos with masses below1.5 TeV are excluded for mean proper lifetimes in the range from0.03~ns to 1~ns. When produced in the decay of m(gluino)=2.4 TeVgluinos, electroweakinos with m(neutralino)=1.5 TeV are excludedwith lifetimes in the range of 0.02~ns to 4~ns.


text:
# How can you determine Mass / kg from the attached table

I spent the last two hours trying to figure out part D and I can't get my head around it... Part D has the formula mass/kg = Mass/kg = C / ΣC I'd imagine "C" is the number of C section of the table. Does anyone know how can I calculate that number?

• $D$ seems to be the fraction of total mass, e.g. $5.28 / 29.92 \approx 0.176$ (which means $17.6\%$ of the total mass) – ccorn Apr 11 '14 at 18:23

for CO2: take $\dfrac{5.28(\text{Mass of CO2})}{29.92}$ = .17647
for CO: take $\dfrac{.84(\text{Mass of CO})}{29.92}$ = 0.02807, etc.
If there was confusion about what was in the denominator, $\Sigma C$ means the sum of elements in column C. Where in this case $\Sigma C = 5.28+.84+23.8$ = 29.92


text:
# Homework Help: Diffraction Grating and Intensity

1. May 22, 2010

### silence98

1. The problem statement, all variables and given/known data

Show that the maximum intensity for a diffraction grating of N slits at the first principal maximum is N^2 times bigger than for a single slit.

2. Relevant equations

I=I(0)[sin^2(NB)/sin^2(B)] where B is ($$\pi$$dsin$$\phi$$)/$$\lambda$$

3. The attempt at a solution

I feel i understand the concepts here but this question has stumped me. I've scoured the internet, read through the relevant chapters in my two textbooks and still i can't see how this would be proven. It is just stated in my lecture notes, is it that intuitive?

I really would be grateful for any help.

2. May 22, 2010

### ehild

The maximum is at Φ=0. You have to start with the limit sin(x)/x when x tends to 0. Find the limit of sin(Nx)/sin(x). Use that sin(Nx)/sin(x)=[sin(Nx)/Nx] N [x/sin(x)].

ehild

3. May 23, 2010

### silence98

Thanks for the help, but i don't really understand the bolded part. I haven't seen that trig identity before and i can't see how it would be found.

4. May 23, 2010

### ehild

It is just multiplying both the numerator and the denominator with the same quantity and rearranging.

$$\frac{\sin(Nx)}{\sin(x)}=\frac{Nx\sin(Nx)}{Nx\sin(x)}=\frac{\sin(Nx)}{Nx} N \frac{x}{\sin(x)}$$

ehild

5. May 23, 2010

### silence98

Thankyou, and i apologise for my stupidity!

I've got it now.

Last edited: May 23, 2010
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook