text:
### Towards Tight Security Bounds for OMAC, XCBC and TMAC

##### Abstract

OMAC --- a single-keyed variant of CBC-MAC by Iwata and Kurosawa --- is a widely used and standardized (NIST FIPS 800-38B, ISO/IEC 29167-10:2017) message authentication code (MAC) algorithm. The best security bound for OMAC is due to Nandi who proved that OMAC's pseudorandom function (PRF) advantage is upper bounded by $O(q^2\ell/2^n)$, where $n$, $q$, and $\ell$, denote the block size of the underlying block cipher, the number of queries, and the maximum permissible query length (in terms of $n$-bit blocks), respectively. In contrast, there is no attack with matching lower bound. Indeed, the best known attack on OMAC is the folklore birthday attack achieving a lower bound of $\Omega(q^2/2^n)$. In this work, we close this gap for a large range of message lengths. Specifically, we show that OMAC's PRF security is upper bounded by $O(q^2/2^n + q\ell^2/2^n)$. In practical terms, this means that for a $128$-bit block cipher, and message lengths up to $64$ Gigabyte, OMAC can process up to $2^{64}$ messages before rekeying (same as the birthday bound). In comparison, the previous bound only allows $2^{48}$ messages. As a side-effect of our proof technique, we also derive similar tight security bounds for XCBC (by Black and Rogaway) and TMAC (by Kurosawa and Iwata). As a direct consequence of this work, we have established tight security bounds (in a wide range of $\ell$) for all the CBC-MAC variants, except for the original CBC-MAC.

##### Metadata
Available format(s)
Category
Secret-key cryptography
Publication info
A major revision of an IACR publication in ASIACRYPT 2022
Keywords
OMAC CMAC XCBC tMAC CBC-MAC PRF tight security
Contact author(s)
s c 2357 @ gmail com
ashwin jha1991 @ gmail com
mridul nandi @ gmail com
History
2022-09-19: approved
2022-09-17: received
See all versions
Short URL
https://ia.cr/2022/1234
License

CC BY

BibTeX

