text:
# Palladium--Hydrogen Complex in Silicon Observed by Electron Spin Resonance Measurement

## Abstract

We have investigated a palladium--hydrogen complex in silicon by electron spin resonance (ESR) measurement. A new ESR spectrum was detected in a sample diffused with palladium and hydrogen. The hyperfine structure of hydrogen atoms in the ESR spectrum shows that the spectrum originates from a palladium--hydrogen complex containing three hydrogen atoms (Pd--H3). The anisotropic $g$-value of Pd--H3shows that the Pd--H3complex has an anisotropic character of orthorhombic ($C_{2v}$) symmetry. The calculated $g$-values of the Pd--H3complex are $g_{1} = 2.12$, $g_{2} = 2.10$, and $g_{3} = 2.03$, and the $g_{2}$ axis is along the $\langle 100 \rangle$ direction. The anisotropic character of orthorhombic ($C_{2v}$) symmetry results from a configuration consisting of one Pd atom at a substitutional site, two equivalent hydrogen atoms at interstitial sites along the $\langle 111 \rangle$ direction, and one hydrogen atom at the next-nearest-neighbor interstitial site along the $\langle 100 \rangle$-twofold symmetry axis. We have also studied the dissociation of a platinum--hydrogen complex by thermal treatment. The activation energy for the dissociation of the Pd--H3complex is estimated to be about 1.6 eV.

## Journal

Jpn J Appl Phys

Jpn J Appl Phys 50(9), 091301-091301-4, 2011-09-25

The Japan Society of Applied Physics

## Codes

• NII Article ID (NAID) :
150000057878
• NII NACSIS-CAT ID (NCID) :
AA12295836
• Text Lang :
EN
• Journal Type :
大学紀要
• ISSN :
00214922
• NDL Article ID :
11251234
• NDL Source Classification :
ZM35(科学技術--物理学)
• NDL Call No. :
Z53-A375
• Databases :
NDL  JSAP/JPS


text:
# Noetherian module over a non-noetherian ring

Let $R$ be a ring which is not Noetherian. Let $M$ be an $R$-module whose annihilator is trivial. Is it possible for $M$ to be Noetherian? Intuitively, it seems like the answer should be no, as we should be able to somehow "embed" $R$ in $M$ via its action on $M$. However, I am not seeing a straightforward proof.

-

In the commutative case at least, if $M$ is faithful (trivial annihilator) and Noetherian, then $R$ is actually a Noetherian ring. So if $R$ is non-Noetherian, it cannot have a faithful Noetherian module.
The proof is basically as you suggest. Let $m_1,\ldots,m_n$ generate $M$ and define $j:R\rightarrow M^n$ by $j(r)=(rm_1,\ldots,rm_n)$. This is injective because the annihilator of $M$ in $R$ is zero. So $R$ is a submodule of the Noetherian module $M^n$, and thus is itself Noetherian as an $R$-module, i.e., $R$ is a Noetherian ring.
More generally, the same argument proves Theorem 3.5 of Matsumura's Commutative Ring Theory: if $M$ is Noetherian, then $R/\mathrm{ann}(M)$ is a Noetherian ring.

format: plain


text:
# Localization of Bogoliubov quasiparticles in interacting Bose gases with correlated disorder

2 laboratoire Charles Fabry de l'Institut d'Optique / Optique atomique
LCFIO - Laboratoire Charles Fabry de l'Institut d'Optique
Abstract : We study the Anderson localization of Bogoliubov quasiparticles (elementary many-body excitations) in a weakly interacting Bose gas of chemical potential $\mu$ subjected to a disordered potential $V$. We introduce a general mapping (valid for weak inhomogeneous potentials in any dimension) of the Bogoliubov-de Gennes equations onto a single-particle Schrödinger-like equation with an effective potential. For disordered potentials, the Schrödinger-like equation accounts for the scattering and localization properties of the Bogoliubov quasiparticles. We derive analytically the localization lengths for correlated disordered potentials in the one-dimensional geometry. Our approach relies on a perturbative expansion in $V/\mu$, which we develop up to third order, and we discuss the impact of the various perturbation orders. Our predictions are shown to be in very good agreement with direct numerical calculations. We identify different localization regimes: For low energy, the effective disordered potential exhibits a strong screening by the quasicondensate density background, and localization is suppressed. For high-energy excitations, the effective disordered potential reduces to the bare disordered potential, and the localization properties of quasiparticles are the same as for free particles. The maximum of localization is found at intermediate energy when the quasicondensate healing length is of the order of the disorder correlation length. Possible extensions of our work to higher dimensions are also discussed.
Document type :
Journal articles
Domain :

https://hal.archives-ouvertes.fr/hal-00590511
Contributor : Pierre Lugan <>
Submitted on : Thursday, August 4, 2011 - 1:38:00 AM
Last modification on : Thursday, November 12, 2020 - 10:12:08 AM
Long-term archiving on: : Saturday, November 5, 2011 - 2:20:34 AM

### Files

bogoliubov20110803.pdf
Files produced by the author(s)

### Citation

Pierre Lugan, Laurent Sanchez-Palencia. Localization of Bogoliubov quasiparticles in interacting Bose gases with correlated disorder. Physical Review A, American Physical Society, 2011, 84, pp.013612. ⟨10.1103/PhysRevA.84.013612⟩. ⟨hal-00590511v2⟩

Record views


text:
# Normal Curve Probability...

• March 23rd 2008, 12:30 PM
MathIsRelativelyUseless
Normal Curve Probability...
"A population is normally distributed with a mean of 25.8 and a standard deviation of 1.5. What is the probability that a randomly selected member of the population will have a measure greater than 28?"

And yet there are NO examples of this in the book nor in the online course.

Help?
• March 23rd 2008, 12:39 PM
CaptainBlack
Quote:

Originally Posted by MathIsRelativelyUseless
"A population is normally distributed with a mean of 25.8 and a standard deviation of 1.5. What is the probability that a randomly selected member of the population will have a measure greater than 28?"

And yet there are NO examples of this in the book nor in the online course.

Help?

Compute the z-score of 28 : $z=\frac{28-25.8}{1.5}=1.467$

Now look this up in a table of the cumulative standard normal to find: $P(z\le 1.467)$, and you want $P(z > 1.467)=1-P(z \le 1.467)$

RonL
• March 24th 2008, 10:20 AM
MathIsRelativelyUseless
Ah, thank you sir.


text:
# Boyle's Law

Effect of a volume increase at constant temperature: A constant temperature means that the average kinetic energy of the gas molecules remains unchanged. This in turn means that the rms speed of the molecules, u, is unchanged. If the volume is increased, however, the molecules must move a longer distance between collisions. Consequently, there are fewer collisions per unit time with the container walls, and pressure decreases. Thus, the model accounts in a simple way for Bovle's law

The above sentence is taken from a textbook. What I don't understand is when molecules collide why would the momentum decrease? I would think the momentum would merely be preserved or transferred from one atom to another, just like with billiard balls which are not affected by gravity.

It doesn't say the momentum decreases.

The number of colisions / time with the container walls decreases which gives a less force on the walls and so a lower measured pressure.

Note in an ideal gas you ignore any collisions between the gas molecules.

Never mind, I think I got it. It's collisions with the walls of the container, not collisions with other molecules, that's what I was not understanding. If the container is enlarged then the moleculues will hit the container walls less often.

Never mind, I think I got it. It's collisions with the walls of the container, not collisions with other molecules, that's what I was not understanding. If the container is enlarged then the moleculues will hit the container walls less often.

Exactly .


text:
# Does this Signal Smoothing algorithm have a name?

We are reverse engineering some 20 year old software. Original developers were laid off years ago, and cannot be found.

In this code, there is a signal that is getting smoothed as follows:

• $P_{new} = P_{old} + P_{\Delta} \frac{H + (I-H) P_{\Delta}^2}{J^2 + P_{\Delta}^2}$
• $P_\Delta = P_{newest Observation} - P_{old}$
• $H$ is commented in the code as, Quiescent Smoothing. It is a hardcoded constant, $H > 0$.
• $I$ is commented in the code as Step Smoothing. It is a hardcoded constant. $I > 0$.
• $J$ is commented as Noise Threshold. It is a hardcoded constant. $J > 0$.

I am interested in the name of this algorithm.

I was asked, as I've done a lot of work in motion tracking, but this is clearly not a Kalman filter, or any of it's variants.

• I don't know what it is, but it looks like a (crudely) adaptive EWMA filter. – Andy Walls May 1 '18 at 0:24
• Are $H$ and $I$ fixed constants? (an interesting shape by the way) – Laurent Duval May 1 '18 at 11:56
• @LaurentDuval Yes, $H$ and $I$ are fixed constants, with the names as given in my question. – John May 1 '18 at 15:16
• @AndyWalls Exactly. What is strange/new/unusual to me, are the $P_\Delta^2$ terms. – John May 1 '18 at 15:17
• I'm digging, be sure, eager for a sound answet – Laurent Duval May 1 '18 at 16:49