@misc{cryptoeprint:2022/1234,
author = {Soumya Chattopadhyay and Ashwin Jha and Mridul Nandi},
title = {Towards Tight Security Bounds for OMAC, XCBC and TMAC},
howpublished = {Cryptology ePrint Archive, Paper 2022/1234},
year = {2022},
note = {\url{https://eprint.iacr.org/2022/1234}},
url = {https://eprint.iacr.org/2022/1234}
}

Note: In order to protect the privacy of readers, eprint.iacr.org does not use cookies or embedded third party content.


text:
# Analytic Number Theory/Characters and Dirichlet characters

## Definitions, basic properties

Definition 4.1

Let ${\displaystyle G}$ be a finite group. A character of G is a function ${\displaystyle f:G\to \mathbb {C} }$ such that

1. ${\displaystyle \forall \sigma ,\tau \in G:f(\sigma \tau )=f(\sigma )f(\tau )}$ and
2. ${\displaystyle \exists \rho \in G:f(\rho )\neq 0}$.

Lemma 4.2:

Let ${\displaystyle G}$ be a finite group and let ${\displaystyle f:G\to \mathbb {C} }$ be a character. Then

${\displaystyle \forall \sigma \in G:|f(\sigma )|=1}$.

In particular, ${\displaystyle \forall \sigma \in G:f(\sigma )\neq 0}$.

Proof:

Since ${\displaystyle G}$ is finite, each ${\displaystyle \sigma \in G}$ has finite order ${\displaystyle n:=\mathrm {ord} (\sigma )}$. Furthermore, let ${\displaystyle \rho \in G}$ such that ${\displaystyle f(\rho )\neq 0}$; then ${\displaystyle f(\rho )=f(\sigma )f(\sigma ^{-1}\rho )}$ and thus ${\displaystyle f(\sigma )\neq 0}$. Hence, we are allowed to cancel and

${\displaystyle |f(\sigma )|=|f(\sigma ^{n+1})|=|f(\sigma )|^{n+1}\Rightarrow |f(\sigma )|=1}$.${\displaystyle \Box }$

Lemma 4.3:

Let ${\displaystyle G}$ be a finite group and let ${\displaystyle f,g:G\to \mathbb {C} }$ be characters. Then the function ${\displaystyle h:G\to \mathbb {C} ,h(\tau ):=f(\tau )\cdot g(\tau )}$ is also a character.

Proof:

${\displaystyle h(\sigma \tau )=f(\sigma \tau )g(\sigma \tau )=f(\sigma )g(\sigma )f(\tau )g(\tau )=h(\sigma )h(\tau )\neq 0}$,

since ${\displaystyle \mathbb {C} }$ is a field and thus free of zero divisors.${\displaystyle \Box }$

Lemma 4.4:

Let ${\displaystyle G}$ be a finite group and let ${\displaystyle f:G\to \mathbb {C} }$ be a character. Then the function ${\displaystyle g:G\to \mathbb {C} ,g(\tau ):={\frac {1}{f(\tau )}}}$ is also a character.

Proof: Trivial, since ${\displaystyle \forall \tau \in G:f(\tau )\neq 0}$ as shown by the previous lemma.${\displaystyle \Box }$

The previous three lemmas (or only the first, together with a few lemmas from elementary group theory) justify the following definition.

Definition 4.5

Let ${\displaystyle G}$ be a finite group. Then the group

${\displaystyle \{f:G\to \mathbb {C} |f{\text{ is a character }}\}=\mathrm {Hom} (G,\mathbb {C} ^{\times })}$

is called the character group of ${\displaystyle G}$.

## Required algebra

We need the following result from group theory:

Lemma 4.6

Let ${\displaystyle G}$ be a finite Abelian group, let ${\displaystyle H\leq G}$ be a subgroup of order ${\displaystyle n\in \mathbb {N} }$, and let ${\displaystyle \tau \in G\setminus H}$ such that ${\displaystyle k\in \mathbb {N} }$ is the smallest number such that ${\displaystyle \tau ^{k}\in H}$. Then the group

${\displaystyle N:=\{\tau ^{n}\sigma |\sigma \in H\}}$

is a subgroup of ${\displaystyle G}$ containing ${\displaystyle H}$ of order ${\displaystyle k\cdot n}$.

Proof:

Since ${\displaystyle G}$ is the disjoint union of the cosets of ${\displaystyle H}$, ${\displaystyle N}$ is the disjoint union ${\displaystyle \bigcup _{j=0}^{n-1}\tau ^{j}H}$, as ${\displaystyle \rho H=H\Leftrightarrow \rho \in H}$ and ${\displaystyle \tau ^{l}H=\tau ^{m}H\Leftrightarrow \tau ^{l-m}\in H\Leftrightarrow k|(l-m)}$. Hence, the cardinality of ${\displaystyle N}$ equals ${\displaystyle k\cdot n}$.

Furthermore, if ${\displaystyle \tau ^{l}\sigma ,\tau ^{m}\rho \in N}$, then ${\displaystyle \tau ^{l}\sigma (\tau ^{m}\rho )^{-1}=\tau ^{l-m}\sigma \rho ^{-1}\in N}$, and hence ${\displaystyle N}$ is a subgroup.${\displaystyle \Box }$

format: plain


text:
# Boltzmann, Entropy, and KL Divergence

Right above Boltzmann’s bust at his grave is this line: \begin{align} S = k \log W. \end{align}

This is Boltzmann’s definition of entropy. Boltzmann considers this statement the greatest achievement of his life, so he asked to have it engraved on his tomb.

This definition follows directly from the multiplicity assumption in statistical mechanics. In physics textbooks, we sometimes use $\Omega$ for multiplicity instead of $W$ \begin{align} S = k_\beta \ln{\Omega}. \end{align}

In a statistical ensemble, the state space for a quantized discrete system is equivalent to the multiplicity of the statistical ensemble under discussion. The Liouville’s Theorem argues that under Hamiltonian mechanics, the points in a statistical ensemble form an incompressible liquid. By showing that flow lines in the phase space under Hamiltonian dynamics can not cross each other, we can prove that the phase volume of the ensemble stays constant. As a result, in a reversible process, the multiplicity of an ensemble is conserved.

Intuitively then, the multiplicity of a system is a product of that of its constitutes \begin{align} \Omega_{\text{system}} = \Omega_a \Omega_b …, \end{align} and this entity is uniquely described by thermodynamic variables. In the case of an ideal gas, $\Omega (V, N, E)$ is such a state function.

Now because we want this quantity to extend linearly as we increase the volume ($V$), the total energy ($E$) and the number of particles ($N$), it is the logarithm of $\Omega$ that is more suitable. This is called the extensivity requirement. This requirement allows us to treat the entropic state function as a first order homogeneous equation, and use Legendre’s transformation to derive other thermodynamic entities such as the Gibbs Free Energy, Enthalpy and so on. \begin{align} S (\lambda E, \lambda V, \lambda N) = \lambda S(E, V, N), \;\text{where}\; S = k_\beta \ln \Omega. \end{align}

#### Temperature

Now, we can derive the concept of temperature. Temperature is usually derived with the Canonical ensemble. Canonical ensemble describes a small system (usually quantized and discrete in the textbook) in thermal equilibrium with a larger thermal bath (thermostat). In addition the whole system is isolated with conserved overall energy. Now, because the multiplicity of the entire system has to be conserved, the overall phase volume of the combined system is at it’s maximum. Together with overall conservation of energy, we can show that in order for two systems to be in thermal “equal terms”, the following ratio has to equal \begin{align} \frac{1}{T} = \frac{\Delta{S_0}}{\Delta{E_0}} = \frac{\Delta{S_{bath}}}{\Delta{E_{bath}}}. \end{align} This, is the statistical mechanics’ definition of temperature. You can think of this definition as temperature being the constant that relates the marginal ratio between the energy labels for each macrostates versus the phase space that the macrostate occupies. For two systems to be in thermal equilibrium, both the multiplicity change and the energy transfer need to be conserved. This ratio that the two system shares is their temperature.

Note: the maximum phase volume assumption is essentially a Maximum Likelihood Estimation (MLE). You can similarly derive the Boltzmann distribution for a discrete system from this assumption alone.

Interestingly, by switching the sign of energy you can define negative temperature. Systems with bounded energy levels can have negative temperature, but ones without a bound can not. For these bounded systems (like in an Ising model), the system temperature can be swept up for $T \gt 0$ and down for $T \lt 0$. The temperature cannot cross zero though, and that is the third law of thermodynamics :)

#### Shannon’s Entropy

Now we need to derive Shannon’s entropy \begin{align} H = -\sum_{i}{P_i \cdot \log{P_i}}. \label{def_H} \end{align} Note the missing Boltzmann Constant in this defintion. The thermodynamic definition differs by a factor $k_\beta$.

Note: In thermodynamics, Boltsmann’s constant is an important factor not only in grounding the entropy in real units, but also making sure that terms are at the correct scale. $k_\beta$ is roughly $1/N_A$ where $N_A$ is the Avogadro’s number. Thus in the thermodynamic limit where the partition function has a factor of $N \;\mathrm{mole}$ in the front, $k_\beta$ keeps the terms close to 1.

To derive $\eqref{def_H}$, we need the partition function. We will again work with the Canonical ensemble. Suppose the small system in the ensemble has two microstates $1$ and $2$, then the relative probability between the occurrence of these states would be \begin{align} \frac{P_1}{P_2} = e^{-\Delta{E}/k_\beta T}. \label{rel_P} \end{align} The minus sign comes from the following: we assume that the entropy of the two microstates are both 0 because there is no disorder. Now because the overall combined system need to have its multiplicity conserved, the likelihood of $1$ happening over $2$ is one over the probability of states for the rest of the combined system.

Now $\eqref{rel_P}$ can only be true if the probability is \begin{align} P_i = Z^{-1} \cdot e^{- \beta \epsilon_i} \label{def_P} \end{align} and the partition function for the total probability \begin{align} Z = \sum_i{e^{-\beta\epsilon_i}}. \end{align}

Note that in physics, the partition function $Z$ is an important quantity from which every important thermal dynamic variable can be derived. For example the energy of the system (expected value of) is \begin{align} \langle E \rangle & = Z^{-1}\sum_i{\epsilon_i \cdot e^{- \beta \epsilon_i}} \\ & = - \frac{\partial{ \ln{Z}}}{\partial \beta}. \end{align} Similarly, we know that \begin{align} A = - k_\beta T \ln Z \end{align} where $A$ is the Helmholtz Free Energy. It is usually derived via Legengre Transformation from entropy. Now remeber \begin{align} A = U - TS, \end{align} therefore \begin{align} T S = U - A \end{align} \begin{align} S =k_\beta \ln{Z} - T^{-1} \frac{\partial{\ln{Z}}}{\partial{\beta}} \end{align} now take out a factor of $k_\beta$, and use $\eqref{def_P}$, we get Shannon’s information entropy (eq. 5.31, page 89, Sturge) \begin{align} S & = - k_\beta \ln {\big[Z^{-1} \cdot e^{-\beta E}\big]}\\ & = - k_\beta \sum{ P_i \ln{P_i} }. \end{align}

Note: $A$, $S$, $G$ (Gibbs free energy), and $H$ (enthalpy) are four main thermodynamic entities that are related by Legengre Transformation. There are 12 entities related this way but these four are the most commonly used in thermodynamics.

#### Interpretation

Equation $\eqref{def_H}$ can be rewritten as the expected value of $\ln{P_i^{-1}}$ \begin{align} H & = \langle \ln{ P^{-1} }\rangle \\ & = \sum{P_i \ln{\frac{1}{P_i}}}. \end{align} It makes sense that in a distribution, $\ln{(1/P_i)}$ is the amount of information that such event $i$ carries. Consequently, the expected value of $\ln(1/P_i)$ over all possible events ${i}$ is the information entropy of the distribution. This information is the logarithm of the volume of the ensemble in the phase space. Therefore entropy describes the amount of disorder a distribution contains.

$H(x) \ge 0$, entropy is always non-negative. $H_x = 0$ when $X$ is deterministic.

#### Joint Entropy

Between two distributions $X$ and $Y$ \begin{align} H(X,\;Y) &= - E_{x,\;y}\langle\ln P(X,Y)\rangle \\ &=\sum_{x,\,y} p(x,\,y) \frac{1}{p_{x,\,y}} \end{align}

#### Conditional Entropy

The conditional entropy of two distributions $X$ and $Y$ is \begin{align} H(X\,|\,Y) = \sum_{x,\;y}{P(x_i, y_i) \ln{\frac{P(y_i)}{P(x_i, y_i)}}}. \end{align} To derive, use Bayes’ Law.

Notice that $H(X|Y)\neq H(Y|X)$.

It is also easy to develop the chain rule $H(X, Y ) = H(X) + H(Y |X)$ and a corollary $H(X, Y |Z) = H(X|Z) + H(Y |X, Z)$

Now let’s summarize what we have so far.

• Entropy $H(X)$ is the log of state space (uncertainty) or “self-information” of a single random variable (probability distribution).
• Conditional entropy $H(X|\,Y)$ is the entropy of one random variable conditioned upon the knowledge of another.

• The reduction in uncertainty from $H(X)$ to $H(X|\,Y)$ is the mutual information \begin{align} I(X;\,Y) := H(X) - H(X|\,Y). \end{align}

• incidentally, the channel capacity $C$ of a communication channel is defined as $C = \max_{p(X)} I(X;\,Y)$

#### Relative Entropy (Kullback-Leibler Divergence)

The KL divergence is now looking very similar to the conditional entropy defined above sans a negative sign. Typically, $P$ represents the “true” distribution (data) and the $Q$ represents a model or a theory. \begin{align} KL(P\,\Vert\,Q) &= \bigg\langle\ln{\frac{P_{(x)}}{Q_{(x)}}} \bigg\rangle\\ &=\sum{P_i \ln{\frac{P_i}{Q_i}}}. \end{align} This is consistent with the meaning that $KL$ divergence is the difference between distibution $P$ on $Q$. Notice that

• $KL(P\,\Vert\,Q)$ is asymmetric (hence not a true metric)
• semi-definite: $\forall P, Q,\; KL(P\,\Vert\,Q) \ge 0.$
• linearlly additive for independent $P_i$’s and $Q_i$’s.

The semi-definitiness can be proven via Gibbs inequality.

#### Mutual Information (Interms of divergence)

The mutual information can be expressed in terms of the KL divergence \begin{align} I(X;\,Y) := KL(p(x,y)\,\Vert\,p(x)\,p(y)) \end{align} This is the information gained when moving from a model that assumes independence between $x$ and $y$ to their joint distribution.

#### Von Neumann Entropy in Quantum Systems

To adapte this classical definition of entropy to quantum mechanics, we can just use density matrix and the trace instead (via Von Neumann) \begin{align} H = - k_\beta \mathrm{Tr} (\rho \ln \rho). \end{align}


text:
• Corpus ID: 209832444

# Tur\'an problems for Edge-ordered graphs.

@article{Gerbner2020TuranPF,
title={Tur\'an problems for Edge-ordered graphs.},
author={D{\'a}niel Gerbner and Abhishek Methuku and D{\'a}niel T. Nagy and Domotor P'alvolgyi and G{\'a}bor Tardos and M{\'a}t{\'e} Vizer},
journal={arXiv: Combinatorics},
year={2020}
}
• Published 3 January 2020
• Mathematics
• arXiv: Combinatorics
In this paper we initiate a systematic study of the Turan problem for edge-ordered graphs. A simple graph is called $\textit{edge-ordered}$, if its edges are linearly ordered. An isomorphism between edge-ordered graphs must respect the edge-order. A subgraph of an edge-ordered graph is itself an edge-ordered graph with the induced edge-order. We say that an edge-ordered graph $G$ $\textit{avoids}$ another edge-ordered graph $H$, if no subgraph of $G$ is isomorphic to $H$. The $\textit{Turan… 2 Citations ## Figures from this paper Saturation of Ordered Graphs • Mathematics • 2022 Recently, the saturation problem of 0-1 matrices gained a lot of attention. This problem can be regarded as a saturation problem of ordered bipartite graphs. Motivated by this, we initiate the study The number of tangencies between two families of curves • Mathematics ArXiv • 2021 We prove that the number of tangencies between the members of two families, each of which consists of n pairwise disjoint curves, can be as large as Ω( n 4 / 3 ) . We show that from a conjecture ## References SHOWING 1-10 OF 42 REFERENCES Increasing Paths in Edge-Ordered Graphs: The Hypercube and Random Graph • Mathematics Electron. J. Comb. • 2016 Borders on f are given on the hypercube and the random graph G(n,p) for which the parameter f was first studied for G=K_n and has subsequently been studied for other families of graphs. On edge‐ordered Ramsey numbers • Mathematics Random Struct. Algorithms • 2020 It is proved that for every edge-ordered graph$H$on$n$vertices, the authors have$r_{edge}(H;q) \leq 2^{c^qn^{2q-2}\log^q n}$, where$c$is an absolute constant. Monotone Paths in Dense Edge-Ordered Graphs The altitude of a graph$G$, denoted$f(G)$, is the largest integer$k$such that under each ordering of$E(G)$, there exists a path of length$k$which traverses edges in increasing order. In 1971, Non-crossing monotone paths and binary trees in edge-ordered complete geometric graphs • Mathematics Acta Mathematica Hungarica • 2021 An edge-ordered graph is a graph with a total ordering of its edges. A path$P=v_1v_2\ldots v_k$in an edge-ordered graph is called increasing if$(v_iv_{i+1}) > (v_{i+1}v_{i+2})$for all$i =
Statistics of orderings
• Mathematics
• 2017
In this paper, we study a Ramsey type problems dealing with the number of ordered subgraphs present in an arbitrary ordering of a larger graph. Our first result implies that for every vertex ordered
On the Turán number of ordered forests
• Mathematics
Electron. Notes Discret. Math.
• 2017
Bipartite Tur\'an problems for ordered graphs
• Mathematics
• 2019
A zero-one matrix $M$ contains a zero-one matrix $A$ if one can delete some rows and columns of $M$, and turn some 1-entries into 0-entries such that the resulting matrix is $A$. The extremal number
Forbidden paths and cycles in ordered graphs and matrices
• Mathematics
• 2006
At most how many edges can an ordered graph ofn vertices have if it does not contain a fixed forbidden ordered subgraphH? It is not hard to give an asymptotically tight answer to this question,
Increasing Hamiltonian paths in random edge orderings
• Mathematics
Random Struct. Algorithms
• 2016
The surprising result that in the random setting, S(f) often takes its maximum possible value of n – 1 (visiting all of the vertices with an increasing Hamiltonian path) is discovered, suggesting that this Hamiltonian (or near-Hamiltonian) phenomenon may hold asymptotically almost surely.
Nearly-linear monotone paths in edge-ordered graphs
• Mathematics
• 2018
How long a monotone path can one always find in any edge-ordering of the complete graph K n ? This appealing question was first asked by Chvátal and Komlós in 1971, and has since attracted the


text:
# Fuel Consumption Calculator

Created by Kenneth Alambra
Reviewed by Purnima Singh, PhD
Based on research by
John Misachi WorldAtlas (October 6th 2017)
Last updated: Nov 20, 2022

This fuel consumption calculator will help you estimate the amount of fuel a vehicle consumes at particular distances like 100 km, 10 km, and miles, to name a few, which we commonly use in determining fuel or gas consumption. In this calculator, you will learn:

• What fuel consumption is;
• How to use this fuel consumption calculator; and
• How to calculate the fuel consumption of a vehicle.

Keep on reading to start learning.

## What is fuel consumption?

When we travel by land using a fuel-powered vehicle, we either spend too much on fuel or don't really care about it (talk about life goals). However, for most of us who want to budget our travels, knowing our vehicle's fuel or gas consumption from a recent long trip can help us plan our future rides better.

Fuel consumption is a measure of how efficiently a vehicle uses up fuel, comparable to fuel economy (or fuel efficiency). Fuel economy quantifies a car's efficiency by how far a vehicle travels using a particular amount of fuel, i.e., in miles per gallon (MPG) or kilometers per liter (kmpl). On the other hand, fuel consumption tells us how much fuel a vehicle burns fuel at a certain distance, e.g., in liters per kilometer (L/km) or liters per 100 kilometers (L/100km).

## How to calculate the fuel consumption of a vehicle

Let's say we want to know a vehicle's fuel consumption that consumes two full tanks, in this case, 100 liters, to travel a total distance of 1320 km from France to Italy with some detours. To find the fuel consumption of this vehicle, we can substitute our known parameters in this fuel consumption formula to have:

\scriptsize \begin{align*} \text{Fuel consumption} &= \frac{\text{Fuel used}}{\text{Distance traveled}}\\\\ &= \frac{100\ \text{L}}{1320\ \text{km}}\\\\ &= 0.07576\ \tfrac{\text{L}}{\text{km}}\\\\ \end{align*}

From our calculation, we found that the vehicle consumes 0.07576 liters of fuel per kilometer. For a better perspective, we can convert it to the more typical unit of liters per 100 kilometers by multiplying our calculated value by $100 \text{km}/100 \text{km}$, as shown below:

\scriptsize \begin{align*} \text{Fuel consumption} &= 0.07576\ \tfrac{\text{L}}{\text{km}}\times \frac{100\ \text{km}}{100\ \text{km}}\\\\ &= 7.576\ \tfrac{\text{L}}{100\ \text{km}} \end{align*}

Now that is easier to imagine. 🙂

💡 Consequently, if you know the fuel efficiency of your vehicle, you can simply take its reciprocal to find your vehicle's fuel consumption, as shown in this fuel consumption formula:

$\scriptsize{\text{Fuel consumption} = \frac{1}{\text{Fuel efficiency}}}$

## How to use this fuel consumption calculator

For faster fuel or gas consumption calculation, you can use our calculator by entering the distance traveled and the fuel used to determine the fuel consumption instantly.

You can also use our fuel consumption calculator in Advance mode to display the equivalent fuel efficiency of your vehicle and to enter the fuel price to calculate your total trip cost in terms of fuel.

If you want to learn more about fuel usage of vehicles, particularly regarding the economy of consuming fuel, here is a list of our other fuel and gas consumption calculators you can check out:

## FAQ

### How do I calculate fuel cost per mile?

To calculate fuel cost per mile, say a vehicle traveled 45 miles and used 1.75 US gallons of fuel:

1. First, determine the fuel consumption by dividing the fuel used by the distance traveled: 1.75 US gallons ÷ 45 miles = 0.03889 gal/mi (US).
2. Then, multiply the fuel consumption by the fuel price, say $8 per US gallon. We then have 0.03889 gal/mi (US) ×$8 per US gallon = $0.31111/mi ≈ $0.31/mi.

### How do I calculate fuel consumption per 100 km?

To calculate fuel consumption per 100 km, divide the amount of fuel used in liters by the distance in kilometers and multiply the product by 100. If you want to find the fuel consumption per 10 km, perform the same first step but multiply the product by 10 instead of 100.

Kenneth Alambra
Distance traveled
mi
Fuel used
US gal
Fuel consumption
gal/mi (US)
People also viewed…

### Christmas tree

Welcome to the Christmas tree calculator, where you will find how to decorate your Christmas tree in the best way. Take a look at the perfect Christmas tree formula prepared by math professors and improved by physicists. Plan in advance how many lights and decorations you'll need!

### Crosswind

Use this crosswind calculator to find the crosswind, headwind, and tailwind components affecting your aircraft or vehicle.

### Jeans size

The jeans size calculator will help you find your perfect pair of jeans!

### Meat footprint

Check out the meat impact - on the environment and your health.


text:
Get Rs Number Based On Position (6 million SNPs)
5
0
Entering edit mode
5.5 years ago
joshf ▴ 20

I know this question has sort of been asked before....but I need to know which method would be the most efficient way to get the Rs numbers based on position (hg19)

I've considered looping through two files, the .txt file (with the positions) and a .vcf file with all known variants from Kaviar Genomic Variant Database, locally...but that would take forever...

would installing a partial UCSC genome MySQL database locally be a better idea?

Any suggestion would be great...be as detailed as possible pls :).

PS: This .txt file is an output from METAL, and unfortunately I need all 6.4M SNPs for my project at this point

SNP • 4.1k views
1
Entering edit mode
5.5 years ago

I have following questions:

1) Do you have variants (~6 m SNVs) annotated with dbSNP?

2) What are the outputs supported by METAL and Would you please share a link to METAL?

0
Entering edit mode

well, I only received the METAL output TXT file so I don't actually know how it works, but it has the chromosomal position and p-value which are important to me. Usually I would have to filter by p-value, but for this particular project I can't....and no, nothing's been annotated

0
Entering edit mode

Thanks for the reply. From the link you have provided, it seems rsnumbers are provided in first column of file " 'METAANALYSIS1.TBL" (section 5.5). Could you please post first few lines of the output text here?

1) I guess you are looking for rs positions given rs id as rs ids are already present in output (as mentioned in the link provided above).

2) Your question seems to be other way round. Given a position, you are looking for rsid.

0
Entering edit mode

in this case instead of the rs numbers I was given chr:pos as the SnpID. I have the positions, but what I'm missing are the rs numbers...sorry for the confusion, and thanks for your help!

first 10 lines:

SNPID Allele1 Allele2 Freq1 FreqSE MinFreq MaxFreq Effect StdErr P Direction HetISq HetChiSq HetDf HetPVal CHR BP

5:29439275 t c 0.3751 0.0198 0.3168 0.4092 0.0100 0.0213 0.6397 +---+--+-+-+- 0.0 8.190 12 0.7701 5 29439275
5:85928892 t c 0.0643 0.0036 0.0626 0.0782 0.0916 0.0548 0.09478 +????+??-?-?? 45.1 5.462 3 0.1409 5 85928892
11:79226604 t c 0.1580 0.0117 0.1103 0.1875 -0.0301 0.0270 0.2644 -+---+-+----? 0.0 7.652 11 0.7441 11 79226604
10:45271908 c g 0.1391 0.0082 0.1056 0.1652 -0.0076 0.0296 0.7965 -+-?-+++----? 0.0 7.870 10 0.6415 10 45271908
15:80233956 t c 0.2009 0.0172 0.1191 0.2224 -0.0030 0.0256 0.9057 ++++----++--? 0.0 6.415 11 0.8443 15 80233956
10:128341232 t c 0.4460 0.0196 0.4298 0.5305 -0.0120 0.0205 0.5564 +------++++-- 15.9 14.269 12 0.2839 10 128341232
8:13397768 a g 0.8479 0.0100 0.8204 0.8662 0.0050 0.0284 0.8615 +-+---++++++? 11.4 12.413 11 0.3334 8 13397768
7:156821965 a g 0.0357 0.0039 0.0310 0.0390 -0.0336 0.0915 0.7138 -?????????-?? 0.0 0.040 1 0.8417 7 156821965
16:82370655 a g 0.1119 0.0062 0.1036 0.1267 -0.0205 0.0351 0.5589 ----?++-+?+-? 0.0 7.649 9 0.5698 16 82370655

0
Entering edit mode

1) Your data is not sorted by chromosome and coordinates.

2) Here is the way I see a simple, but round about work:

• Data has around 17 columns. Extract chromosome number, coordinate, bases (ref and alt), in that order into a separate text file.
• Now you will have chromosome number, base position, two bases (ref and alt) in new file.
• Duplicate base position and paste it next to existing base position column. Now the file will have five columns: Chromosome, Base position, Base position, Ref base and alt base
• Install bedtools.
• Use intersect command. This would not only fetch the dbSNP IDs for your variants, it would fetch other important information as well from dbSNP.

Following is the example code (on linux):

1) I copy/pasted first three lines (variants on chr5, including header) from furnished example (above) and saved it as chr5.txt
2) Using awk i extracted chromosome, position, ref and alt alleles. In the process I duplicated position column twice. (this is to make a bed file)

 command: awk '{print $16,$17,$17,$2,\$3}' chr5.txt > chr5.bed

3) Made sure that each column is separated by a tab as the original columns are not tab separated

command: tail -n +2 chr5.bed > chr5_1.bed

5) Used bedtools to intersect chr5_1.bed file with chr5.dbsnp141.hg19.vcf. (note that output file is not supplied. User can provide an output file to save the results)

command: bedtools intersect  -a chr5_1.bed -b chr5.dbsnp141.vcf -wb

6) Output is given below.

5    29439275    29439275    t    c    5    29439275    rs667647    T    C    .    .    RS=667647;RSPOS=29439275;RV;dbSNPBuildID=83;SSR=0;SAO=0;VP=0x050100000005170517000100;WGT=1;VC=SNV;SLO;ASP;VLD;G5A;G5;HD;GNO;KGPhase1;KGPROD;OTHERKG;PH3;CAF=[0.5037,0.4963];COMMON=1
5    85928892    85928892    t    c    5    85928892    rs113534962    C    T    .    .    RS=113534962;RSPOS=85928892;dbSNPBuildID=132;SSR=0;SAO=0;VP=0x050000000005140116000100;WGT=1;VC=SNV;ASP;VLD;GNO;KGPhase1;KGPROD;OTHERKG;CAF=[0.8898,0.1102];COMMON=1

7) Original records I started with:

SNPID Allele1 Allele2 Freq1 FreqSE MinFreq MaxFreq Effect StdErr P Direction HetISq HetChiSq HetDf HetPVal CHR BP
5:29439275 t c 0.3751 0.0198 0.3168 0.4092 0.0100 0.0213 0.6397 +---+--+-+-+- 0.0 8.190 12 0.7701 5 29439275
5:85928892 t c 0.0643 0.0036 0.0626 0.0782 0.0916 0.0548 0.09478 +????+??-?-?? 45.1 5.462 3 0.1409 5 85928892
0
Entering edit mode

yes, thank you so much for your help! this was exactly what I was looking for

0
Entering edit mode

dbSNP files are huge and it would take considerable time for intersecting two big files.  If you have time and familiar with R, try data.table. Authors claim to it to be fastest in intersection/overlaps. I would suggest recently implemented foverlaps function in data.table package.

0
Entering edit mode
5.5 years ago

0
Entering edit mode

could you elaborate a bit? how can I use tabix to get the rs numbers from the VCF file?

0
Entering edit mode
5.5 years ago
Veera ▴ 90

Use GenomicRanges package from bioconductor in R to overlap the your position file and the downloaded bed file.
Subset only the SNPs from overlapped region.

But you need to know to use GenomicRanges package for this. Its very fast and easy to do.

0
Entering edit mode
4.0 years ago
ShirleyDai ▴ 40

Hello, I just saw your output from METAL has the column "CHR" and "BP". Can you post you metal script as how to add these two variables to the result file. Because I have searched the whole website but cannot find a solution, so I came here to ask if you can help... Thanks Shirley

0
Entering edit mode
4.0 years ago
Bioaln ▴ 340

To avoid the double looping, try and hash parts of the genome for easier access (key region, depends on your RAM, in limit there is a key->acc mapping). This can reduce the computational time significantly.


text:
## An adaptive $hp$-refinement strategy with computable guaranteed bound on the error reduction factor. (arXiv:1712.09821v1 [math.NA])

We propose a new practical adaptive refinement strategy for $hp$-finite element approximations of elliptic problems. Following recent theoretical developments in polynomial-degree-robust a posteriori error analysis, we solve two types of discrete local problems on vertex-based patches. The first type involves the solution on each patch of a mixed finite element problem with homogeneous Neumann boundary conditions, which leads to an ${\mathbf H}(\mathrm{div},\Omega)$-conforming equilibrated flux. This, in turn, yields a guaranteed upper bound on the error and serves to mark mesh vertices for refinement via D\"orfler's bulk-chasing criterion. The second type of local problems involves the solution, on patches associated with marked vertices only, of two separate primal finite element problems with homogeneous Dirichlet boundary conditions, which serve to decide between $h$-, $p$-, or $hp$-refinement. Altogether, we show that these ingredients lead to a computable guaranteed bound on the 查看全文>>


text:
Abel's Limit Theorem

Theorem

Let $\sequence {a_i}$ be a convergent series.

The limit which is assigned by the Abel summation method exists and equals the sum of the series.

Source of Name

This entry was named for Niels Henrik Abel.


text:
# Small health bar above entity is drawn differently when the entity is rotated differently

Here is a simple positioning code for my health bar:

transform.position = Camera.main.WorldToScreenPoint(target.position - 0.2f * target.up);

Here is the prefab:

• HealthBar is middle-center anchored, and 0.5, 0.5 pivoted,
• Background and Fill are stretched and 0.5, 0.5 pivoted, but background is Left, Right, Top, Bottom -1 positioned.

Here is how it should look: (all images are zoomed in)