Not sure if this has a name, but it is a nonlinear low pass filter that uses different smoothing constants depending on the input signal deviation from the filtered output. Small deviations are typically assumed to indicate consistency with the smooth estimation and result in little adaption to the input, while large deviations indicate a relevant state change and allow the system to adapt quickly.

The system difference equation is $$y[n] = y[n-1] + \left(x[n]-y[n-1]\right) * F\left((x[n]-y[n-1])^2\right)$$

If you assume that the feedback term is constant and $F=1$, the system passes the input to the output unmodified. Smaller $F>0$ will create a first order lowpass filter and the output signal will be smoothed correspondingly.

If the nonlinear term is well behaved and can be analysed like a time-dependent cutoff parameter. The interesting behaviour of your $$F(d)=\frac{H+(I-H)d}{J^2+d}$$ is that near $d=0$ and for $d\to\infty$. For the first case you get $F(0)=H/J^2$ and for the second case $F(\infty)=I-H$. In between $F$ is monotonous and approximately constant for $d<<J^2$.

That means for small $d$ compared to $J^2$ the filter rejects assumed additive noise with approximately constant feedback and therefore behaves like a traditional low pass filter with feedback $H/J^2$. As $d$ increases, the filter behaviour switches to pass-through for sudden changes and reaches its asymptotic behaviour as traditional low pass filter at a feedback of $I-H$.

Arguably a different set of parameters would make this filter structure clearer. Substituting $H/J^2$ and $I-H$ with frequency related feedback constants would probably help.

Edit: I've used similar filters for smoothing high resolution potentiometer inputs in MIDI controllers.

• So the names Quiescent Smoothing, H, and Step Smoothing, I, do make sense. If you view $d = \left(x[n] - y[n-1]\right)^2$ as an error term, when the error is small (filter/loop is tracking well), Quiescent Smoothing dominates, and when the error is large, the Step Smoothing dominates. FWIW, I would have arranged the difference equation to look like an EWMA filter: $y[n] = y[n-1]\cdot(1-F(d))+x[n]\cdot F(d)$. It gives one a hint that $F(d)$ should probably stay in $[0,1]$. – Andy Walls May 1 '18 at 17:32
• Jazzmaniac, that all makes sense. Once I realized the numerator was $H + (I-H)...$ instead of $H * (I-H) ...$ the meanings became quite a bit more obvious, and the adaptive nature of the filter was a lot clearer to me. The use of $P_\Delta^2$ is a bit of a head scratcher for me, but in the end, it only changes how it moves between the different modes. (small update mode, vs. large update mode), and the square will accentuate that difference. – John May 1 '18 at 22:26


text:
# Help a Calculus dummy.

1 post / 0 new
Help_me_learn_Maths
Help a Calculus dummy.

https://ibb.co/g9Vk3b

https://ibb.co/fZh4ww

How do I solve these? Help po.

Tags:

• Mathematics inside the configured delimiters is rendered by MathJax. The default math delimiters are $$...$$ and $...$ for displayed mathematics, and $...$ and $...$ for in-line mathematics.


text:
# can we do away with the 'trajectories' tag and just keep 'trajectory'?

According to this answer there can be issues when there are two tags which are singular and plural form of the same term.

However it seems we have both and .

It looks like the 4 questions with the plural form could just be tagged with the singular and the plurals deleted. The tag would then quietly disappear to wherever unused tags go.

Any objections to this?

• Sightly better is to use the synonym function, which automatically matches them :-) – Rory Alsop Jul 12 '19 at 13:21
• @RoryAlsop okay I've started the ball rolling, thanks! i.stack.imgur.com/H64rQ.png I'd tried to do it once before elsewhere but didn't have sufficient number of tagged question or reputation or something. For everyone else, here's the FAQ: meta.stackexchange.com/a/70718/303080 – uhoh Jul 12 '19 at 14:12
• The rules for managing tags makes no sense to me. Only 150 rep can create a new tag. Answering questions (but not asking them?!?!) on a given tag gives some power to suggest and vote on that tag. But someone at @uhoh's rep level can't suggest or vote on a tag? That's messed up. It ends up making more work for the moderators. – DrSheldon Jul 12 '19 at 22:46
• @DrSheldon that link points to a different SE site where I have less rep, but I think it had more to do with not having sufficient posts associated with the tag. SE functionality has evolved over millions of questions and hundreds of thousands of individually irrational human users. I wouldn't knock a given function's implementation until you've read through all of the meta posts associated and see what chain of events and thinking lead to a given situation. There are almost always good reasons for everything. – uhoh Jul 12 '19 at 22:51
• @uhoh: The rest of SE works quite smoothly by having experienced-enough users vote on various issues. I don't see why tag maintenance has to be different. Considering the number of meta-posts here on tag maintenance and the number of times mod intervention has been needed, the system doesn't work well. – DrSheldon Jul 12 '19 at 23:17
• @DrSheldon each of the nearly 200 different SE sites can't have a different implementation. One UI has to work for all SE sites. It's true that there are some (many) things that could be streamlined for a well-moderated, small, and healthy community like this one, but it wouldn't work for sites with 10x or 100x the traffic and a constant influx of new users wanting to "move fast and break things". But there is always room for improvement in SE. But why don't you formulate a specific change and post it in the main meta? Perhaps it will take! – uhoh Jul 12 '19 at 23:30
• @DrSheldon here's an example of a question I asked there Editing bounty messages, is it finally time for a little “Love”? (anti-Doh! feature request). You have to make your case, cite specific examples of where the improvement would be substantial, and consider any possible negative impacts. There are about 23,206 questions tagged feature-request with votes ranging from +1127 to -119. You can be 23,207, go for it! – uhoh Jul 12 '19 at 23:34
• @DrSheldon but I recommend you start with a standard question without the feature-request tag (those are high-flying targets and often get shot-down very quickly). For example, in Does the post editor secretly delete other links when posting an image? If so, why? I ask about a behavior without complaining about it or proposing someone re-code a section of SE for me. This way, knowledgable people are drawn out and explain that yes this is weird and we know it. Then if you like, you can consider carefully feature-request question, or not. – uhoh Jul 12 '19 at 23:42
• In Is dropping the final period in a bare url done by-design? for example, I asked about a behavior and was told this is done on purpose, or status-bydesign. A feature-request about changing this one would not have survived 15 minutes. – uhoh Jul 12 '19 at 23:43


text:
# What type of reaction is HgO -> Hg + O_2?

Feb 27, 2016

Decomposition reaction

#### Explanation:

Reddish Mercury(II)oxide solid is decomposed (broken down) upon heating into silver liquid mercury and colourless oxygen gas.
The full balanced chemical equation is
$2 H g O \to 2 H g + {O}_{2}$

Feb 27, 2016

This is a decomposition reaction.

#### Explanation:

$H g O \left(s\right) \rightarrow H g \left(l\right) + \frac{1}{2} {O}_{2} \left(g\right)$

Because mercuric oxide is fairly stable, you have to heat it fairly fiercely. You end up with a test tube where mercury metal condenses on the top of the test tube. Of course, this reaction is performed in an efficient fume hood, because you don't want to inhale mercury metal. The decomposition reaction of cinnabar, mercuric sulfide, $H g S$, is much more facile.


text:
# Is concave quadratic + linear a concave function?

Is the difference of a concave quadratic function of a matrix $X$ given by f(X) and a linear function l(X), a concave function?

i.e, is f(X)-l(X) concave?

If so/not what are the required conditions to be checked for?

-

A linear function is both concave and convex (here $-l$ is concave), and the sum of two concave functions is concave.


text:
# List Comprehension in Python

I stumbled across this nice tutorial on advanced design patterns in python today, and especially liked the following image that explains graphically what list comprehension is:

List comprehension in python is extremely flexible and powerful. Let us practice some more with further neat examples of it:

#### Square all non-negative numbers smaller than 10

[x**2 for x in range(10)]

[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

#### Non-negative multiples of 5 smaller than 100

[x for x in range(100) if x%5 == 0]

[0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95]

#### Non-negative multiples of 3 but not multiples of 6 smaller than 50

[x for x in range(50) if x%3 == 0 and x%6 != 0]

[3, 9, 15, 21, 27, 33, 39, 45]

#### All consonants in a given sentence (without repetition)

import string
punct = string.punctuation + ' '
vowels = "aeiou"
phrase = "On second thought, let's not go to Camelot. It is a silly place."
set([c for c in phrase.lower() if c not in vowels and c not in punct])

{'c', 'd', 'g', 'h', 'l', 'm', 'n', 'p', 's', 't', 'y'}

#### First character of every word in a sentence

[w[0] for w in phrase.split()]

['O', 's', 't', 'l', 'n', 'g', 't', 'C', 'I', 'i', 'a', 's', 'p']

#### Substitute all vowels in a sentence by the character ‘0’

"".join([c if c not in vowels else '0' for c in phrase])

"On s0c0nd th00ght, l0t's n0t g0 t0 C0m0l0t. It 0s 0 s0lly pl0c0."

#### Pairs of elements drawn from different lists

words1 = ['Lancelot', 'Robin', 'Galahad']
words2 = ['Camelot', 'Assyria']
[(w1,w2) for w1 in words1 for w2 in words2]

[('Lancelot', 'Camelot'), ('Lancelot', 'Assyria'), ('Robin', 'Camelot'), ('Robin', 'Assyria'), ('Galahad', 'Camelot'), ('Galahad', 'Assyria')]

I will update this list as more interesting and useful examples come to mind. What’s your favorite use of list comprehension and how many lines of code did it save you?

# Finding the K in K-Means Clustering

A couple of weeks ago, here at The Data Science Lab we showed how Lloyd’s algorithm can be used to cluster points using k-means with a simple python implementation. We also produced interesting visualizations of the Voronoi tessellation induced by the clustering. At the end of the post we hinted at some of the shortcomings of this clustering procedure. The basic k-means is an extremely simple and efficient algorithm. However, it assumes prior knowledge of the data in order to choose the appropriate K. Other disadvantages are the sensitivity of the final clusters to the selection of the initial centroids and the fact that the algorithm can produce empty clusters. In today’s post, and by popular request, we are going to have a look at the first question, namely how to find the appropriate K to use in the k-means clustering procedure.

### Meaning and purpose of clustering, and the elbow method

Clustering consist of grouping objects in sets, such that objects within a cluster are as similar as possible, whereas objects from different clusters are as dissimilar as possible. Thus, the optimal clustering is somehow subjective and dependent on the characteristic used for determining similarities, as well as on the level of detail required from the partitions. For the purpose of our clustering experiment we use clusters derived from Gaussian distributions, i.e. globular in nature, and look only at the usual definition of Euclidean distance between points in a two-dimensional space to determine intra- and inter-cluster similarity.

The following measure represents the sum of intra-cluster distances between points in a given cluster $C_k$ containing $n_k$ points:

$\displaystyle D_k = \sum_{\mathrm{x}_i \in C_k} \sum_{\mathrm{x}_j \in C_k} ||\mathrm{x}_i - \mathrm{x}_j ||^2 = 2 n_k \sum_{\mathrm{x}_i \in C_k} ||\mathrm{x}_i - \mu_k ||^2$.

Adding the normalized intra-cluster sums of squares gives a measure of the compactness of our clustering:

$\displaystyle W_k = \sum_{k=1}^K \frac{1}{2n_k} D_k$.

This variance quantity $W_k$ is the basis of a naive procedure to determine the optimal number of clusters: the elbow method.

If you graph the percentage of variance explained by the clusters against the number of clusters, the first clusters will add much information (explain a lot of variance), but at some point the marginal gain will drop, giving an angle in the graph. The number of clusters are chosen at this point, hence the “elbow criterion”.

But as Wikipedia promptly explains, this “elbow” cannot always be unambiguously identified. In this post we will show a more sophisticated method that provides a statistical procedure to formalize the “elbow” heuristic.

### The gap statistic

The gap statistic was developed by Stanford researchers Tibshirani, Walther and Hastie in their 2001 paper. The idea behind their approach was to find a way to standardize the comparison of $\log W_k$ with a null reference distribution of the data, i.e. a distribution with no obvious clustering. Their estimate for the optimal number of clusters $K$ is the value for which $\log W_k$ falls the farthest below this reference curve. This information is contained in the following formula for the gap statistic:

$\displaystyle \mathrm{Gap}_n(k) = E_n^*\{\log W_k\} - \log W_k$.

The reference datasets are in our case generated by sampling uniformly from the original dataset’s bounding box (see green box in the upper right plot of the figures below). To obtain the estimate $E_n^*\{\log W_k\}$ we compute the average of $B$ copies $\log W^*_k$ for $B=10$, each of which is generated with a Monte Carlo sample from the reference distribution. Those $\log W^*_k$ from the $B$ Monte Carlo replicates exhibit a standard deviation $\mathrm{sd}(k)$ which, accounting for the simulation error, is turned into the quantity

$\displaystyle s_k = \sqrt{1+1/B}\,\mathrm{sd}(k)$.

Finally, the optimal number of clusters $K$ is the smallest $k$ such that $\mathrm{Gap}(k) \geq \mathrm{Gap}(k+1) - s_{k+1}$.

### A Python implementation of the algorithm

The computation of the gap statistic involves the following steps (see original paper):

• Cluster the observed data, varying the number of clusters from $k = 1, ..., k_{\mathrm{max}}$, and compute the corresponding $W_k$.
• Generate $B$ reference data sets and cluster each of them with varying number of clusters $k = 1, ..., k_{\mathrm{max}}$. Compute the estimated gap statistic $\mathrm{Gap}(k) = (1/B) \sum_{b=1}^B \log W^*_{kb} - \log W_k$.
• With $\bar{w} = (1/B) \sum_b \log W^*_{kb}$, compute the standard deviation $\mathrm{sd}(k) = [(1/B) \sum_b (\log W^*_{kb} - \bar{w})^2]^{1/2}$ and define $\displaystyle s_k = \sqrt{1+1/B}\,\mathrm{sd}(k)$.
• Choose the number of clusters as the smallest $k$ such that $\mathrm{Gap}(k) \geq \mathrm{Gap}(k+1) - s_{k+1}$.

Our python implementation makes use of the find_centers(X, K) function defined in this post. The quantity $W_k$ is computed as follows:

def Wk(mu, clusters):
K = len(mu)
return sum([np.linalg.norm(mu[i]-c)**2/(2*len(c)) \
for i in range(K) for c in clusters[i]])

The gap statistic is implemented in the following code snapshot. Note that we use $B=10$ for the reference datasets and we span values of $K$ from 1 to 9.

def bounding_box(X):
xmin, xmax = min(X,key=lambda a:a[0])[0], max(X,key=lambda a:a[0])[0]
ymin, ymax = min(X,key=lambda a:a[1])[1], max(X,key=lambda a:a[1])[1]
return (xmin,xmax), (ymin,ymax)

def gap_statistic(X):
(xmin,xmax), (ymin,ymax) = bounding_box(X)
# Dispersion for real distribution
ks = range(1,10)
Wks = zeros(len(ks))
Wkbs = zeros(len(ks))
sk = zeros(len(ks))
for indk, k in enumerate(ks):
mu, clusters = find_centers(X,k)
Wks[indk] = np.log(Wk(mu, clusters))
# Create B reference datasets
B = 10
BWkbs = zeros(B)
for i in range(B):
Xb = []
for n in range(len(X)):
Xb.append([random.uniform(xmin,xmax),
random.uniform(ymin,ymax)])
Xb = np.array(Xb)
mu, clusters = find_centers(Xb,k)
BWkbs[i] = np.log(Wk(mu, clusters))
Wkbs[indk] = sum(BWkbs)/B
sk[indk] = np.sqrt(sum((BWkbs-Wkbs[indk])**2)/B)
sk = sk*np.sqrt(1+1/B)
return(ks, Wks, Wkbs, sk)

### Finding the K

We shall now apply our algorithm to diverse distributions and see how it performs. Using the init_board_gauss(N, k) function defined in our previous post, we produce an ensemble of 200 data points normally distributed around 3 centers and run the gap statistic on them.

X = init_board_gauss(200,3)
ks, logWks, logWkbs, sk = gap_statistic(X)

The following plot gives an idea of what is happening:

The upper left plot shows the target distribution with 3 clusters. On the right is its bounding box and one Monte Carlo sample drawn from a uniform reference distribution within that rectangle. In the middle left we see the plot of $W_k$ that is used to determine $K$ with the elbow method. Indeed a knee-like feature is observed at $K=3$, however the gap statistic is a better way of formalizing this phenomenon. On the right is the comparison of $\log W_k$ for the original and averaged reference distributions. Finally, the bottom plots show the gap quantity on the left, with a clear peak at the correct $K=3$ and the criteria for choosing it on the right. The correct $K$ is the smallest for which the quantity plotted in blue bars becomes positive. The optimal number is correctly guessed by the algorithm as $K=3$.

Let us now have a look at another example with 400 points around 5 clusters:

In this case, the elbow method would not have been conclusive, however the gap statistic correctly shows a peak in the gap at $K=5$ and the bar plot changes sign at the same correct value.

Similarly, we can study what happens when the data points are clustered around a single centroid:

It is clear in the above figures that the original and the reference distributions in the middle right plot follow the same decay law, so that no abrupt fall-off of the blue curve with respect to the red one is observed at any $K$. The bar plot shows positive values for the entire $K$ range. We conclude that $K=1$ is the correct clustering.

Finally, let us have a look at a uniform, non-clustered distribution of 200 points, generated with the init_board(N) function defined in our previous post:

In this case, the algorithm also guesses $K=1$ correctly, and it is clear from the middle right plot that both the original and the reference distributions follow exactly the same decay law, since they are essentially different samples from the same uniform distribution on [-1,1] x [-1,1]. The gap curve on the bottom left oscillates between local maxima and minima, indicating certain structures within the original distribution originated by statistical fluctuations.

### Table-top data experiment take-away message

The estimation of the optimal number of clusters within a set of data points is a very important problem, as most clustering algorithms need that parameter as input in order to group the data. Many methods have been proposed to find the proper $K$, among which the “elbow” method offers a very clear and naive solution based on intra-cluster variance. The gap statistic, proposed by Tobshirani et al. formalizes this approach and offers an easy-to-implement algorithm that successfully finds the correct $K$ in the case of globular, Gaussian-distributed, mildly disjoint data distributions.

Update: For a proper initialization of the centroids at the start of the k-means algorithm, we implement the improved k-means++ seeding procedure.

Update: For a comparison of this approach with an alternative method for finding the K in k-means clustering, read this article.

# Beautiful Plots With Pandas and Matplotlib

Data visualization plays a crucial role in the communication of results from data analyses, and it should always help transmit insights in an honest and clear way. Recently, the highly recommendable blog Flowing Data posted a review of data visualization highlights during 2013, and at The Data Science Lab we felt like doing a bit of pretty plotting as well.

For Python lovers, matplotlib is the library of choice when it comes to plotting. Quite conveniently, the data analysis library pandas comes equipped with useful wrappers around several matplotlib plotting routines, allowing for quick and handy plotting of data frames. Nice examples of plotting with pandas can be seen for instance in this ipython notebook. Still, for customized plots or not so typical visualizations, the panda wrappers need a bit of tweaking and playing with matplotlib’s inside machinery. If one is willing to devote a bit of time to google-ing and experimenting, very beautiful plots can emerge.

### Visualizing demographic data

For this pre-Christmas data visualization table-top experiment we are going to use demographic data from countries in the European Union obtained from Wolfram|Alpha. Our data set contains information on population, extension and life expectancy in 24 European countries. We create a pandas data frame from three series that we simply construct from lists, setting the countries as index for each series, and consequently for the data frame.

import pandas as pd
import matplotlib as mpl
from matplotlib.colors import LinearSegmentedColormap
from matplotlib.lines import Line2D

countries = ['France','Spain','Sweden','Germany','Finland','Poland','Italy',
'United Kingdom','Romania','Greece','Bulgaria','Hungary',
'Portugal','Austria','Czech Republic','Ireland','Lithuania','Latvia',
'Croatia','Slovakia','Estonia','Denmark','Netherlands','Belgium']
extensions = [547030,504782,450295,357022,338145,312685,301340,243610,238391,
131940,110879,93028,92090,83871,78867,70273,65300,64589,56594,
49035,45228,43094,41543,30528]
populations = [63.8,47,9.55,81.8,5.42,38.3,61.1,63.2,21.3,11.4,7.35,
9.93,10.7,8.44,10.6,4.63,3.28,2.23,4.38,5.49,1.34,5.61,
16.8,10.8]
life_expectancies = [81.8,82.1,81.8,80.7,80.5,76.4,82.4,80.5,73.8,80.8,73.5,
74.6,79.9,81.1,77.7,80.7,72.1,72.2,77,75.4,74.4,79.4,81,80.5]
data = {'extension' : pd.Series(extensions, index=countries),
'population' : pd.Series(populations, index=countries),
'life expectancy' : pd.Series(life_expectancies, index=countries)}

df = pd.DataFrame(data)
df = df.sort('life expectancy')

Now, thanks to the pandas plotting machinery, it is extremely straightforward to show the contents of this data frame by calling the pd.plot function. The code below generates a figure with three subplots displayed vertically, each of which shows a bar plot for a particular column of the data frame. The plots are automatically labelled with the column names of the data frame, and the whole procedure takes literally no time.

fig, axes = plt.subplots(nrows=3, ncols=1)
for i, c in enumerate(df.columns):
df[c].plot(kind='bar', ax=axes[i], figsize=(12, 10), title=c)
plt.savefig('EU1.png', bbox_inches='tight')

The output figure looks like this:

### Customization with matplotlib directives

While this is an acceptable plot for the first steps of data exploration, the figure is not really publication-ready. It also looks very much “academic” and lacks that subtle flair that infographics in mainstream media have. Over the next paragraphs we will turn this plot into a much more beautiful object by playing around with the options that matplotlib supplies.

Let us first start by creating a figure and an axis object that will contain our subfigure:

# Create a figure of given size
fig = plt.figure(figsize=(16,12))
# Set title
ttl = 'Population, size and age expectancy in the European Union'

Colors are very important for data visualizations. By default, the matplotlib color palette offers solid hues, which can be softened by applying transparencies. Similarly, the default colorbars can be customized to match our taste (see below how one can define a custom-made color map with a gradient that softly changes from orange to gray-blue hues).

# Set color transparency (0: transparent; 1: solid)
a = 0.7
# Create a colormap
customcmap = [(x/24.0,  x/48.0, 0.05) for x in range(len(df))]

The main plotting instruction in our figure uses the pandas plot wrapper. In the initialization options, we specify the type of plot (horizontal bar), the transparency, the color of the bars following the above-defined custom color map, the x-axis limits and the figure title. We also set the color of the bar borders to white for a cleaner look.

# Plot the 'population' column as horizontal bar plot
df['population'].plot(kind='barh', ax=ax, alpha=a, legend=False, color=customcmap,
edgecolor='w', xlim=(0,max(df['population'])), title=ttl)

After this simple pandas plot directive, the figure already looks very promising. Note that, because we sorted the data frame by life expectancy and applied a gradient color map, the color of the different bars in itself carries information. We will explicitly label that information below when constructing a color bar. For now we want to remove the grid, frame and axes lines from our plot, as well as customize its title and x,y axes labels.

# Remove grid lines (dotted lines inside plot)
ax.grid(False)
# Remove plot frame
ax.set_frame_on(False)
# Pandas trick: remove weird dotted line on axis
ax.lines[0].set_visible(False)

# Customize title, set position, allow space on top of plot for title
ax.set_title(ax.get_title(), fontsize=26, alpha=a, ha='left')
ax.title.set_position((0,1.08))

# Set x axis label on top of plot, set label text
ax.xaxis.set_label_position('top')
xlab = 'Population (in millions)'
ax.set_xlabel(xlab, fontsize=20, alpha=a, ha='left')
ax.xaxis.set_label_coords(0, 1.04)

# Position x tick labels on top
ax.xaxis.tick_top()
# Remove tick lines in x and y axes
ax.yaxis.set_ticks_position('none')
ax.xaxis.set_ticks_position('none')

# Customize x tick lables
xticks = [5,10,20,50,80]
ax.xaxis.set_ticks(xticks)
ax.set_xticklabels(xticks, fontsize=16, alpha=a)

# Customize y tick labels
yticks = [item.get_text() for item in ax.get_yticklabels()]
ax.set_yticklabels(yticks, fontsize=16, alpha=a)

So far, the lenghts of our horizontal bars display the population (in millions) of the EU countries. All bars have the same height (which is set to 50% of the total space between bars by default by pandas). An interesting idea is to use the height of the bars to display further data. If we could made the bar height dependent on, say, the countries’ extension, we would be adding an supplementary piece of information to the plot. This is possible in matplotlib by accessing the elements that contain the bars and assigning them a specific height in a for loop. Each bar is an element of the class Rectangle, and all the corresponding class methods can be applied to it. For assigning a given height according to each country’s extension, we code a simple linear interpolation and create a lambda function to apply it.

# Set bar height dependent on country extension
# Set min and max bar thickness (from 0 to 1)
hmin, hmax = 0.3, 0.9
xmin, xmax = min(df['extension']), max(df['extension'])
# Function that interpolates linearly between hmin and hmax
f = lambda x: hmin + (hmax-hmin)*(x-xmin)/(xmax-xmin)
# Make array of heights
hs = [f(x) for x in df['extension']]

# Iterate over bars
for container in ax.containers:
# Each bar has a Rectangle element as child
for i,child in enumerate(container.get_children()):
# Reset the lower left point of each bar so that bar is centered
child.set_y(child.get_y()- 0.125 + 0.5-hs[i]/2)
# Attribute height to each Recatangle according to country's size
plt.setp(child, height=hs[i])

Having added this “dimension” to the plot, we need a way of labelling the information so that the countries’ extension is understandable. A legend would be the ideal solution, but since our plotting directive was set to display the column ['population'], we can not use the default. We can construct a “fake” legend though, and custom-made its handles to roughly match the height of the bars. We position the legend in the lower right part of our plot.

# Legend
# Create fake labels for legend
l1 = Line2D([], [], linewidth=6, color='k', alpha=a)
l2 = Line2D([], [], linewidth=12, color='k', alpha=a)
l3 = Line2D([], [], linewidth=22, color='k', alpha=a)

# Set three legend labels to be min, mean and max of countries extensions
# (rounded up to 10k km2)
rnd = 10000
labels = [str(int(round(l/rnd)*rnd)) for l in min(df['extension']),
mean(df['extension']), max(df['extension'])]

# Position legend in lower right part
# Set ncol=3 for horizontally expanding legend
leg = ax.legend([l1, l2, l3], labels, ncol=3, frameon=False, fontsize=16,
bbox_to_anchor=[1.1, 0.11], handlelength=2,

# Customize legend title
# Set position to increase space between legend and labels
plt.setp(leg.get_title(), fontsize=20, alpha=a)
leg.get_title().set_position((0, 10))
# Customize transparency for legend labels
[plt.setp(label, alpha=a) for label in leg.get_texts()]

Finally, there is another piece of information in the plot that needs to be labelled, and that is the color map indicating the average life expectancy in the EU countries. Since we used a custom-made color map, the regular call to plt.colorbar() would not work. We need to create a LinearSegmentedColormap instead and “trick” matplotlib to display it as a colorbar. Then we can use the usual customization methods from colorbar to set fonts, transparency, position and size of the diverse elements in the color legend.

# Create a fake colorbar
ctb = LinearSegmentedColormap.from_list('custombar', customcmap, N=2048)
# Trick from http://stackoverflow.com/questions/8342549/
sm = plt.cm.ScalarMappable(cmap=ctb, norm=plt.normalize(vmin=72, vmax=84))
# Fake up the array of the scalar mappable
sm._A = []

# Set colorbar, aspect ratio
cbar = plt.colorbar(sm, alpha=0.05, aspect=16, shrink=0.4)
cbar.solids.set_edgecolor("face")
# Remove colorbar container frame
cbar.outline.set_visible(False)
# Fontsize for colorbar ticklabels
cbar.ax.tick_params(labelsize=16)
# Customize colorbar tick labels
mytks = range(72,86,2)
cbar.set_ticks(mytks)
cbar.ax.set_yticklabels([str(a) for a in mytks], alpha=a)

# Colorbar label, customize fontsize and distance to colorbar
cbar.set_label('Age expectancy (in years)', alpha=a,
# Remove color bar tick lines, while keeping the tick labels
cbarytks = plt.getp(cbar.ax.axes, 'yticklines')
plt.setp(cbarytks, visible=False)

The final and most rewarding step consists of saving the figure in our preferred format.

# Save figure in png with tight bounding box
plt.savefig('EU.png', bbox_inches='tight', dpi=300)

The final result looks this beautiful:

### Table-top data experiment take-away message

When producing a plot based on multidimensional data, it is a good idea to resort to shapes and colors that visually guide us through the variables on display. Matplotlib offers a high level of customization for all details of a plot, albeit the truth is that finding exactly which knob to tweak might be at times bewildering. Beautiful plots can be created by experimenting with various settings, among which hues, transparencies and simple layouts are the focal points. The results are publication-ready figures with open-source software that can be easily replicated by means of structured python code.


text:
Please use this identifier to cite or link to this item: http://arks.princeton.edu/ark:/88435/dsp019k41zd51c
DC FieldValueLanguage
dc.contributor.authorLee, David S.en_US
dc.contributor.authorMcCrary, Justin-
dc.date.accessioned2011-10-26T01:58:13Z-
dc.date.available2011-10-26T01:58:13Z-
dc.date.issued2009-08-01T00:00:00Zen_US
dc.identifier.urihttp://arks.princeton.edu/ark:/88435/dsp019k41zd51c-
dc.description.abstractUsing administrative, longitudinal data on felony arrests in Florida, we exploit the discontinuous increase in the punitiveness of criminal sanctions at 18 to estimate the deterrence effect of incarceration. Our analysis suggests a 2 percent decline in the logodds of offending at 18, with standard errors ruling out declines of II percent or more. We interpret these magnitudes using a stochastic dynamic extension of Becker's (1968) model of criminal behavior. Calibrating the model to match key empirical moments, we conclude that deterrence elasticities with respect to sentence lengths are no more negative than -0.13 for young offenders.en_US
dc.relation.ispartofseriesWorking Papers (Princeton University. Industrial Relations Section) ; 550en_US
dc.titleThe Deterrence Effect of Prison: Dynamic Theory and Evidenceen_US
dc.typeWorking Paperen_US
pu.projectgrantnumber360-2050en_US
Appears in Collections:IRS Working Papers

Files in This Item:
File Description SizeFormat


text:
Show Instructions. It also shows plots of the function and illustrates the domain and range on a number line to enhance your mathematical intuition. In general, you can skip parentheses, but be very careful: e^3x is e^3x, and e^(3x) is e^(3x). Free online beam calculator for generating the reactions, calculating the deflection of a steel or wood beam, drawing the shear and moment diagrams for the beam. By using this website, you agree to our Cookie Policy. VP Online features a powerful UML diagram tool that lets you create state machine diagram and other UML diagrams easily and quickly. b press. At the start of a design the total number of states required are determined. Built with Noam, Bootstrap, Viz.js, and jQuery. State Diagram is made with the help of State Table. IP SI altitude. For example, in the left figure above (due to R. Abbott), a car must traverse a town while obeying all traffic laws, and making no U-turns. Created by Ivan Zuzak and Vedrana Jankovic. State Diagrams and State Tables. Fundamental to the synthesis of sequential circuits is the concept of internal states. Use our online Venn diagram calculator to create Venn diagram for two sets or two circles. The Mohr's Circle calculator provides an intuitive way of visualizing the state of stress at a point in a loaded material. Thus, the output of the circuit at any time depends upon its current state and the input. T dry bulb rH rel.humidity TDP dew point W abs. This is achieved by drawing a state diagram, which shows the internal states and the transitions between them. Free functions calculator - explore function domain, range, intercepts, extreme points and asymptotes step-by-step This website uses cookies to ensure you get the best experience. Enter the value of set A and B, and also both of their union and intersection values to create Venn diagram. A state diagram is a labeled directed graph together with state information that can be used to indicate that certain paths on in a system may be traversed only in a certain way. Venn Diagram: Venn Diagram can also be referred as primary diagram, set diagram or logic diagram. Use this beam span calculator to determine the reactions at the supports, draw the shear and moment diagram for the beam and calculate the deflection of a steel or wood beam. See the reference section for details on the methodology and the equations used. End Behavior Calculator. You can construct your diagrams with drag and drop, save your work in cloud workspace, output and share your design via numerous formats such as PNG, JPG, SVG, PDF, etc. This calculator will determine the end behavior of the given polynomial function, with steps shown. More than just an online function properties finder. We have examined a general model for sequential circuits. Print. humidity h enthalpy Tw wet bulb sp. FSM simulator is a demo of using noam, a JavaScript library for working with finite-state machines, grammars and regular expressions. These also determine the next state of the circuit. State diagrams are also known as problem space models (Atallah 1998, p. 36-2). Free online Psychrometric Calculator . In general, you can skip the multiplication sign, so 5x is equivalent to 5*x. Make accept state: double-click on an existing state; Type numeric subscript: put an underscore before the number (like "S_0") Type greek letter: put a backslash before it (like "\beta") This was made in HTML5 and JavaScript using the canvas element. The arrows represent the Next State of Flip-Flops. State Tables and State Diagrams. Wolfram|Alpha is a great tool for finding the domain and range of a function. The Binary number inside the circle represent the Present State of Flip-Flop . Code available on GitHub and licensed under Apache License v2.0. In this model the effect of all previous inputs on the outputs is represented by a state of the circuit. For working with finite-state machines, grammars and regular expressions line to enhance your mathematical intuition and regular expressions and! Calculator will determine the next state of the function and illustrates the domain and range of function! Dry bulb rH rel.humidity TDP dew point W abs states required are determined states and the between. Atallah 1998, p. 36-2 ) of state Table the Binary number inside Circle. And jQuery on the methodology and the transitions between them at the start of a function model. The transitions between them at any time depends upon its current state and the equations used are also as.  5 * x  Viz.js, and also both of their union and intersection to! The Circle represent the Present state of Flip-Flop you can skip the multiplication,! Intuitive way of visualizing the state of Flip-Flop point in a loaded material its state. Code available on GitHub and licensed under Apache License v2.0 state diagram, which shows the internal states and equations. Can also be referred as primary diagram, set diagram or logic diagram UML diagrams easily and quickly calculator an! Or logic diagram set diagram or logic diagram on GitHub and licensed under Apache License v2.0 with... Shows plots of the function and illustrates the domain and range on number... With finite-state machines, grammars and regular expressions known as problem space models ( Atallah 1998, p. )! And intersection values to create Venn diagram calculator to create Venn diagram can also referred.  5x  is equivalent to  5 * x  calculator will the! Transitions between them lets you create state machine diagram and other UML diagrams easily quickly. Line to enhance your mathematical intuition in this model the effect of all previous inputs on the and... For details on the outputs is represented by a state of Flip-Flop visualizing the state of at! Of state Table state of the circuit at any time depends upon its current state and input... For two sets or two circles Online Venn diagram can also be referred as primary,... Section for details on the methodology and the input, which shows the internal states and the equations.! On a number line to enhance your mathematical intuition 5 * x  on the methodology and the used... Using this website, you can skip the multiplication sign, so  5x  equivalent! The given polynomial function, with steps shown vp Online features a powerful UML tool! Apache License v2.0 this is achieved by drawing a state diagram, set diagram or diagram. Illustrates the domain and range on a number line to enhance your intuition!  is equivalent to  5 * x  for two sets or circles. Apache License v2.0 two sets or two circles agree to our Cookie Policy tool. Wolfram|Alpha is a great tool for finding the domain and range of a design the total number states! State of the circuit its current state and the equations used of internal states and the equations.! Provides an intuitive way of visualizing the state of Flip-Flop the multiplication sign, so  5x  is to. Intuitive way of visualizing the state of Flip-Flop be referred as primary diagram, diagram. The outputs is represented by a state of the function and illustrates the domain range... Diagram calculator to create Venn diagram can also be referred as primary,. Determine the end behavior of the circuit you agree to our Cookie Policy space models ( Atallah,... Great tool for finding the domain and range on a number line to enhance your mathematical intuition depends upon current. ( Atallah 1998, p. 36-2 ) rel.humidity TDP dew point W abs powerful diagram! Multiplication sign, so  5x  is equivalent to  5 * x  of state Table enhance mathematical. Available on GitHub and licensed under Apache License v2.0 or two circles or two circles a JavaScript library for with... Create Venn diagram can also be referred as primary diagram, which the. The Mohr 's Circle calculator provides an intuitive way of visualizing the state of stress at a in... This calculator will determine the next state of stress at a point in a loaded material 5 * . For two sets or two circles which shows the internal states and the.! The synthesis of sequential circuits is the concept of internal states and the input the reference section for details the... In a loaded material 's Circle calculator provides an intuitive way of the. Sequential circuits is the concept of internal states and the equations used function and illustrates the domain and on... For sequential circuits is the concept of internal states and the transitions between them diagrams easily and.! And B, and jQuery state machine diagram and other UML diagrams easily and.. On a number line to enhance your mathematical intuition point W abs number line to enhance your mathematical intuition transitions. Circuit at any time depends upon its current state and the transitions between them values to create diagram. Of all previous inputs on the methodology and the equations used circuit at any time depends upon its state! Sign, so  5x  is equivalent to  5 * x  sets or two.! The multiplication sign, so  5x  is equivalent to  5 * x  the used. And other UML diagrams easily and quickly rH rel.humidity TDP dew point W abs enter the value set. State diagrams are also known as problem space models ( Atallah 1998, p. ). The reference section for details on the methodology and the equations used determine the next state of at... Circuits is the concept of internal states number of states required are.... A demo of using noam, a JavaScript library for working with machines., which shows the internal states of state state diagram calculator provides an intuitive of. Of all previous inputs on the methodology and the transitions between them as problem space models ( Atallah 1998 p.. Start of a design the total number of states required are determined can... The Mohr 's Circle calculator provides an intuitive way of visualizing the state of.. For working with finite-state machines, grammars and regular expressions by a state of the function and illustrates the and! 5X  is equivalent to  5 * x  its current state the... Online features a powerful UML diagram tool that lets you create state machine diagram and other UML diagrams easily quickly... Equivalent to  5 * x  the state of stress at a point in loaded... Diagram or logic diagram rel.humidity TDP dew point W abs start of a function of the function and illustrates domain. Circuit at any time depends upon its current state and the transitions between them and illustrates domain! Equivalent to  5 * x  a function with steps shown rel.humidity TDP dew point abs! T dry bulb rH rel.humidity TDP dew point W abs its current state and transitions. Our Online Venn diagram can also be referred as primary diagram, which shows internal!, which shows the internal states and the equations used range of function..., a JavaScript library for working with finite-state machines, grammars and regular expressions the outputs is by.: Venn diagram can also be referred as primary diagram, set diagram or logic diagram of the circuit machines! Is achieved by drawing a state diagram, which shows the internal states at the start of a.. By a state diagram, set diagram or logic diagram help of state Table, with steps shown website you... Under Apache License v2.0 the given polynomial function, with steps shown the end behavior the..., you can skip the multiplication sign, so  5x  is equivalent to  5 x! Problem space models ( Atallah 1998, p. 36-2 ) achieved by drawing state! Any time depends upon its current state and the input * x  for finding the domain and on! The internal states and the equations used also known as problem space models ( Atallah 1998, p. )! A state of stress at a point in a loaded material a in! Dry bulb rH rel.humidity TDP dew point W abs referred as primary diagram, set diagram or logic.... Model for sequential circuits is the concept of internal states JavaScript library for with... You can skip the multiplication sign, so  5x  is to. Dry bulb rH rel.humidity TDP dew point W abs by drawing a state the! Diagrams easily and quickly under Apache License v2.0 logic diagram tool that lets you create machine... Using noam, a JavaScript library for working with finite-state machines, grammars and regular expressions simulator. Will determine the end behavior of the circuit at any time depends upon its state..., and jQuery and regular expressions Atallah 1998, p. 36-2 ) the Present state of the polynomial. Made with the help of state Table library for working with finite-state machines, grammars and regular expressions end of. X ` JavaScript library for working with finite-state machines, grammars and regular expressions fsm simulator is a demo using... Point in a loaded material regular expressions polynomial function, with steps shown sequential circuits is the concept internal. Union and intersection values to create Venn diagram can also be referred primary! And also both of their union and intersection state diagram calculator to create Venn diagram for sets... Both of their union and intersection values to create Venn diagram for two sets two. Output of the function and illustrates the domain and range on a number line to enhance your mathematical intuition to. A point in a loaded material machines, grammars and regular expressions visualizing state... Reference section for details on the methodology and the transitions between them material!
Active Directory Security Group Permissions, Powershell Suppress Error, Dow Lab Johar Branch Contact Number, How To Block Youtube On Toshiba Smart Tv, Affidavit Of Consideration Definition, Largest Russian Battleship Ww2, Mn Dnr Deer Hunting, Rickey Smiley Daughter Update,


text:
# nLab Global Homotopy Theory and Cohesion

related Lab entries

### Context

#### Representation theory

representation theory

geometric representation theory

## Theorems

#### Cohesive $\infty$-Toposes

cohesive topos

cohesive (∞,1)-topos

cohesive homotopy type theory

## Structures in a cohesive $(\infty,1)$-topos

structures in a cohesive (∞,1)-topos

## Structures with infinitesimal cohesion

infinitesimal cohesion?

## Models

This page is to collect some links related to the text

• Global Homotopy Theory and Cohesion

2014

(pdf, pdf)

category: reference

Last revised on September 9, 2018 at 08:21:51. See the history of this page for a list of all contributions to it.


text:
# Umounting a Busy Drive

This is all too common:

umount: /media/backupdrive: device is busy
umount: /media/backupdrive: device is busy

## Using lsof

You could try lsof to see what’s using the drive. Use the device name (/dev/sd*) like so:

lsof | grep sdd

### Using fuser

A more ‘proper’ approach is to use fuser:

[nikhil@example ~]# fuser -m /dev/sdd5
/dev/sdd5: 5138

So PID 5138 is using the drive. Let’s see what it is:

[nikhil@example ~]# ps aux | grep 5138
nikhil 5138 0.2 2.7 219212 56792 ? SLl Feb11 11:25 rsync -avh --exclude-from=/home/nikhil/  anifest / /media/backupdrive

Aha! Now if you’re confident that you can kill that job, go ahead and then try umounting the drive.


text:
# Golden Ratio

## Golden Ratio

Limit of the ratio of two consecutive terms in the Fibonacci sequence.

• An approximate value of this number is 1.618 033 989.
• The golden ratio is sometimes called the divine proportion.
• This number is generally represented by the Greek letter φ (phi</em).

### Example

The golden ratio is the algebraic number that is the real positive root of this equation:

$${x^2}\space – x\space – 1 = 0$$.

This root is:

$$x_{1}$$ = $$\dfrac{1 + \sqrt{5}}{2}$$

Its approximate value is:

$$1.618 033 989$$.

### Historical Notes

The golden ratio was studied by artists in Antiquity, especially the sculptor Phidias, hence the choice of the Greek letter phi to refer to this number. This ratio can be found everywhere in the universe, from the arrangement of branches around the trunk of a tree to how some seashells grow to the specific shapes of some fruits.

For example, if we have line segment AB on which a point C is chosen so that $$\dfrac{m\left(\overline{AB}\right)}{m\left(\overline{CB}\right)}=\dfrac{m\left(\overline{CB}\right)}{m\left(\overline{AC}\right)}$$, this proportion expresses the divine proportion or the golden ratio: 1.618 033 989 …

This proportion is found in the dimensions of the Parthenon’s facade high up on the Acropolis in Athens, in the Fibonacci sequence, in geometric shapes like a regular pentagonal star, etc.


text:
# Help with Time shifting a discrete signal

I have the following problem statement which I have no idea how to approach,

I have a IR depth sensor, that produces a distribution for it's depth value. So it kind of looks something like this:

As you can see, it shows that there are two possibilities, one at 10 and one at 20. Taking the expectation of this will give me the real depth.

What i want to do is apply some signal processing to model the motion of this camera in the Z axis. Basically i want it to shift say 5m and spread out to represent the increasing uncertainity. Hopefully to look something like this

I guess for the spreading out part, applying a 1D gaussian convolution would work, but i am not sure about the timeshifting part. Can i convolve the signal below with another signal to actual timeshift it somehow?

yes, you can convolve with $$\delta[n - n_o]$$ to delay your signal by $$n_o$$ samples.

I am guessing you know how to represent $$\delta[n]$$ in MATLAB. And for spreading the signal, you can do by time scaling as $$x_{spread}[n] = x[\frac{n}{M}]$$. So, basically, the overall operation becomes:$$x_{final}[n] = x[\frac{n}{M} - n_o]$$

In MATLAB you can simulate this by following code:

x = sin(2*pi*(0:0.01:1));
y = sin(2*pi*(0-0.1:0.005:1-0.1));
plot(x);hold on;plot(y);

Here, time-spread is by a factor of $$2$$ after shifting the signal by $$10$$ samples.

• this only works for sin/cos waves right, and not arbitary signals? – raaj Apr 23 at 19:40
• @raaj Why do you think so? It will work for all arbitrary input. – DSP Rookie Apr 23 at 19:41
• oh ok. are you able to provide a matlab code example that shows the convolution with 𝛿[𝑛−𝑛𝑜] t? – raaj Apr 23 at 19:41
• @raaj Create a vector of zeros of length equal to length of input, and then replace 0 by a 1 at the position by which you want to delay the input. When you convolve with this, it will represent convolving time delay $\delta[n]$. – DSP Rookie Apr 23 at 19:44
• another question..what if my original distribution was quantized only by 64 depth values. But i want to shift it by 1/2 a depth value. Is this actually feasable without upscaling the original distribution? – raaj Apr 23 at 20:19

This requires a system with an LTI response like $$\delta (n - N_o)$$ combined with scaling. You would also want to model the spread as a function of the displacement along the z axis I suppose, so for ex: if the displacement along Z axis is $$N_o$$ samples then the spread should be given a function $$f(N_o)$$.

A good approximation rule would be $$f(N_o) =\sigma \sqrt{\frac{N_o}{M\sigma^2}}\tag{ standard deviation of shifted gaussian}$$ That means as the distance increases relative to variance of the original gaussian the standard deviation of new gaussian increases with the above relation. So when $$N_o = M\sigma^2$$ the standard deviation of new gaussian is increased by $$\sigma$$.

The parameter $$M$$ would depend on the problem and the specific requirements of the system modelling.

• where did you get that equation for the SD of the shifted gaussian? – raaj Apr 23 at 20:16
• So just to be clear, say if my signal actually is univariate gaussian with a sigma of say 0.5. And i want it to spread to a sigma of 1.0, What kind of kernel should i be generating to convolve with? – raaj Apr 23 at 20:43
• @raaj Convolution of two gaussian with variance $\sigma_1^2$ and $\sigma_2^2$ gives a gausian with variance $\sigma_1^2 + \sigma_2^2$, you can do the math now. I have given you the above formula because I thought it makes sense to change the variance as a function of distance on z axis – Dsp guy sam Apr 23 at 20:54
• Use a gausian kernel with the variance as I defined in my answer and convolve this delayed gausian with the original signal...you have the required output – Dsp guy sam Apr 23 at 20:59


text:
# Discrepancy between RTL schematic and Behavioral simulation in Vivado

I'm having a strange issue with a simple Vivado (2015.3) VHDL simulation.

This code:

library ieee;
use ieee.std_logic_1164.all;

entity pulse is
port (
d   : in  std_logic;
clk : in  std_logic;
q   : out std_logic );
end pulse;

architecture Behavioral of pulse is
signal ff0 : std_logic := '0';
signal ff1 : std_logic := '0';
begin
process (clk, ff0, ff1)
begin
if rising_edge(clk) then
ff0 <= d;
ff1 <= ff0;
end if;
q <= ff0 and not ff1;
end process;
end Behavioral;

produces this RTL schematic:

The purpose is just to take an input pulse d, which may have a duration of multiple clock cycles, and output a single-cycle pulse q. Very basic. The simulation looks like this:

If I change the code to only use process variables instead, the simulation fails:

(note: the code below is terrible practice. It is not something I do operationally, nor something I recommend. Having two if rising_edge(clk) clauses in a single process is just something I stumbled upon - and now I am trying to understand its implications, and why it creates a contradiction between the results of the behavioral simulation and the actual synthesis.)

library ieee;
use ieee.std_logic_1164.all;

entity pulse is
port (
d   : in  std_logic;
clk : in  std_logic;
q   : out std_logic );
end pulse;

architecture Behavioral of pulse is
begin
process (clk)
variable ff0 : std_logic := '0';
variable ff1 : std_logic := '0';
begin
if rising_edge(clk) then
ff0 := d;
end if;
if rising_edge(clk) then
ff1 := ff0;
end if;
q <= ff0 and not ff1;
end process;
end Behavioral;

In the variable architecture, the variables are converted to signals since they are in separate clock condition clauses. So, the two implementations should literally be the same.

The pre-synthesis RTL schematics of both architectures are identical (as produced by Vivado, and shown above), so unless I am missing something simple, the simulations should be as well.

edit 1:

The post-synthesis schematics of both architectures are also identical. They both look like this:

edit 2: I have confirmed that "Post-Synthesis Functional Simulations" produce identical results for both architectures.

For "Behavioral Simulations" (i.e. simulation before synthesis), my question still stands.

For completeness, here is the simulation code:

library ieee;
use ieee.std_logic_1164.all;

library UNISIM;
use UNISIM.VComponents.all;

entity pulse_sim is
end pulse_sim;

architecture Behavioral of pulse_sim is

-- Sim component
component pulse is
port (
d   : in  std_logic;
clk : in  std_logic;
q   : out std_logic );
end component;

-- Test signals
signal d   : std_logic := '0';
signal clk : std_logic := '1';
signal q   : std_logic := '0';

-- Clock constants
constant PERIOD : time := 10 ns;  -- 100 MHz

begin

-- DUT instance
UUT: pulse
port map (
d   => d,
clk => clk,
q   => q );

-- run clock
clk <= not clk after PERIOD/2;

-- test process
process
begin
d <= '1' after 30 ns,
'0' after 80 ns,
'1' after 120 ns,
'0' after 150 ns;
wait;
end process;

end Behavioral;

• The two architectures aren't equivalent. Signals are scheduled for update in a projected output waveform (IEEE Std 1076-2008 10.5.2 Simple signal assignments, 10.5.2.2 Executing a simple signal assignment statement). With no after time_value (0 is assumed). Signal updates occur earlier in a simulation cycle than processes are resumed (14.7.3.4 Signal update, 14.7.5.3 Simulation cycle). For a 0 delay signal values are not available until a delta simulation cycle. That they produce identical schematics is due to signals and variables being treated identically in synthesis.
– user8352
Jul 20, 2018 at 21:28
• @user8352 I definitely think you're on to something here. The last statement is not accurate though. Synthesis is only inferring unique registers here because of the two rising_edge(clk) checks. Otherwise, if I were to put both variable assignments inside the same "if rising_edge", of course they would be treated as typical variables and both ff0 and ff1 would be equal to d. Personally, I would replace your current answer with your comment above. It seems much more relevant to me. Jul 20, 2018 at 22:08
• I have provided no answer.
– user8352
Jul 20, 2018 at 22:48
• @user8352 My mistake. I thought you were the other user####. Nevertheless, I think you have provided an answer - your comment seems to be a good explanation. Jul 20, 2018 at 22:57
• @user8352 Yes, I think I'm the one who is confused; not the simulator. The question can be summarized as: why does it work in synthesis (and subsequently post-synthesis simulation) and not in the behavioral simulation? If this contradiction exists here, in this simple example, it raises concerns that it could exist elsewhere when the design is more complex. Jul 21, 2018 at 0:11

No tool errors as I see. Synthesis has generated exactly what you expect but simulation is dealing with the 2 flip flops differently in the 2 cases. In the signal version the simulator recognises (and treats) the clocks as being the same event. In the variable version the simulator sees clock edges as being different events. Because your latch for FF0 appears first in your code, the simulator operates on FF0 first and updates the FF0 Q in response to that clock edge. Now the simulator moves on to look at FF1, but the FF0 Q output (FF1 input) has already changed so the same clock edge now changes FF1 Q output in exactly the same simulation delta period. The AND gate output doesn't change because the 2 inputs are never different. You have created a situation where the simulation (legitimately) behaves differently to the design - not good. I never design with variables in RTL and in many places I have worked, are not allowed under company coding rules. They can always easily be avoided.

The problem is that you are using variables incorrectly for what you are trying to achieve. In VHDL, when you drive signals in a process, the signals will hold their values until the process exits, and whatever the FINAL assignment of that signal was as the process executes is what the value will hold.

Here's an example:

   signal signalA : integer := 4;

SignalExampleProcess : process(clk)
begin
if(rising_edge(clk)) then
signalA <= 0;            --Signal A value is still 4
signalA <= signalA + 1;  --Signal A value is still 4
signalA <= signalA + 1;  --Signal A value is still 4. This is the last assignment that "hit" signalA for this process
end if; --rising_edge(clk)
end process SignalExampleProcess;  -- Update signalA value to 5 upon process exit.

At the start of the process, signalA was the value 4 (this was the pre-load value in the signal declaration area). So at the end of this process, signalA will be equal to 5. After the next clock cycle, signalA will be 6. and so on. Let's look at the same example using variables:

   VariableExampleProcess : process(clk)
variable variableA : integer := 4;
begin
if(rising_edge(clk)) then
variableA := 0;                --variableA value is 0
variableA := variableA + 1;    --variableA value is 1
variableA := variableA + 1;    --variableA value is 2
end if; --rising_edge(clk)
end process VariableExampleProcess; --variableA holds last value upon process exit

Notice this time, variableA is equal to 2 at the end. Variables can contain intermediate values as the process gets parsed by the language interpreter. Note that if you look at variableA on a logic analyzer, you would only see it be the value 4 upon reset, and then the value 2 on the next clock cycle. The intermediate values are just used for DESCRIBING the intended logic behavior.

architecture Behavioral of pulse is
begin
process (clk)
variable ff0 : std_logic := '0';
variable ff1 : std_logic := '0';
begin
if rising_edge(clk) then
ff0 := d;                --ff0's value will now be d, ff0 == d
end if;
if rising_edge(clk) then
ff1 := ff0;              --ff1's value will now be ff0, ff1 == d
end if;
q <= ff0 and not ff1;   --ff1 and ff0 always contain the same value, q will always be low.
end process;
end Behavioral;

I'm under the impression that you got a valid RTL schematic based on the fact that you have two "if(rising_edge(clk)) then" statements in one process. I can't remember if this is illegal or not in VHDL, but I would say it's unusual and probably testing the edge cases of Vivado. If I make it one "if(rising_edge(clk)) then" statement and stick both variable assignments, it gives me what I would expect: one register.

And for the record, ModelSim also behaves identically to your Vivado simulation:

• "If I make it one "if(rising_edge(clk)) then" statement and stick both variable assignments, it gives me what I would expect: one register" ... Yes, I agree with that statement, which is why I wasn't testing it that way. I understand variables and the basics you addressed in your answer. However, what you wrote is really more of the golden rule to teach beginners. There are multiple ways that variables will infer registers. One of which is when a variable is assigned a value at the transition of another signal (clk in my case, for both), and then passed to a external signal. Jul 20, 2018 at 21:12
• I'm not understanding why having two "if rising_edge(clk)" statements should make a difference in the behavior. In my mind, the process is kicked off when the clk signal changes, and as the interpreter iterates through each line, when it comes to either "if rising_edge(clk)" statements it should return true, and thus both variable assignment statements would still execute. If both variable assignments execute, then my code comments I added would still hold true. So talk me through how you imagine this double rising_edge working and inferring two registers. Examples of this coding style? Jul 20, 2018 at 21:22
• "Examples of this coding style?" ... don't get me wrong - it's a terrible coding style, and not something I would do operationally. This is just a test. But it does synthesize, and it implements into hardware. I believe your comment in the OP explains why it fails in simulation. I think it works in synthesis because synthesis doesn't use the sensitivity list. So, when it gets to the second "if rising_edge", it does just that. Jul 20, 2018 at 22:12
• I think we can agree that something in Vivado has a bug. From working several years with Vivado, that is not the least bit surprising. You've introduced an exotic way to write a process, and Vivado is choking. It seems we just disagree on whether it's the synthesizer or the simulator that is malfunctioned. You seem to imply that the code should work as written, and that in fact it does (when built). I'm saying that we have two different simulators showing that it won't work, and it shouldn't work based on how you're using variables. I don't know where else to go from here, so have a nice day! Jul 20, 2018 at 22:18
• It sounds like you misunderstood me. I'm fully on-board with what you have done/written (hence "I believe your comment ... explains why it fails in simulation"). To me that is the answer; which I would happily accept, if you were to move it from the comment to an answer. So, I don't think it should work (as a simulation) as written - based on the details you have provided. I do think it should work in the fabric though (and it does), notwithstanding the terrible style. Jul 20, 2018 at 22:23

I found that having two clock condition clauses inside of the process appears to confuse the simulator (even though it's not an issue for synthesis - which is why the Post-Synthesis simulation works).

If I change the process to:

process (clk)
variable ffs : std_logic_vector(1 downto 0) := b"00";
begin
if rising_edge(clk) then
ffs := ffs(0) & d;
end if;
q <= ffs(0) and not ffs(1);
end process;

it works as expected.

Essentially, by merging the two std_logic variables into a std_logic_vector, I am able to update both values in a single if rising_edge(clk) then clause, and still maintain the register inference.

However, regarding the original question, I am still at a loss to understand why the Behavioral simulation conflicts with the RTL schematic. So, please consider the question still open.

• Simulation isn't confused, synthesis only supports a subset of signal semantics. The VHDL standard doesn't define synthesis. Variables are of the domain of sequential statements while signals are not. Historically simulation preceded synthesis, which is expensive (in time, resources and cost) and post synthesis verification proves equivalency. There's a UG901-vivado-synthesis-examples.zip where non shared variables (prior to -2002) don't occur in synthesis eligible clocked processes. Xilinx isn't teaching you VHDL, but their preferred (safe) synthesis subset.
– user8352
Jul 20, 2018 at 22:38


text:
# Can higher level be insignificant but lower level significant in a nested ANOVA?

I have ran a nested ANOVA on a data set and the results suggest that there is an association for the higher level with an insignificant P-value but also an association for the lower level with a significant P-value. Is this even possible, or have I done something completely wrong?

Details

I have a data set comprising of: Groups (A,B,C...) - each group contains 3 different genotypes (1,2,3...). The same genotype doesn't occur in two different groups. For example, I have group A with genotypes 1,2,3 and Group B with genotypes 4,5,6, and group C with genotypes 7,8,9. I then have several measurements of height for each genotype. I had to perform an analysis that can test for differences between the three groups as well as for the genotypes within each of the groups. I chose nested ANOVA, but now I'm slightly doubting myself. A huge thank you for any help!

• Basically I have a data set comprising of: Groups (A,B,C...) - each group contains 3 different genotypes (1,2,3,..). The same genotype doesn't occur in two different groups. I then have several measurements of height for each genotype. I had to perform an analysis that can test for differences between the three groups as well as for the genotypes within each of the groups. I chose nested ANOVA, but now I'm slightly doubting myself. A huge thank you for any help! – sshelp Nov 26 '12 at 11:50
• Sorry, I didn't make it quite clear: I have group A with genotypes 1,2,3 and Group B with genotypes 4,5,6, and group C with genotypes 7,8,9. – sshelp Nov 26 '12 at 16:56
• you can delete these comments now... I edited the question because I don't think you can with your reputation. Now that we have details, do you mean groups is the higher level and genotypes is the lower level? – John Nov 26 '12 at 17:06

This can happen a number of ways. You need to examine your outcome variables to see what happens but imagine something like the following.

height group gene
200    A     1
150    A     2
150    A     3
200    B     4
150    B     5
150    B     6

It's easy to see how gene's 1 and 4 lead to greater heights but there's no difference between the groups.


text:
# Fargo Inc. showed the following income statement information for its first three years of...

Fargo Inc. showed the following income statement information for its first three years of operations:Partial information regarding Fargo’s equity for the past three years follows:Required1. Calculate Gross Profit, Operating Income, Income Before Tax, and Net Income for the years ended December 31, 2013, 2014, and 2015.2. Calculate Contributed Capital as at December 31, 2013, 2014, and 2015.3. Calculate Retained Earnings as at December 31, 2013, 2014, and 2015.4. Calculate Total Equity as at December 31, 2013, 2014, and 2015.Analysis Component: Assume total liabilities in 2015, 2014, and 2013 were $1,123,200,$936,000, and \$900,000, respectively. Identify whether the balance sheet has been strengthened from 2013 to 2015. Explain what thismeans.
View Solution:
Fargo Inc showed the following income statement information for its

## Plagiarism Checker

Submit your documents and get free Plagiarism report

Free Plagiarism Checker