And here is a video about the entity rotating around: https://i.imgur.com/EOzFEvt.mp4

2 example rotations, in which the health bar is drawn incorrectly: (see the border of the bar)

Why?

Edit: Another interesting artifact:

• If I'm moving the camera up, the healthbars are offsetted up a bit, and if I start moving down, it's instantly offsetted down, with left and right the same, etc. As soon as I stop, it's at the correct position, but as soon as I start moving, it becomes offsetted to the direction I'm moving.

See gif: https://i.imgur.com/K8mwzTW.mp4

Fix for this: Place it in LateUpdate.

• is your positioning code running in Update? are you moving the background or the healthbar? how are they parented? – formatc2013 Mar 28 at 12:52
• It was in update, but it was a bit laggy, so moved it to FixedUpdate. I'm moving the whole object, the HealthBar. The red part is an image with a correctly set Fill property. – Tudvari Mar 28 at 15:37

It looks like you're using Unity's 2D Pixel Perfect package, with Pixel Snapping toggled on in the Pixel Perfect Camera component.

That can cause effects like this, as the float-valued positions of your components get snapped inconsistently. In this case, as your character rotates, the background and fill of your healthbar are snapping differently, causing the bar and border to fluctuate in size/shape.

I'll go over some of the causes I've seen, but I imagine there are many more.

Asset design:

This is the big one: Building your art exactly to match your intended pixel sizes can remove a lot of snapping issues.

E.g. if you're targeting 640x480, and you want your health bar to be roughly 5% of the screen wide, you might create a 32x8 background and set the PPU appropriately. Then if you want a fill inset by 1 pixel, you create another 32x8 piece of art with the outer 1 pixel transparent, and position it atop the other. Then, you need to round your fill values so that they match the 30 pixels of fill you have.

With same-size art, pixel snapping should be consistent, and you shouldn't see the artifacts in your question.

Canvas sizing:

Canvas objects commonly have scale values with numbers like "0.05770617", which does not map to integer values well. You may need to configure your canvases differently, perhaps avoiding Screen Space - Camera/Overlay entirely. (I have not had to avoid them in my projects, but it could be an issue in yours.)

Object positioning

You may need to manually snap some object positions to 'safe' values, if the engine isn't doing it correctly for you.

E.g., maybe you need to round the position of your health bar to the nearest 1/16th of a unit, because that works in your testing.

Object positioning and floating point precision

If you calculate positions and forget float issues, you might end up failing when you try to overlay two objects. E.g., giving one with position x=0.3 and another with x=(0.2 + 0.1), you may find that they snap differently once in awhile.

Editor scale:

Lastly, even with everything above correct, using power-of-two-friendly scales in the Game tab can help reduce this in-editor, e.g. 0.5x, 1x, 2x.

• I do not use the pixel perfect package :\ But could your points be still valid? – Tudvari Mar 28 at 19:59
• Another interesting artifact: If I'm moving the camera up, the healthbars are offsetted up a bit, and if I start moving down, it's instantly offsetted down, with left and right the same, etc. As soon as I stop, it's at the correct position, but as soon as I start moving, it becomes offsetted to the direction I'm moving. – Tudvari Mar 28 at 21:22
• Are you using something similar? The pixels of your character seem to be snapping as well, which is why I guessed it might be that package. – Chris Mills-Price Mar 28 at 22:13
• Not really. Only a basic orthographic camera, and an overlay canvas. – Tudvari Mar 29 at 7:12
• I cropped the floats to integers, and now seems okay for now. Thanks! The only problem now is that when I move, it's offsetted for some reason. – Tudvari Mar 29 at 14:29


text:
# The Legal Environment of Business, v. 1.0

by Don Mayer, Daniel M. Warner, George J. Siedel, and Jethro K. Lieberman

## 11.1 Introduction to Secured Transactions

### Learning Objectives

1. Recognize, most generally, the two methods by which debtors’ obligations may be secured.
2. Know the source of law for personal property security.
3. Understand the meaning of security interest and other terminology necessary to discuss the issues.
4. Know what property is subject to the security interest.
5. Understand how the security interest is created—”attached”—and perfected.

## The Problem of Security

Creditors want assurances that they will be repaid by the debtor. An oral promise to pay is no security at all, and—as it is oral—it is difficult to prove. A signature loanA loan for which no collateral is pledged. is merely a written promise by the debtor to repay, but the creditor stuck holding a promissory note with a signature loan only—while he may sue a defaulting debtor—will get nothing if the debtor is insolvent. Again, that’s no security at all. Real security for the creditor comes in two forms: by agreement with the debtor or by operation of law without an agreement.

## By Agreement with the Debtor

Security obtained through agreement comes in three major types: (1) personal property security (the most common form of security); (2) suretyship—the willingness of a third party to pay if the primarily obligated party does not; and (3) mortgage of real estate.

## By Operation of Law

Security obtained through operation of law is known as a lienAn encumbrance upon property to secure payment.. Derived from the French for “string” or “tie,” a lien is the legal hold that a creditor has over the property of another in order to secure payment or discharge an obligation.

In this chapter, we take up security interests in personal property and suretyship. In the next chapter, we look at mortgages and nonconsensual liens.

## Basics of Secured Transactions

The law of secured transactions consists of five principal components: (1) the nature of property that can be the subject of a security interest; (2) the methods of creating the security interest; (3) the perfection of the security interest against claims of others; (4) priorities among secured and unsecured creditors—that is, who will be entitled to the secured property if more than one person asserts a legal right to it; and (5) the rights of creditors when the debtor defaults. After considering the source of the law and some key terminology, we examine each of these components in turn.

Here is the simplest (and most common) scenario: Debtor borrows money or obtains credit from Creditor, signs a note and security agreement putting up collateral, and promises to pay the debt or, upon Debtor’s default, let Creditor (secured party) take possession of (repossess) the collateral and sell it. Figure 11.1 "The Grasping Hand" illustrates this scenario—the grasping hand is Creditor’s reach for the collateral, but the hand will not close around the collateral and take it (repossess) unless Debtor defaults.

Figure 11.1 The Grasping Hand

## Source of Law

Article 9 of the Uniform Commercial Code (UCC) governs security interests in personal property. The UCC defines the scope of the article (here slightly truncated):Uniform Commercial Code, Section 9-109.

This chapter applies to the following:

1. A transaction, regardless of its form, that creates a security interest in personal property or fixtures by contract;
2. An agricultural lien;
3. A sale of accounts, chattel paper, payment intangibles, or promissory notes;
4. A consignment…

## Definitions

As always, it is necessary to review some definitions so that communication on the topic at hand is possible. The secured transaction always involves a debtor, a secured party, a security agreement, a security interest, and collateral.

Article 9 applies to any transaction “that creates a security interest.” The UCC in Section 1-201(35) defines security interestRight in personal property to secure payment or performance of an obligation. as “an interest in personal property or fixtures which secures payment or performance of an obligation.”

Security agreementAgreement that grants a security interest. is “an agreement that creates or provides for a security interest.” It is the contract that sets up the debtor’s duties and the creditor’s rights in event the debtor defaults.Uniform Commercial Code, Section 9-102(a)(73).

CollateralProperty given as security for a debt. “means the property subject to a security interest or agricultural lien.”Uniform Commercial Code, Section 9-102(12).

Purchase-money security interestThe security interest held by the seller of collateral to secure payment of all or part of the price. (PMSI) is the simplest form of security interest. Section 9-103(a) of the UCC defines “purchase-money collateral” as “goods or software that secures a purchase-money obligation with respect to that collateral.” A PMSI arises where the debtor gets credit to buy goods and the creditor takes a secured interest in those goods. Suppose you want to buy a big hardbound textbook on credit at your college bookstore. The manager refuses to extend you credit outright but says she will take back a PMSI. In other words, she will retain a security interest in the book itself, and if you don’t pay, you’ll have to return the book; it will be repossessed. Contrast this situation with a counteroffer you might make: because she tells you not to mark up the book (in the event that she has to repossess it if you default), you would rather give her some other collateral to hold—for example, your gold college signet ring. Her security interest in the ring is not a PMSI but a pledge; a PMSI must be an interest in the particular goods purchased. A PMSI would also be created if you borrowed money to buy the book and gave the lender a security interest in the book.

Whether a transaction is a lease or a PMSI is an issue that frequently arises. The answer depends on the facts of each case. However, a security interest is created if (1) the lessee is obligated to continue payments for the term of the lease; (2) the lessee cannot terminate the obligation; and (3) one of several economic tests, which are listed in UCC Section 1-201 (37), is met. For example, one of the economic tests is that “the lessee has an option to become owner of the goods for no additional consideration or nominal additional consideration upon compliance with the lease agreement.”

## Chattel Paper

Chattel is another word for goods. Chattel paper is a record (paper or electronic) that demonstrates both “a monetary obligation and a security interest either in certain goods or in a lease on certain goods.”Uniform Commercial Code, Section 9-102(11). The paper represents a valuable asset and can itself be used as collateral. For example, Creditor Car Company sells David Debtor an automobile and takes back a note and security agreement (this is a purchase-money security agreement; the note and security agreement is chattel paper). The chattel paper is not yet collateral; the automobile is. Now, though, Creditor Car Company buys a new hydraulic lift from Lift Co., and grants Lift Co. a security interest in Debtor’s chattel paper to secure Creditor Car’s debt to Lift Co. The chattel paper is now collateral. Chattel paper can be tangible (actual paper) or electronic.

## Documents

This category includes documents of title—bills of lading and warehouse receipts are examples.

## Instruments

An “instrument” here is “a negotiable instrument (checks, drafts, notes, certificates of deposit) or any other writing that evidences a right to the payment of a monetary obligation, is not itself a security agreement or lease, and is of a type that in the ordinary course of business is transferred by delivery with any necessary indorsement or assignment.” “Instrument” does not include (i) investment property, (ii) letters of credit, or (iii) writings that evidence a right to payment arising out of the use of a credit or charge card or information contained on or for use with the card.Uniform Commercial Code, Section 9-102(a)(47).

## Investment Property

This includes securities (stock, bonds), security accounts, commodity accounts, and commodity contracts.Uniform Commercial Code, Section 9-102(a)(49). Securities may be certified (represented by a certificate) or uncertified (not represented by a certificate).Uniform Commercial Code, Section 8-102(a)(4) and (a)(18).

## Other Types of Collateral

Among possible other types of collateral that may be used as security is the floating lienA lien that is expanded to cover any additional property that is acquired by the debtor while the debt is outstanding.. This is a security interest in property that was not in the possession of the debtor when the security agreement was executed. The floating lien creates an interest that floats on the river of present and future collateral and proceeds held by—most often—the business debtor. It is especially useful in loans to businesses that sell their collateralized inventory. Without the floating lien, the lender would find its collateral steadily depleted as the borrowing business sells its products to its customers. Pretty soon, there’d be no security at all. The floating lien includes the following:

• After-acquired property. This is property that the debtor acquires after the original deal was set up. It allows the secured party to enhance his security as the debtor (obligor) acquires more property subject to collateralization.
• Sale proceeds. These are proceeds from the disposition of the collateral. Carl Creditor takes a secured interest in Deborah Debtor’s sailboat. She sells the boat and buys a garden tractor. The secured interest attaches to the garden tractor.
• Future advances. Here the security agreement calls for the collateral to stand for both present and future advances of credit without any additional paperwork.

Here are examples of future advances:


text:
# [tex-live] Bug#564089: \FDP at colonspace is no longer defined in frenchb v2.3d (v2.4a is OK)

Manuel Pégourié-Gonnard mpg at elzevir.fr
Sat Jan 9 02:30:39 CET 2010

```On 09/01/2010 01:52, Vincent Lefevre wrote:
> On 2010-01-08 15:44:49 +0100, Norbert Preining wrote:
>> On Fr, 08 Jan 2010, Vincent Lefevre wrote:
>>> But will \renewcommand{\Fcolonspace}{\thinspace} still work in
>>> 10 years?
>>
Much more likely than using internal macros. LaTeX's system with @ in macros
names is quite clear : when using an @ macro of a packages, you're on your own.

>> Sorry, who cares? If you want that, use plain tex. Yes that is life
>> even in the TeX World. You probably can process all documents even
>> after loads of time, but probably they need some tweaking.
>>
>> As said, only because someone suggested to you to use internal
>> macros does not mean it is the right way.
>
> So, \renewcommand{\Fcolonspace}{\thinspace} is not correct either
> since it is not documented. Only ThinColonSpace=true is documented
> for the current version.

It is correct since it *was* documented, and is kept for compatibility, though
the new interface is recommended. It seems correct not to document the
compatibility measures. The point is that they are available, and they are.

> But this also means that Debian/stable is
> obsolete.
>


text:
Prove the following by using the principle of mathematical induction for all $$n \in\;N$$

$$1^3+2^3+3^3+.......+n^3=(\dfrac{n(n+1)}{2})^2$$

Asked by Abhisek | 1 year ago |  67

##### Solution :-

Let us denote the given equality by P(n), i.e.,

$$1^3+2^3+3^3+.......+n^3=(\dfrac{n(n+1)}{2})^2$$

For n=1,
L.H.S. 13=1

R.H.S.= $$( \dfrac{1(1+1)}{2})^2$$

= (1)2= 1

Therefore,P(n) is true for n=1.

Let us assume that P (k) is true for some positive integer k , i.e.,

$$1^3+2^3+3^3+.......+k^3=(\dfrac{k(k+1)}{2})^2$$ ..........(i)

Now, we have to prove that P(k+1) is also true.

Consider

$$1^3+2^3+3^3+.......+k^3(k+1)^3$$

$$( 1^3+2^3+3^3+.....+k^3)(k+1)^3$$

$$(\dfrac{k(k+1)}{2})^2+(k+1)^3$$......... [Using (i)]

$$(\dfrac{k^2(k+1)^2}{4})^2+(k+1)^3$$

$$\dfrac{k^2(k+1)^2+4(k+1)^3}{4}$$

$$\dfrac{(k+1)^2(k^2+4(k+1)}{4}$$

$$\dfrac{(k+1)^2(k+2)^2}{4}$$

$$\dfrac{(k+1)^2(k+1+1)^2}{4}$$

$$\dfrac{(k+1)(k+1+1)^2}{2}$$

Therefore,P (k+1)  holds whenever  P(k) holds.

Hence, the given equality is true for all natural numbers i.e., N by the principle of mathematical induction.

Answered by Pragya Singh | 1 year ago

### Related Questions

#### Given an example of a statement P (n) such that it is true for all n ϵ N.

Given an example of a statement P (n) such that it is true for all n ϵ N.

#### a + (a + d) + (a + 2d) + … + (a + (n-1)d) = n/2 [2a + (n-1)d]

a + (a + d) + (a + 2d) + … + (a + (n-1)d) = $$\dfrac{n}{2}$$ [2a + (n-1)d]

#### 72n + 23n – 3. 3n – 1 is divisible by 25 for all n ϵ N

72n + 23n – 3. 3n – 1 is divisible by 25 for all n ϵ N


text:
I would like to have multiple tables of contents in the document, each based on a simple filter, e.g. containing a specific word in the heading/section title. I may have multiple, but well-defined keywords and for each of them I would like to have a separate table of contents, i.e:

• \tableofcontents “implementation” <- table of contents of all chapters/sections containing the word “implementation” plus their parents
• \tableofcontents “design” <- table of contents of all chapters/subsections containing the word “design” plus their parents
• and so on

One could grep/sed the tex files to find these headings and then generate a list of links, but maybe it is possible to do it directly in latex?

Here is a mode detailed example:

\usepackage{mdframed}

\definecolor{MISRARuleBackgroundColor}{rgb}{0.86,0.88,0.94}
\definecolor{RuleBackgroundColor}{rgb}{0.86,0.94,0.88}
\definecolor{RuleBorderColor}{rgb}{0.29,0.39,0.68}

\newcommand{\MISRARule}[3]{\bigskip\begin{mdframed}[backgroundcolor=MISRARuleBackgroundColor,linecolor=RuleBorderColor,linewidth=1pt]\textbf{Rule #1 (#2)} \newline \textbf{#3} \label{#1}\end{mdframed}\nopagebreak See MISRA C++ 2008 \cite{MISRAC++2008}}

\newcommand{\Rule}[3]{\bigskip\begin{mdframed}[backgroundcolor=MISRARuleBackgroundColor,linecolor=RuleBorderColor,linewidth=1pt]\textbf{Rule #1 (#2)} \newline \textbf{#3} \label{#1}\end{mdframed}\nopagebreak}

.....

\Rule{A0-4-1}{required, toolchain, non-automated}{Floating-point implementation shall comply with IEEE 754 standard.}

\Rule{A0-4-3}{required, toolchain, automated}{The implementations in the chosen compiler shall strictly comply with the C++14 Language Standard.}

\MISRARule{M1-0-2}{required, implementation, non-automated}{Multiple compilers shall only be used if they have a common, defined interface.}

\MISRARule{M15-0-3}{required, implementation, automated}{Control shall not be transferred into a try or catch block using a goto or a switch statement.}

\Rule{A15-0-2}{required, implementation, partially automated}{At least the basic guarantee for exception safety shall be provided for all operations. In addition, each function may offer either the strong guarantee or the nothrow guarantee}

...

Then I  would write something like

\begin{appendix}

\chapter{Allocation of rules to work products}

\section{Rules related to toolchain}

# list here the table of contents / table of references to all rules that are allocated to "toolchain"
\tableofcontents_mframeds_that_contain_string{toolchain}

\section{Rules related to implemtentation}

# list here the table of contents / table of references to all rules that are allocated to "implementation"
\tableofcontents_mframeds_that_contain_string{implementation}

\end{appendix}}

I am not sure what "parents" mean and the question is slightly ambiguous in that it is not entirely clear to me where to search for keywords and if we should match whole words or whether implementations should count as a match for implementation. The format of the many tables of contents is also not specified. As a result the code may not quite meet the OP's requirements, but it should be straightforward to modify it -- except possibly for the unexplained "parents".

My code defines four macros:

• \DefineContentKeywords -- defines the keywords to track. For example, \DefineContentKeywords{design,implementation,toolchain}
• \AddContentsLine -- is used inside \Rule to add the current "rule" to the different table of contents indices (an "internal" command)
• \ContentsForKeyword -- will print the table of contents for one particular keyword. For example, \ContentsForKeyword{design}. This command automatically creates the section header.
• \AllContentsTables print all of the tables of contents. The order that the different tables are printed in is the same as they were defined. This command creates an \appendix and looks after all of the headers.

Internally, what the code does is create various LaTeX3 sequences to store the keywords and the corresponding table of contents lists. The keywords are searched for using the regex macros in LaTeX3. As in the OP, the table of contents must appear after all of the rules. If they need to appear, potentially, before the rules are specified then a different approach will be needed where the data is written to one or more files. This is easy enough to do but the way that the question is phrased the approach that I have taken seems natural.

I am really impressed at how easy it was to do this using LaTeX3, so I guess that I may have stop saying that the syntax in LaTeX3 is awful as this code shows how powerful it really is:)

For the MWE in the OP the code produces the following "tables of contents":

The OP does not say what format these should take so I have given just the rule number and the page number (which is 1 for all of the rules in the MWE but I checked that this does work properly when the page numbers change). I have added hyperref and made the page numbers hyperlinks.

The keywords are searched for in #3 (keywords?) and #4 (description?) of the arguments for \Rule, and they are added to the table of contents if they appear at the start of a word. So design will give a match for design, designs, designed but not for indesign. [Btw, the \label{...} from the OP inside \Rule does not do very much because at that point there is nothing to label, except the page number. I am not sure how this label will be used but it might be better to put \def\@currentlabel{#2} before \label{#2}, which would require sandwiching the macro definition between \makeatletter...\makeatother.]

Here is the full code:

\documentclass{article}

\usepackage{mdframed}
\usepackage{xparse}
\usepackage{hyperref}

\ExplSyntaxOn

\seq_new:N \contents_keywords_seq% a sequence of the keywords to track

% Usage: \DefineContentKeywords{ keyword } define a new keyword to be tracked
\NewDocumentCommand\DefineContentKeywords{ m }{
\seq_set_from_clist:Nn \contents_keywords_seq {#1}
\seq_map_inline:Nn \contents_keywords_seq {
\seq_new:c {contents_for_##1}  % create sequence for each keyword
}
}

\seq_map_inline:Nn \contents_keywords_seq {
\regex_match:nnT { \b##1 }{#2}{ \seq_put_right:cx {contents_for_##1}{#1}}
}
}

\cs_generate_variant:Nn  \int_compare:nNnT { xNNT }

% Usage: \ContentsForKeyword{keyword}
\NewDocumentCommand\ContentsForKeyword{ m }{
\subsection*{Rules~related~to~#1}
\int_compare:xNNT {\seq_count:c {contents_for_#1}} > 0{
\begin{enumerate}
\seq_map_inline:cn {contents_for_#1}{\item[] ##1\dotfill\pageref{##1}}
\end{enumerate}
}
}
\NewDocumentCommand\AllContentsTables{}{
\appendix
\section{Allocation~of~rules~to~work~products}
\seq_map_inline:Nn \contents_keywords_seq {\ContentsForKeyword{##1}}
}

\ExplSyntaxOff
\definecolor{MISRARuleBackgroundColor}{rgb}{0.86,0.88,0.94}
\definecolor{RuleBackgroundColor}{rgb}{0.86,0.94,0.88}
\definecolor{RuleBorderColor}{rgb}{0.29,0.39,0.68}

% define keywords to track
\DefineContentKeywords{design,
implementation,
toolchain
}

% \Rule[background colour]{number}{keywords}{description}
\newcommand{\Rule}[4][]{%
\AddContentsLine{#2}{#3 #4}% search "#3 #4" for keywords
\bigskip%
\begin{mdframed}[backgroundcolor=#1RuleBackgroundColor,
linecolor=RuleBorderColor,
linewidth=1pt]
\textbf{Rule #2 (#3)} \newline \textbf{#4} \label{#2}
\end{mdframed}\nopagebreak%
}

\newcommand{\MISRARule}[3]{%
\Rule[MISRA]{#1}{#2}{#3}%
See MISRA C++ 2008 \cite{MISRAC++2008}%
}

\begin{document}

\Rule{A0-4-1}{required, toolchain, non-automated}{Floating-point implementation shall comply with IEEE 754 standard.}

\Rule{A0-4-3}{required, toolchain, automated}{The implementations in the chosen compiler shall strictly comply with the C++14 Language Standard.}

\MISRARule{M1-0-2}{required, implementation, non-automated}{Multiple compilers shall only be used if they have a common, defined interface.}

\MISRARule{M15-0-3}{required, implementation, automated}{Control shall not be transferred into a try or catch block using a goto or a switch statement.}

\Rule{A15-0-2}{required, implementation, partially automated}{At least the basic guarantee for exception safety shall be provided for all operations. In addition, each function may offer either the strong guarantee or the nothrow guarantee}

...

\newpage
\AllContentsTables

\end{document}

I also rationalised (and fixed the use of background colours in) the code so that \MISRARule now invokes \Rule. I have used \sections and \subsections rather than \chapters and \sections to shorten the output.

• Hi Andrew, thanks a lot, this is what I needed. However, I have a problem that it does not compile in my environment. I think there is a missing } in "\seq_map_inline:cn {contents_for_#1}{\item[] ##1\dotfill\pageref{#1}" at the end. I added it but I get then the errors "undefined control sequence" in each line where Rule or MISRARule is used. – user3275925 Nov 29 '17 at 13:38
• @user3275925 Sorry, I changed the name of something and introduced some typos. I have just fixed the code. (Btw, the TeX.SX way of thanking is up-voting and/or awarding green ticks.) – user30471 Nov 29 '17 at 13:57
• I still have a problem - it builds if i comment the regex_match line: % Usage: \AddContentsLine{number}{description} \NewDocumentCommand\AddContentsLine{ mm }{ \seq_map_inline:Nn \contents_keywords_seq { %\regex_match:nnT { \b##1 }{#2}{ \seq_put_right:cx {contents_for_##1}{#1}} } }. Then the file builds without errors but of course the table rule is not added and the reference table is empty. I maybe there is another bug in this line? – user3275925 Nov 29 '17 at 14:16
• @user3275925 The code is working for me? I just pasted my working code back into the question. Can you please check it again? In the event that it doesn't work please post your error message. – user30471 Nov 29 '17 at 15:08
• I get the error message ! Undefined control sequence. __seq_item:n #1->\regex_match:nnT {\b #1}{required, toolchain, non-automate... l.72 ...tion shall comply with IEEE 754 standard.}. this message appears on each \Rule and \MISRARule. – user3275925 Nov 29 '17 at 15:34


text:
# Tag Info

In Big-O notation, $\mathcal{O}(N\log N)= \mathcal{O}(\frac N2\log N)$, as big-O notation only describes an upper bound for growth up to a constant factor, so your first question is kind of impossible to decide; in practice, the effort for a cleverly implemented real-valued FFT will be less than that of a (normal, complex) FFT. But whether it will be exactly ...


text:
# Characterization of compact sets in complete metric space

I was trying to demonstrate the result as an exercise, and so have refrained from checking against other sources.

The result in question is that a set F⊆XF \subseteq X, where (X,d)(X, d) is a complete metric space, is compact iff FF is totally bounded and closed. Showing compactness implies closed and totally bounded is simple enough. The part I wanted to be sure I hadn’t flubbed is the other direction.

Let F⊆XF \subseteq X be totally bounded, closed, but assume for contradiction that FF is not compact. Then there exists an open cover U={Ui:i∈I}\mathcal{U} = \{ U_{i} : i \in I \} such that no finite sub-class of U\mathcal{U} covers FF. Since FF is totally bounded, there exists a set {x(1)1,…,x(1)N1}⊆F\left\{ x_{1}^{(1)}, \ldots, x_{N_{1}}^{(1)} \right\} \subseteq F such that F⊆N1⋃j=1B(x(1)j,1)⊆N1⋃j=1¯B(x(1)j,1).F \subseteq \bigcup_{j = 1}^{N_1} B \left( x_{j}^{(1)} , 1 \right) \subseteq \bigcup_{j = 1}^{N_1} \overline{B \left( x_{j}^{(1)} , 1 \right)} . Consider the sets {¯B(x(1)j,1)∩F,1≤j≤N1}\left\{ \overline{B \left( x_{j}^{(1)} , 1 \right)} \cap F , 1 \leq j \leq N_{1} \right\}. Then at least one of these sets admits no finite subcover from U\mathcal{U} (otherwise FF would admit finite subcover), so set y1∈{x(1)1,…,x(1)N1}y_{1} \in \left\{ x_{1}^{(1)}, \ldots, x_{N_{1}}^{(1)} \right\} such that ¯B(y1,1)∩F=:E1\overline{B \left( y_1 , 1 \right)} \cap F = : E_{1} admits no finite subcover from U\mathcal{U}.

Now we construct a sequence (yk)k∈N∈FN,(Ek)k∈N∈(P(F))N(y_{k})_{k \in \mathbb{N}} \in F^{\mathbb{N}}, (E_{k})_{k \in \mathbb{N}} \in ( \mathcal{P}(F) )^{\mathbb{N}} as follows: Suppose we’ve constructed the elements y1,…,yk,E1,…,Eky_{1}, \ldots, y_{k}, E_{1}, \ldots, E_{k}. Then EkE_{k} by assumption admits no finite sub-cover from U\mathcal{U}, and moreover is totally bounded, so there exists a family {x(k+1)1,…,x(k+1)Nk+1}⊆Ek\left\{ x_{1}^{(k + 1)}, \ldots, x_{N_{k + 1}}^{(k + 1)} \right\} \subseteq E_{k} such that Ek⊆⋃Nk+1j=1B(x(k+1)j,1k+1)⊆⋃Nk+1j=1¯B(x(k+1)j,1k+1)E_{k} \subseteq \bigcup_{j = 1}^{N_{k + 1}} B \left( x_{j}^{(k + 1)} , \frac{1}{k + 1} \right) \subseteq \bigcup_{j = 1}^{N_{k + 1}} \overline{ B \left( x_{j}^{(k + 1)} , \frac{1}{k + 1} \right)}. Then there exists yk+1∈{x(k+1)1,…,x(k+1)Nk+1}y_{k + 1} \in \left\{ x_{1}^{(k + 1)}, \ldots, x_{N_{k + 1}}^{(k + 1)} \right\} such that ¯B(yk+1,1k+1)∩Ek=:Ek+1\overline{B \left( y_{k + 1} , \frac{1}{k + 1} \right)} \cap E_{k} = : E_{k + 1} admits no finite sub-cover from U\mathcal{U}.

Now consider the sequence (yk)k∈N(y_{k})_{k \in \mathbb{N}}. We claim that the sequence is Cauchy. To see this, fix ϵ>0\epsilon > 0. If K∈NK \in \mathbb{N} such that 1/K<ϵ/21 / K < \epsilon / 2, and k1,k2>Kk_{1}, k_{2} > K, then yk1,yk2∈Eky_{k_{1}} , y_{k_{2}} \in E_{k}, so d(yk1,yk2≤d(yk1,yK)+d(yK,yk2)≤2/K<ϵd(y_{k_{1}} , y_{k_{2}} \leq d(y_{k_{1}}, y_{K}) + d(y_{K}, y_{k_{2}}) \leq 2 / K < \epsilon. Since XX is complete, let y = \lim_{k \to \infty} y_{k}y = \lim_{k \to \infty} y_{k}. Since FF is closed and y_{k} \in Fy_{k} \in F for all kk, we know y \in Fy \in F. Let U \in \mathcal{U}U \in \mathcal{U} such that y \in Uy \in U. Then since we're in a metric space, there exists \delta > 0\delta > 0 such that B(y, \delta) \subseteq UB(y, \delta) \subseteq U. Let K \in \mathbb{N}K \in \mathbb{N} sufficiently large that 1 / K < \delta / 21 / K < \delta / 2. Then if y' \in E_{K}y' \in E_{K}, then d(y', y) \leq d(y', y_{K}) + d(y_{K}, y) \leq 2 / K < \deltad(y', y) \leq d(y', y_{K}) + d(y_{K}, y) \leq 2 / K < \delta, so E_{K} \subseteq B(y, \delta) \subseteq U \in \mathcal{U}E_{K} \subseteq B(y, \delta) \subseteq U \in \mathcal{U}. Thus E_{K}E_{K} admits a finite subcover, contradicting the assumption that it not. Is this right? =================      It is simpler to show that a sequence in a closed totally bounded set has a convergent subsequence. – Mariano Suárez-Álvarez♦ 2 days ago      @bof yes, fixed – AJY 2 days ago      @MarianoSuárez-Álvarez Could you elaborate? – AJY 2 days ago      Suppose you have a sequence in your set. Cover the set with finitely many balls of radius 1. The sequence clearly has a subsequence that is entirely contained in one of the balls. Now cover the set with balls of radius 1/2, Finitely many of them. That subsequence has a subsequence which is entirely contained in one of these, and so on. The use a diagonal argument to construct a subsequence of the original sequence which is Cauchy. Since the space is complete, that subsequence converges, and since your set is closed, the limit is in it. – Mariano Suárez-Álvarez♦ 2 days ago      @MarianoSuárez-Álvarez I see that, but I don't see how to relate that to compactness. – AJY 2 days ago ================= =================


text:
Left 4 Dead 2 is a single-player and multiplayer co-operative survival horror FPS game.
Category
Tagged
VSLib Developer Guide - Your First VSLib Mutation
4,523
Creating Your First VSLib Mutation: BOOMER VOMIT ATTRACTS TANK HORDE
Create a file called test.nut in the following folder (if the path does not exist, create the folders):

Alongside the newly created test.nut, you should see a VSLib folder if you set up everything right.
Next, create a file called test.txt in the following folder:

Open the newly created test.txt and add the following information in:
"test"
{
"base"		"test"

"maxplayers"	"4"
"hasdifficulty"	"1"
"singlechapter"	"1"

"DisplayTitle"	"test"
"Description"	"A test game mode!"
"Image"		"maps/any"
"Author"	"test"
}
Save the file and exit.

We're almost done; so far, we have done 2 things:

We created a new game mode called "test".
We verified that VSLib is properly placed.

Lastly, if you're using the "Starting L4D2 From Notepad++" tip from the helpful addons section, be sure to change the "MutationName" to test. Your new run path might display:

"C:\Program Files (x86)\Steam\SteamApps\common\Left 4 Dead 2 Beta\left4dead2_beta.exe" -dev 3 -console -toconsole -sw +map "c1m2_streets test"

That's all there is for setting up! Let's code a simple mutation.
Coding The Mutation
Our first mutation will be utterly simple.

Let's imagine a hypothetical scenario. In this game mode, we will have only boomers and tanks. Boomer vomit will attract a horde of tanks. And there will be lots and lots of tanks once vomited. That makes for an interesting, simple game mode. Also, let's make it a single-player game mode (without bots).

Open the test.nut file with your preferred application (Notepad++, Visual Studio, etc). Any nut file that needs VSLib needs to include only 1 line. The following line will tell L4D2 to include our library:
// Include the VScript Library
IncludeScript( "VSLib" );
So far so good! Below that, we can add our mutation's options. Remember, we want only boomers and tanks-- lots of them; therefore, we will set a high limit for them, but that doesn't mean all of them will spawn at once! The L4D2 Director also sets limitations on top of your limitations (such as engine client limit, max infected players, max clients in play, etc). Add the following lines next:
// Set up mutation options
MutationOptions <-
{
CommonLimit  = 0
MegaMobSize  = 0
WanderingZombieDensityModifier = 0
MaxSpecials  = 30 // Max 30 SI at once, although the actual value will be far less
TankLimit    = 30 // Up to 30 tanks
WitchLimit   = 0
BoomerLimit  = 30 // Up to 30 boomers
ChargerLimit = 0
HunterLimit  = 0
JockeyLimit  = 0
SpitterLimit = 0
SmokerLimit  = 0
SpecialRespawnInterval = 5  // Respawn a SI 5 seconds after it dies
cm_NoSurvivorBots = true // No survivor bots
TotalSpecials = 15  // At least this many specials before director is done
TotalBoomer = 15  // 15 boomers can spawn in a wave
}
Hopefully, the above code makes sense. If not, make sure you read the mutation options document. Just to summarize the above, MutationOptions is a table that L4D2 will use to determine Director related options (such as infected spawn rates). Anyway, that bit of code is not specific to VSLib. (We will actually use VSLib next.) The goal of our mutation is for lots of boomers to spawn, and when a survivor gets vomited, to spawn lots and lots of tanks.

The first thing we want to create is a round variable. Round vars are just that: variables that last throughout the round. The data inside are reset to their original value at the end of every round. For example, when all the survivors die and respawn, or when the infected and survivor teams switch (i.e. at the end of a round), or when the map changes to a different one, the round vars are reset. This is helpful because you never have to worry about resetting any value. Just set it once and forget. The variables will be fresh when a new round begins. Anyway, the variable we want to create is called DidGetVomited. DidGetVomited will start off as false (since the player who just begins the game will not be vomited). Until the player does get vomited, we want to prevent any tanks from spawning and instead spawn lots of boomers. After the player is vomited once, we want to prevent boomers from spawning and instead spawn lots of tanks. Sounds pretty complicated, huh? Don't worry. You will see that it's not so bad. To start off, create the round var below the MutationOptions table (if you're confused at any point throughout this tutorial, the full code is at the bottom of this page).
RoundVars.DidGetVomited <- false;
The next thing we want to do is kill any tank that spawns before the player gets vomited. To do so, we make use of VSLib's notification system (which wraps Valve's game event system). The notification system lets you know when things happen. For example, tanks spawning, people getting vomited, survivors dying, infected falling, doors opening, players jumping, weapons zooming, etc. Game event notifications are what tells the game when something happens. VSLib "wraps" these notifications, making them easier to use. The notification system is nice because it helps us organize code. We can have multiple functions for the same event. VSLib even passes the most useful parts of an event as parameters for you. That way, you do not have to deal with the event's parameter array yourself. If you have no idea what I'm talking about, don't worry-- you'll see very soon. Copy and paste the below into your script, and read on for the explanations:
// Below, OnTankSpawned is the notification, and KillTankIfNotVomited is the name of our function.
{
// If the player has not gotten vomited yet, then don't let this tank spawn.
if (RoundVars.DidGetVomited == false)
tank.Kill();
}
It's simple, but the syntax of the code can take a bit getting used to. Just copy and paste the above code for now. The more you see it and deal with VSLib, the easier the Squirrel code feels. Anyway, let's examine the above code in detail. The first line, in my opinion, is the hardest part. Therefore, we will spend most of our time in this paragraph examining that first line. EasyLogic is part of VSLib. The EasyLogic system enables you to incorporate "easy logic" into your map/mutation/mod. EasyLogic also attempts to replace "daunting" code with easier-to-read ones. There are lots of different things in EasyLogic, and Notifications is just one part of it. By typing Notifications::, we are accessing the Notifications part of EasyLogic. There are lots of different notifications, but all we're interested in at this moment is the OnTankSpawned notification. Thus, we end up with Notifications::OnTankSpawned. Next, we need to give a name for our notification. Basically, we need to provide a description of what we're going to achieve in that function. You can give your function whatever name you want (don't make it obnoxiously long obviously). I called my function KillTankIfNotVomited. That's the synopsis of the entire function. Note that if you wanted to, you can have as many OnTankSpawned notifications as you want. Just change the description to something else each time you use it (i.e. you can have another Notifications::OnTankSpawned::FuncNameHere if you wanted). VSLib will call all the notifications requested when they happen. For this particular notification (i.e. OnTankSpawned), VSLib will pass the tank and the original params array to us. Every notification is different, and therefore every notification will have different params. The subsequent lines are self-explanatory. If DidGetVomited is false, then kill the tank (we don't want any tanks spawning until the player is vomited on). Similarly, we don't want boomers to spawn after the player gets vomited on (we only want a horde of tanks). We will take advantage of another notification for that! This notification is called OnSpawn, and it gets called each time a survivor or infected spawns (note that we could have just used OnSpawn for both the tank and the boomer and avoided OnTankSpawned if we wanted to). The setup is nearly the same:
function Notifications::OnSpawn::KillBoomerIfAlreadyVomited (player, params)
{
// If the survivor has already gotten vomited AND the player that
// just spawned is a boomer, then kill the boomer.
if (RoundVars.DidGetVomited == true && player.GetPlayerType() == Z_BOOMER)
player.Kill();
}
In the above code, if DidGetVomited is true and the spawned player is a boomer, then kill the spawned player because we do not want boomers to spawn after the survivor got vomited (we only want tanks).

Next, we want to know when the survivor gets vomited upon, so we use yet another notification! But this time it's simple:
function Notifications::OnPlayerVomited::ChangeDidGetVomited (victim, boomer, params)
{
RoundVars.DidGetVomited <- true;
}
VSLib shares the vomited victim, attacking boomer, and the params array for OnPlayerVomited.

You can go ahead and test the script now, but there wouldn't be much action. Why? Because the tanks do not spawn in hordes! To fix this problem, we can manually spawn zombies. However, how can we specifically spawn boomers and tanks continuously throughout the round? We can use a VSLib timer; timers allow you to call any requested function after a delay or interval. Whenever a delay of any sort is needed, timers can be an effective resource. Some timers can be made to fire only once, and others can be made to fire periodically each interval. In this case, we want a timer to fire repeatedly (since we want to spawn zombies throughout the entire round). As aforementioned, timers can be used to call a function after a delay; therefore, we need two things: a function to fire and the timer itself. Now, how the heck do we create a timer? Thankfully, VSLib makes it very easy. The Timers.AddTimer function can create both repeating and single-fire timers. Here's the function prototype:

VSLib::Timers::AddTimer ( float delayInSeconds, bool repeatTimer, function functionToFire, argumentsToPass = null, unsigned int flags = 0 )

It seems pretty complicated, but it's actually very simple. You can set a delay (i.e. how long to wait before firing), whether or not you want to timer to repeat, the function to fire, an optional argument to pass (like a params table), and any optional flags. It's hard to conceptualize, but once you see it in action, it makes much more sense. So let's create the timer, the spawn function, and yet another notification (note that this notification does not have any params-- remember, every notification is different):
// The following function will spawn either a boomer or a tank near a player
::SpawnInfectedQuickly <- function ( player )
{
if (RoundVars.DidGetVomited)
{
Utils.SpawnZombieNearPlayer( player, Z_TANK, 800, 512 );
}
else
{
Utils.SpawnZombieNearPlayer( player, Z_BOOMER, 800, 512 );
}
}

// Start the timer when the player leaves the saferoom!
{
// Create the timer: (delay/interval, true to repeat, function to fire, optional param)
Timers.AddTimer( 5.0, true, SpawnInfectedQuickly, Players.AnySurvivor() );

// Notify the players that the round has begun
Utils.SayToAll( "Tank Horde has begun! Don't let the boomers vomit on you!" );
}
Let's go over this code in-depth. The first function (SpawnInfectedQuickly) takes one argument: "player". Basically, what the function does is check if the player has gotten vomited, and if he has, spawn a tank near the player, or if he hasn't, spawn a boomer near him. Utils.SpawnZombieNearPlayer is a VSLib utility function that will spawn a particular Special Infected near any given player. It takes two numbers: the max distance (in this case, 800) and the min distance (512 in this case). Basically, what the code is saying is the following: "If the player has gotten vomited, then spawn a tank near the player at least 512 units away but no more than 800 units away. If the player has not gotten vomited, then spawn a boomer at least 512 units away but no more than 800 units away." By doing so, we can spawn infected a little bit far away but not too far away. The second function (the OnSurvivorsLeftStartArea notification) lets us know when the survivors leave the saferoom. When they leave the start area, we want to create a timer that repeatedly spawns infected every 5 seconds. In the end, we will have a timer that is spawning either boomers or tanks throughout the round. The function Players.AnySurvivor()  will return the first valid player (in this case, our only player). We pass the only player to SpawnInfectedQuickly as an argument. Essentially, our AddTimer function is saying this: "Create a timer that has a delay of 5.0 seconds. Make the timer fire repeatedly (every 5.0 seconds). Call the function SpawnInfectedQuickly when the timer fires, passing our only player as an argument." Thus, we will have a timer that is spawning infected near the player every five seconds until the end of the round. Cool, huh? Timers can do a lot more stuff. In the Timers chapter, we will go over timers in-depth.

Well, that's it. Go ahead and test your first mutation! As a bonus, try adding a OnTankSpawned notification and change the tank's color to red with InputColor().
The Full Mutation Code
// Include the VScript Library
IncludeScript( "VSLib" );

// Set up mutation options
MutationOptions <-
{
CommonLimit  = 0
MegaMobSize  = 0
WanderingZombieDensityModifier = 0
MaxSpecials  = 30 // Max 30 SI at once, although the actual value will be far less
TankLimit    = 30 // Up to 30 tanks
WitchLimit   = 0
BoomerLimit  = 30 // Up to 30 boomers
ChargerLimit = 0
HunterLimit  = 0
JockeyLimit  = 0
SpitterLimit = 0
SmokerLimit  = 0
SpecialRespawnInterval = 5  // Respawn a SI 5 seconds after it dies
cm_NoSurvivorBots = true // No survivor bots
TotalSpecials = 15  // At least this many specials before director is done
TotalBoomer = 15  // 15 boomers can spawn in a wave
}

RoundVars.DidGetVomited <- false;

{
// If the player has not gotten vomited yet, then don't let this tank spawn.
if (RoundVars.DidGetVomited == false)
tank.Kill();
}

{
// If the survivor has already gotten vomited AND the player that
// just spawned is a boomer, then kill the boomer.
if (RoundVars.DidGetVomited == true && player.GetPlayerType() == Z_BOOMER)
player.Kill();
}

{
RoundVars.DidGetVomited <- true;
}

// The following function will spawn either a boomer or a tank near a player
::SpawnInfectedQuickly <- function ( player )
{
if (RoundVars.DidGetVomited)
{
Utils.SpawnZombieNearPlayer( player, Z_TANK, 800, 512 );
}
else
{
Utils.SpawnZombieNearPlayer( player, Z_BOOMER, 800, 512 );
}
}

// Start the timer when the player leaves the saferoom!
}


text:
# Equivalent Definitions of the Spectral Norm

There are many equivalent definitions of the spectral norm $\|A\|_2$ for when $A$ is a symmetric matrix, the most common ones being

$$\sup_{\|x\|_{2} = 1}{\|Ax\|_{2}} = \sup_{\|x\|_{2}=1}|{\langle Ax,x \rangle|} = \text{largest eigenvalue of A in absolute value}$$

Recently, while going through a paper on compressed sensing (http://statweb.stanford.edu/~candes/papers/PartialMeasurements.pdf), I was met with the following definition of the spectral norm(search "spectral" in the paper):

$$\|Y\|_2 = \displaystyle\sup_{\|f_1\|_{2} = \|f_1\|_{2} = 1 } \langle f_1, Yf_2 \rangle$$

where $f_1, f_2$ are unit norm vectors. After going through some naive calculations, I could not find out why this norm is equivalent to the ones I defined above, nor have I found another source that defines it this way. I was wondering if someone can clear this up for me as to why the definitions are equivalent.

Thanks all beforehand!

• Useful lemma: $\sup_{\|y\|=1} \langle y,x\rangle = \|x\|$. Therefore $\sup_{\|x\|=\|y\|=1} \langle y,Ax\rangle = \sup_{\|x\|=1}(\sup_{\|y\|=1} \langle y,Ax\rangle) = \cdots$ – Rahul Jul 15 '16 at 1:36
• I know I did not state what kinds of vectors f1 and f2 are, but I assume the definitions are equivalent only when f1, f2, and A are all real? Otherwise the inner product could spit out a complex number? – mathplebeian Jul 16 '16 at 22:35

Clearly $\sup_{\|x\|_{2}=1}|{\langle Ax,x \rangle|} \leq \sup_{\|f_1\|_{2} = \|f_1\|_{2} = 1 } \langle f_1, Af_2 \rangle$. The reverse inequality can be proven in several ways. For instance, by the spectral theorem, we may assume that $A$ is diagonal. If every eigenvalue of $A$ has absolute value $\leq C$ and we have two vectors $f_1=(f_1^1,\dots,f_1^n)$ and $f_2=(f_2^1,\dots,f_2^n)$, we have $$\langle f_1,Af_2\rangle=\sum_i f_1^i A_{ii}f_2^i\leq C\sum_i |f_1^if_2^i|\leq C\|f_1\|_2\|f_2\|_2.$$ We can conclude that $\sup_{\|f_1\|_{2} = \|f_1\|_{2} = 1 } \langle f_1, Af_2 \rangle\leq C$.


text:
# Induction - Self Induction and Mutual Induction

## What isInduction?

Induction is the magnetic field which is proportional to the rate of change of the magnetic field. This definition of induction holds for a conductor. Induction is also known as inductance. L is used to represent the inductance and Henry is the SI unit of inductance.

1 Henry is defined as the amount of inductance required to produce an emf of 1 volt in a conductor when the current change in the conductor is at the rate of 1 Ampere per second.

### Factors Affecting Inductance

Following are the factors that affect the inductance:

1. The number of turns of the wire used in the inductor.
2. The material used in the core.
3. The shape of the core.

Electromagnetic Induction law was given by Faraday which states that by varying the magnetic flux electromotive force is induced in the circuit. From Faraday’s law of electromagnetic induction, the concept of induction is derived. Inductance can be defined as the electromotive force generated to oppose the change in current at a particular time duration.

Electromotive force = – L $$\frac {\Delta I}{\Delta t}$$

Unit of Inductance = $$\frac {Volt ~Second }{Ampere}$$=Henry

## Types of Inductance

Two types of inductance are there:

• Self Induction
• Mutual Induction

## What is Self Induction?

When there is a change in the current or magnetic flux of the coil, an opposed induced electromotive force is produced. This phenomenon is termed as Self Induction. When the current starts flowing through the coil at any instant, it is found that, that the magnetic flux becomes directly proportional to the current passing through the circuit. The relation is given as:

$$\phi$$= I

$$\phi$$ = L I

Where L is termed as self-inductance of the coil or the coefficient of self-inductance. The self-inductance depends on the cross-sectional area, the permeability of the material, or the number of turns in the coil.

The rate of change of magnetic flux in the coil is given as,

e = – $$\frac {d \phi}{dt}$$ = – $$\frac {d (LI) }{dt}$$

or e = – L $$\frac {dI}{dt}$$

### Self Inductance Formula

 $$L=N\frac{\phi }{I}$$

Where,

• L is the self inductance in Henries
• N is the number of turns
• Φ is the magnetic flux
• I is the current in amperes

Related Articles:

## What is Mutual Induction?

We take two coils, and they are placed close to each other.  The two coils are P- coil (Primary coil) and S- coil (Secondary coil). To the P-coil, a battery, and a key is connected wherein the S-coil a galvanometer is connected across it. When there is a change in the current or magnetic flux linked with two coils an opposing electromotive force is produced across each coil, and this phenomenon is termed as Mutual Induction. The relation is given as:

$$\phi$$ = I

$$\phi$$ = M I

Where M is termed as the mutual inductance of the two coils or the coefficient of the mutual inductance of the two coils.

The rate of change of magnetic flux in the coil is given as,

e = – $$\frac {d \phi}{dt}$$ = – $$\frac {d (MI)}{dt}$$

e = – M $$\frac {dI}{dt}$$

### Mutual Inductance Formula

 $$M=\frac{\mu _{0}\mu_{r} N_{1}N_{2}A}{l}$$

Where,

• μ0 is the permeability of free space
• μr is the relative permeability of the soft iron core
• N is the number of turns in coil
• A is the cross-sectional area in m2
• l is the length of the coil in m

### Difference between Self and Mutual Inductance

 Self induction Mutual induction Self inductance is the characteristic of the coil itself. Mutual inductance is the characteristic of a pair of coils. The induced current opposes the decay of current in the coil when the main current in the coil decreases. The induced current developed in the neighboring coil opposes the decay of the current in the coil when the main current in the coil decreases. The induced current opposes the growth of current in the coil when the main current in the coil increases. The induced current developed in the neighboring coil opposes the growth of current in the coil when the main current in the coil increases.

### Derivation of Inductance

Consider a DC source with its switch on. When the switch is turned on, the current flows from zero to a certain value such that there is a change in the rate of current flowing. Let φ be the change in flux due to current flow. The change in flux is with respect to time which is given as:

$$\frac{d\varphi }{dt}$$

Apply Faraday’s law of electromagnetic induction,

E = N$$\frac{d\phi }{dt}$$

Where,

• N is the number of turns in the coil
• E is the induced EMF across the coil

From Lenz’s law, we can write the above equation as

E = -N$$\frac{d\phi }{dt}$$

The above equation is modified for calculating the value of inductance

E = -N$$\frac{d\phi }{dt}$$

E = -L $$\frac{di }{dt}$$

N = dΦ = L di

NΦ = Li

Therefore,

Li = NΦ = NBA

Where,

• B is the flux density
• A is the area of the coil

Hl = Ni

Where,

• H is the magnetizing force due to magnetic flux

B = μH

Li = NBA

L = NBA/i = N2BA/Ni

N2BA/Hl = N2μHA/Hl

L = μN2A/l = μN2𝜋r2/l

Where,

• r is the radius of the coil

### Examples of Self Inductance and Mutual Inductance

Example 1.

Consider a solenoid with 500 turns which are wound on an iron core whose relative permeability is 800. 40 cm is the length of the solenoid while 3 cm is the radius. The change in current is from 0 to 3 A. Calculate the average emf induced for this change in the current for time 0.4 second.

Solution:

Given:

No.of turns, N = 500 turns

Relative permeability, μr = 800

Length, l = 40 cm = 0.4 m

Radius, r = 3 cm = 0.03 m

Change in current, di = 3 – 0 = 3 A

Change in time, dt = 0.4 sec

Self-inductance is given as

L = μN2Al = μ0μrN2𝜋r2/l

Substituting the values we get

(4)(3.14)(10-7)(800)(5002)(3.14)(3×10-2)2/0.4

L = 1.77 H

Magnitude of induced emf, ε = L di/dt = 1.77×3/0.4

ε = 13.275 V

Example 2.

There are two coils such that the current flowing through the first coil experiences a change in current flow from 2 A to 10 A in 0.4 sec. Calculate mutual inductance between the two coils when 60 mV emf is induced in the second coil. Determine the induced emf in the second coil if the current changes from 4 A to 16 A in 0.03 sec in the first coil.

Solution:

Given:

Case 1:

Change in current, di = 10 -2 = 8 A

Change in time, dt = 0.4 sec

Magnitude of induced emf, ε2 = 60×10-3 V

Case 2:

Change in current, di = 16 – 4 = 12 A

Change in time, dt = 0.03 sec

Mutual inductance of the second coil with respect to the first coil is given as:

M21 = ε2/(di/dt) = 60×10-3×0.4/8 = 3×10-3H

Induced emf in the second coil due to change in the rate of current in the first coil is given as:

ε2 = M21 di/dt = 3×10-3×12/0.03 = 1.2V


text:
• Investigations on microstructure, electrical and magnetic properties of Ni–Zn–Ga spinel ferrites

• # Fulltext

https://www.ias.ac.in/article/fulltext/boms/044/0029

• # Keywords

Micro-structural; Mossbauer effect; magnetic coercivity; saturation magnetization; electrical properties.

• # Abstract

Two spinel ferrite samples Ni$_{0.7}$Zn$_{0.3}$GayFe$_{2–y}$O$_4$ $(y = 0.5, 1.0)$ were prepared by both ceramic and citrate methods. X-ray diffraction patterns indicated a single phase of cubic structure for all the samples that have a space group Fd-3m. Rietveld analysis using MAUD software for all samples showed that the lattice parameter ($a$) decreases, while oxygen parameter ($U$) and strain ($\epsilon$) increase by increasing the amount of Ga. A marked increase in the frequency bands in both the tetrahedral and octahedral sites was observed in the vibrational frequency bands of Fourier transform infraredspectra. Mossbauer effect (ME) spectra recorded at room temperature for the bulk sample (prepared by ceramic method) with lower concentrations of Ga$^{3+}$ ($y = 0.5$) consist of two Zeeman sextets. ME spectra for the other bulk sample ($y = 1.0$) and the two samples in nanoscale (prepared by citrate method) can be fitted by one and two doublets due to the paramagnetic and superparamagnetic behaviour, respectively. Vibrating sample magnetometer measurements showed that the saturation magnetization ($M_{\rm s}$) obtained from the hysteresis loop is decreased by increasing Ga$^{3+}$ concentration for all the samples. The coercivity ($H_{\rm c}$) is inversely proportional to the particle size ($D$) for bulk samples. Nevertheless, $H_{\rm c}$ of thenanoscale samples enhanced by increasing the particle size. The size dependence of $H_{\rm c}$ is an indication of the superparamagneticcharacteristics supported by ME. The ac electrical conductivity ($\ln \sigma$), dielectric constant ($\epsilon'$) and dielectric loss tangent ($\tan\delta$) were studied at different frequencies and temperatures for the investigated samples. The obtained results showed that the conductivity for all samples increases with increasing temperature in a behaviour similar to that of the most semi-conductor materials.

• # Author Affiliations

1. Reactor Physics Department, Nuclear Research Center, Egyptian Atomic Energy Authority, Cairo, Egypt

• # Bulletin of Materials Science

Volume 45, 2022
All articles
Continuous Article Publishing mode

• # Dr Shanti Swarup Bhatnagar for Science and Technology

Posted on October 12, 2020

Prof. Subi Jacob George — Jawaharlal Nehru Centre for Advanced Scientific Research, Jakkur, Bengaluru
Chemical Sciences 2020


text:
Categories

# Triangle and integers | AIME I, 1995 | Question 9

Try this beautiful problem from the American Invitational Mathematics Examination I, AIME I, 1995 based on Triangle and integers.

Try this beautiful problem from the American Invitational Mathematics Examination I, AIME I, 1995 based on Triangle and integers.

## Triangle and integers – AIME I, 1995

Triangle ABC is isosceles, with AB=AC and altitude AM=11, suppose that there is a point D on AM with AD=10 and $\angle BDC$=3$\angle BAC$. then the perimeter of $\Delta ABC$ may be written in the form $a+\sqrt{b}$ where a and b are integers, find a+b.

• is 107
• is 616
• is 840
• cannot be determined from the given information

Integers

Triangle

Trigonometry

## Check the Answer

AIME I, 1995, Question 9

Plane Trigonometry by Loney

## Try with Hints

Let x= $\angle CAM$

$\Rightarrow \angle CDM =3x$

$\Rightarrow \frac{tan3x}{tanx}=\frac{\frac{CM}{1}}{\frac{CM}{11}}$=11 [by trigonometry ratio property in right angled triangle]

$\Rightarrow \frac{3tanx-tan^{3}x}{1-3tan^{2}x}=11tanx$

solving we get, tanx=$\frac{1}{2}$

$\Rightarrow CM=\frac{11}{2}$

$\Rightarrow 2(AC+CM)$ where $AC=\frac{11\sqrt {5}}{2}$ by Pythagoras formula

=$\sqrt{605}+11$ then a+b=605+11=616.


text:
## College Physics (4th Edition)

$U = -1.125\times 10^{-5}~J$
We can find the electric potential energy: $U = \frac{k~q_1~q_2}{r}$ $U = \frac{(9.0\times 10^9~N~m^2/C^2)(10.0\times 10^{-9}~C)(-10.0\times 10^{-9}~C)}{0.080~m}$ $U = -1.125\times 10^{-5}~J$