Sub-gaussian Norm of Normal Distribution

Question: Let $X \sim \mathcal{N}(0, \sigma^2)$. In Vershynin's "High-dimensional Probability," it is observed that the sub-gaussian norm of $X$ is
$$ \|X\|_{\phi_2} = C\sigma $$
for some absolute constant $C$. I understand this is because of the tail bound of Gaussian random variables. However, I am wondering if there is an explicit result for the sub-gaussian norm of a normally distributed random variable. I assume there would be, but I am unsure of how to go about calculating it using only the definition of the sub-gaussian norm...
Answer: Probably the best way to compute the Sub-gaussian norm is to define the function $f:[0,\infty) \rightarrow (0,\infty]$ defined by
\begin{align}
  f(\alpha) \triangleq \mathbb{E}[e^{X^2/\alpha^2}]
  &= \int_{-\infty}^\infty \frac{1}{\sqrt{2\sigma^2\pi}}e^{-x^2/2\sigma^2}e^{x^2/\alpha^2}dx \\
  &= \frac{1}{\sqrt{2\sigma^2\pi}}\int_{-\infty}^\infty \exp \left ( \left (\frac{1}{\alpha^2} - \frac{1}{2\sigma^2}\right ) x^2\right )dx
\end{align}
The inner integral is finite as long as $1/\alpha^2 < 1/2\sigma^2$, and its value is a standard integral. I leave it to you to simplify this function.
It is also the case that $f(\alpha)$ is decreasing on $[0,\infty)$. To get the exact sub-gaussian norm, it is given by $||X||_{\psi_2} = \alpha^*$ where $\alpha^*$ is the unique value such that $f(\alpha^*) = 2.$
Comment: Based on your comment, you are close probably doing everything correct but have a small arithmetic/algebra mistake. The correct answer is $||X||_{\psi_2} = \sqrt{8/3}\sigma$.
Comment: Thanks! I actually figured the same thing out myself just a couple of minutes before checking if an answer had been given. If I am not mistaken, the result should be $\|X\|_{\psi_2} = \sqrt{2/3} \sigma$ (just for future reference).
Comment: By the way, that is a pretty handy Wikipedia page, I'll have to bookmark that one :D
Comment: Are you sure? I can't seem to find my mistake... the integral for $f(\alpha)$ solves to $\frac{1}{\sqrt{2\pi}\sigma} (\frac{\sqrt{2\pi} \alpha \sigma}{\sqrt{\alpha^2 - 2\sigma^2}}) = \frac{\alpha}{\sqrt{\alpha^2 - 2\sigma^2}}$ for me, am I good so far?
Comment: You are correct so far, all you need to do is set the last expression equal to 2 and solve for $\alpha$. One way to quickly do this is $2 = \alpha/\sqrt{\alpha^2 - 2\sigma^2} \iff 4 = \alpha^2/(\alpha^2 - 2\sigma^2) \iff 4\alpha^2 - 8 \sigma^2 = \alpha^2 \iff 3\alpha^2 = 8\sigma^2 \iff \alpha = \sqrt{8/3}\sigma$
Comment: Thanks! I really did just mess up multiplying :D


How i can bake the entire cloth simulation to shape keys?

Question: When I give "apply as the shape key" it seems that it only takes a part of the cloth simulation, I want it to take the whole simulation, my cloth simulation has 200 frames and it seems that in the shape key it has only 20
Answer: If you do "Apply as Shape Key" it will create a snapshot of the vertex positions from where you are on the timeline as save that as a shape key. The shape key have no animation data. It interpolates from the base shape key to the cloth shape key linearly. That is, if you place the Value on the Cloth shape key on 0.5, each vertex point will be in between the Base and the Cloth.
Comment: Thanks man I did not know it was an interpolation, its really helpful


Electric Field Inside a Conductor at Different Charge Densities

Question: We say that the magnitude of the electric field inside a conductor is zero, whether a hollow or solid. However, at certain charge densities, the magnitude of the electric field inside the conductor comes out to be not zero. How can both these things right?
Comment: Showing a concrete example of such a question might be helpful.
Comment: Is the source of confusion due to many problems having a charge density related to a dielectric rather than a conductor?
Comment: What certain charge densities?
Answer: If you are talking about a conductor object whose Gaussian surface is in such a shape that due to symmetry, electric field vectors of point charges on the conductor cancel each other out, then, yes, the magnitude of the electric field would be zero inside that conductor.

No charge density would change this property because, symmetry would always be there. However, if you somehow change the charge distribution of the conductor, then symmetry would be disrupted and the magnitude of the electric field due to the charges on the conductor wouldn't be zero. This can be done by applying an external electric field through the conductor; however, although the magnitude of the electric field due to charges on the conductor is not zero, the external electric field would cancel that electric field. Therefore, the electric field inside that symmetrical conducting object would still remain zero. This device is called a "Faraday Cage" and commonly used in devices we use everyday such as for protecting the electronic components of a mobile phone from external electric fields.
If the conducting object is doesn't have such a proper symmetrical shape, then the electric field naturally wouldn't be zero inside that conductor.
Answer: The net electric field inside a charged conductor is zero. Because then it is at equilibrium and the charges position themselves so to minimize the repulsive form between them. So they end up on the surface of the conductor. All the charges on a charged conductor resides on its surface and create an electric field perpendicular to the surface. When you mentioned charge density I figured that you were talking about the case where a charges conductor is inside another one. As in this picture.

You can see the electric field between the surface of the outer conductor and that of the inner conductor and an electric field of zero inside the negatively charged conductor.
It is here that your problem might give you the charge density inside the positively charged conductor.
Answer: Inside a conductor there can be no permanent, static electric field.
If there were , electrons ( or sodium and chloride ions in the case of brine ) would move to opposite sides ( under the influence of the external electric field ), creating their own electric field, exactly cancelling out the externally applied electric field.


Grouping and beaming 6/8 time signature

Question:
I am trying to get this right but don't get the second part where there is a eighth note and followed by 2 sixteenth note
Answer: As Elements in Space says, in 6/8 you shouldn't beam across the mid-point of the bar.
For example, bar 5 should be beamed as shown in the top line:

The 'Wrong' version groups the notes into 3 crotchet beats instead of 2 dotted crotchet beats.
Comment: This is a great illustration of how much easier it is to sightread the rhythm from properly beamed notation.
Answer: 6/8 is compound duple time. So in 6/8 there are two dotted crotchets (dotted quarter notes) beats to a bar.  The beams should reflect this.
There are three quavers (eighth notes) pulses to a dotted crotchet.  And there are two semiquavers (sixteenth notes) to a quaver.
Starting on a beat (at the start, or halfway through a bar):
If a set of three quavers appear in a row, they should beam together (like in the first bar).  Similarly, if a set of six semiquavers appear in a row, they should beam together.
A pair of semiquavers can substitute for a quaver, so that you'll get two quavers plus two semiquavers to a beam, or one quaver plus four semiquavers to a beam.
Consider a dotted quaver as a quaver tied to a semiquaver.
Be careful not to beam across beats (so that the halfway point through the bar should be clear).
Answer: While the number of semis are the same in 3/4 and 6/8, the important difference is how they're written on the sheet music. 3/4 is simply 3 crotchets (or their equivalents) written as 3 separate beats.
6/8, however, is written in two distinct halves, each equal, of course. That means the equivalent to one and a half crotchets (3 quavers/ 6 semis) are written in each half of any bar. To make it easier to read, the beams will reflect this, and join any/all notes in each half, visually splitting the bar into equal halves.
Answer: 6/8 is two beats in each bar. Each beat adds up to a dotted quarter.   Beam to show this.  If one entire beat can be included under a single beab, do so.  In bar 2 of your example, the first 4 notes and the last 4 notes add up to a beat, and can be beamed together. So do so.

Grouping and beaming 6/8 time signature


Do we really need polynomials (In contrast to polynomial functions)?

Question: In the following I'm going to call

a polynomial expression an element of a suitable algebraic structure (for example a ring, since it has an addition and a multiplication)
that has the form $a_{n}x^{n}+\cdots+a_{1}x+a_{0}$, where $x$ is
some fixed element of said structure,

a polynomial function a function of the form $x\mapsto a_{n}x^{n}+\cdots+a_{1}x+a_{0}$ (where the same algebraic considerations as above apply)

a polynomial an element of the form $a_{n}X^{n}+\cdots+a_{1}X+a_{0}$ with indeterminates $X$ (these
can be formalized, if we are in a ring, with strings of $0$s and
a $1$).

Note that when we are very rigorous/formal, polynomial expressions
and polynomials are something different (although in daily life we
often use them synonymously). Polynomial functions and expressions
are also different from each other although in this case the relationship
is a closer one, since every polynomials expression can be interpreted
as a polynomial function evaluated at a certain point (thus "polynomial
functions" are something more general than "polynomial expressions").
My question is: Why do we use polynomials ? It seems to me that every
piece of mathematics I have encountered so far, one could replace
every occurrence of polynomials with polynomial expressions/functions
without any major change in the rest of the proof/theorem/definition
etc.

My thoughts:
The only reasons that I can see to use polynomials are the following
two:

After one makes the idea precise that one can plug "suitable"
elements into polynomials (which may lie a ring containing the ring
in which the coefficients live in), one can save time in certain setting,
by handling the "plugging of suitable elements into polynomials"
more elegantly: For example in case of the theorem of Cayley-Hamilton,
which in its "polynomial function" version would look like:

Let $A$ be an $n\times n$ matrix over $K$, whose characteristic
polynomial (function) is $x\mapsto a_{n}x^{n}+\cdots+a_{1}x+a_{0}$.
Then
$$
a_{n}A^{n}+\cdots+a_{1}A+a_{0}I=0.
$$

whereas the "polynomial" version looks more elegant:

Let $A$ be an $n\times n$ matrix over $K$, whose characteristic
polynomial is $p_{A}\in K\left[X\right]$. Then
$$
p_{A}\left(A\right)=0.
$$

The only thing that polynomials can "do", but algebraic expressions/functions can't, is to be different, when the algebraic expressions/functions are the same (i.e. there's a theorem that tells us that the mapping of polynomials to polynomials expressions/functions
isn't injective, if the field is finite). Maybe this small difference makes a big enough difference
to consider polynomials after all, but as I said, I haven't encountered
any situation in which this difference could manifest itself.

(I'm guessing that maybe cryptography or higher number theory really needs
polynomials and not just polynomial expressions/functions. Since I don't know
anything about these subjects, I would be very happy with an example
of a theorem (whose content isn't merely technical as it is the case with the theorem above) involving polynomials, where these absolutely cannot
be replaced by polynomial expressions/functions. Conversely I would also be happy with an authoritative statement from someone knowledgeable that indeed we could dispense of polynomials, if we wanted to.)
Comment: In a finite field it's different. There are finitely many functions, but infinitely many polynomial expressions.
Comment: A general point that is not specific to the issue at hand (already well addressed in great answers):  when you have two similar mathematical structures, the question you should ask is not *Can I get rid of Structure A and just use Structure B?*, but rather *What are the differences between Structure A and Structure B, and when is it more useful to use one structure instead of the other?*
Comment: @MichaelJoyce Very well said! And with so many great answers a very difficult choice awaits...
Comment: See also  [Why are polynomials defined to be "formal"?](https://math.stackexchange.com/q/98345/242)
Answer: You write that polynomial functions are "more general" than polynomial expressions. In fact the exact opposite is the case: multiple polynomial expressions may be the same function (on a finite field), so it's polynomial expressions that are more general.
Here are a few ways that polynomial expressions are useful where it could (or would) be awkward to use polynomial functions.

If $F$ is  a field of $p^r$ elements, for a prime $p$ and positive integer $r$, then $F$ is the splitting field over ${\mathbf F}_p$ of $x^{p^r} - x$. But for every $a \in F$, $a^{p^r} = a$, so $a^{p^r} - a = 0$. You don't want to say $F$ is the splitting field of, well, "zero". The distinction between the nonzero polynomial $x^{p^r} - x$ in $F[x]$ and the zero polynomial is essential for that.
In case you think "I don't care about finite fields", well, some properties of sequences of integers are proved by making them into the coefficients of a polynomial and then reducing the polynomial mod p, which places the polynomial into ${\mathbf F}_p[x]$, where there are convenient features that are not available in ${\mathbf Z}[x]$. One example of this is a slick proof of Lucas's congruence on binomial coefficients. It's crucial for this that we can recover the coefficients of a polynomial in ${\mathbf F}_p[x]$ even if its degree is greater than $p$, which is impossible if you think of polynomials in ${\mathbf F}_p[x]$ as functions ${\mathbf F}_p \rightarrow {\mathbf F}_p$.
Quotient rings of $A[x]$, where $A$ is a ring, may not look like functions from an elementary point of view. Do you feel it's easier to work with ${\mathbf Q}[x]/(x^5)$ using the viewpoint of polynomials as functions rather than expressions?
Would you like to define the ring of noncommutative polynomials in two variables as functions?
Generating functions are important objects in mathematics (not just in combinatorics), and they are formal power series rather than numerical series. Most of them have positive radius of convergence (assuming their coefficients are in a ring like ${\mathbf R}$ or ${\mathbf C}$ and thus have a region where it makes sense to substitute a scalar for the variable at all), so they can be treated as functions on the domain of convergence, but it is convenient that the theory of formal power series doesn't really need to rely on the radius of convergence to get off the ground. Sometimes a generating function may even have radius of convergence equal to 0 but still contain useful information that can be legally extracted because formal power series can be developed without needing a radius of convergence. Of course a lot of important intuition about the way formal power series are manipulated is inspired by the properties of classical numerical power series as functions.

Your question mentions 3 types of polynomial objects: polynomial expressions, polynomial functions, and polynomials as strings of coefficients. I'd say the first and third are really synonymous (the third is really just a rigorous form of the first, not materially different in practice), but they're not the same as polynomial functions if you work over a finite field. If the coefficients are an infinite field then different polynomial expressions do define different functions on the field.
Comment: I have two remarks: 1) I think you misunderstood what I meant by polynomial expressions: Let's say that $x=4$ and that we consider the polynomial expression $2x+3$; then the *number* $11=2\cdot 4+4$ is a polynomial expression for me. Another example: Let $x$ be some number from in $[0,1]$ and consider the polynomial expression $4x^2-1$. Then $4x^2-1$ is again a *number* , although we don't know which one, since we don't know what $x$ is. But the "nature" of $4x^2-1$ is definitely numeric. In contrast to that a the polynomial $4x^2-1$ is actually the string $(-1,0,4,0,0,\ldots)$. [con...]
Comment: A noncommutative polynomial in two variables is not a map $K^2 \rightarrow K$, since $xy^2, yxy$, and $y^2x$ are different.  You know examples of noncommutative polynomials (well, a quotient ring of the noncommutative polynomials): differential operators with polynomial coefficients.  If $D = d/dx$ on smooth functions, and polynomials act on functions as multiplication (so "$x$" means the function $f \mapsto xf$ for smooth $f$), then the product rule $D(xf) = xD(f) + f$ is the same as $Dx = xD + 1$. Polynomial differential operators form a ring ${\mathbf R}[x,D]$ where $Dx = xD + 1$.
Comment: ...tinuation] Since, for example, I don't know any applications of the ring of noncommutative polynomials in two variables I can't see why it would be bad to define it as the set of all maps $K^2\rightarrow K$ for some field $K$. I also can't see why it's harder to work in $\boldsymbol{Q}[x]/(x^5)$ with functions than polynomials. If you could provide me with a short explanation I could come back later to this, when I have more background in quotient rings and polynomials in two variables and make sense of the explanation.
Comment: [...tinuing] So objects of the first and third type are fundamentally different. I think what you understood "polynomial expressions" to be is a nonrigorous way of speaking about strings of coefficients - am I right with that ?  But of course, none of all this makes your very good and instructive answer (!) less readable!$$ $$2. Could you please elaborate a bit more on example 3. and 4. ? It seems to me that a lot more is hiding there than I'm currently able to see. [another con...
Answer: If the mapping from polynomials to polynomial functions is not injective, then one cannot talk about the coefficients of a polynomial function. Without coefficients, one cannot do Euclidean division. Without Euclidean division, not much of what one does readily with polynomials over a field can be done (defining minimal polynomials of linear operators is one such thing; there are many others). In short, in algebra one works with polynomials, not with polynomial functions.
Note that the ring of polynomial functions over a finite field $F$ (which is in fact the ring of all functions $F\to F$) is not an integral domain; it is in fact a rather ugly object from the algebraic point of view (a product ring of $\#F$ copies of $F$).
However, if you want a statement from someone knowledgeable that indeed we could dispense of polynomials, note that Serge Lang in Introduction to Linear Algebra (2) Chapter IX defines polynomials over an arbitrary field $K$ as polynomial functions, and goes on stating a Theorem$~1$ that the mapping from coefficient sequences to polynomials (i.e., functions) is injective (which as observed in the question fails for finite fields). The proof of the theorem is conveniently only given for the case where $K$ is the real or complex numbers. I certainly would not want to exclude Serge Lang from the set of knowledgeable people, but it seems that in this particular instance he made a regrettable error where he should have known better.
Added: Leafing though the cited book, I recently found out a detail that might explain what Lang did. I thought I knew without having to look it up what was meant by "a field $K$"; however, in section II.2 of the book it says "Let $K$ be a subset of the complex numbers $\mathbf C$. We shall say that $K$ is a field if it satisfies the following conditions:" (requiring closure under addition, multiplication, negation and inversion of nonzero$~x$, and containment of $0,1$). The proof later given of uniqueness of polynomial coefficients is by considering the asymptotic behaviour of the polynomial function for large arguments. The proof is immediately followed by the cryptic sentences "We have used the notion of limit. In Chapter$~$XII, $\S1$ we shall prove the same statement for more general fields, by a method which is completely algebraic." This leaves me wondering what "more general" fields are intended; given the earlier definition one might assume "general subfields of $\mathbf C$", but the proof using limits would appear to do fine for any such field. Anyway I cannot see which proof is being referred to. There is corollary 3 saying that a polynomial in $K[t]$ of degree $n$ has at most $n$ roots in$~K$, but that is not the same statement. More importantly, it assumes that degree has been defined, and it uses Euclidean division; as these notions use the existence of (unique) polynomial coefficients, this would appear to be circular.
Comment: (+1) for the well-explained answer and (+100) for the comment about Lang.
Comment: @amoreacceptablename No, the proof works (only) for subfields of the complex numbers; see my added paragraph.
Comment: +1. Lang's proof probably works for any infinite field, doesn't it? well it's a silly mistake he made, but considering the amount of books he wrote this happens
Comment: thanks @MarcvanLeeuwen, very kind of you!
Answer: Over some fields, the map from polynomials to polynomial functions is not injective; for example, over the finite field $\mathbb{F}_2$, the polynomial function $x^2+x$ is the same as the $0$ function - try plugging in $0$ and $1$. So in this case the (infinite) set of polynomials over $\mathbb{F}_2$ is much larger than the (finite) set of polynomial functions $\mathbb{F}_2\to\mathbb{F}_2$.
Comment: The same, however, is *not* true for every field extension of $\mathbb{F}_2$. If there's an element $x$ for which neither $x$ nor $x+1$ is zero, then $x^+x=x(x+1)$ won't be identically zero. Since additive inverses are unique in fields, such an element $x$ must even exists in *every* extension of $\mathbf{F}_2$, just pick any $x \neq 0$ which doesn't happen to be $-1$. In algebra, you regularly take a polynomial over a field and look at its behaviour over extension fields, so identifying a polynomial with the function it induces on a particular field clearly doesn't cut it.
Comment: Yes, I know that this is the case. This was what I meant, when I said that "the mapping of polynomials to polynomials expressions/functions isn't injective". **But what good is this fact ? The fact *alone* that this mapping isn't injective surely can't be the *only* reason we consider polynomials (see the last paragraph from my question written in boldface).**
Comment: @temo Apologies, I'm not sure now what I read there instead of what you wrote. The other answers expand on the reasons for this a lot more (as I'd hoped would happen). Maybe this answer should even have been a comment, I thought it was borderline when I wrote it.
Comment: @MattPressland No problem. (I edited my question slightly after your answer - you can look it up in the revisions - in hope to make in clearer what I mean for future readers.)
Answer: Constructing field extensions is a very important operation. This is most conveniently done as follows: Let $F$ be a field and $p(X)\in F[X]$. Suppose we wish to adjoin to $F$ an element $\alpha$ that will satisfy a certain algebraic equation. That is, there is a polynomial $P(X)\in F[X]$ such that we wish $P(\alpha)=0$ (notice here we switched between the polynomial $P(X)$ and its associated function evaluated at $\alpha$). If $P(X)$ is irreducible, then such a field extension is constructed as $F[X]/(P(X))$. It is crucial for this construction to take $F[X]$ to be the ring of polynomials, not polynomial functions.
Another reason is the convenient fact that a ring homomorphism $R[X]\to S$, from the ring of polynomials with coefficients in $R$ to a ring $S$, is the same thing as a homomorphism $R\to S$ together with a choice of an arbitrary element in $S$. Thus, polynomial rings allow for a systematic study of homomorphism+an element. It turns out that many properties of the chosen element are reflected by properties of the homomorphism, which in turn are related to properties of the domain, that is of polynomials (not polynomial functions).
One more reason is that polynomials are combinatorial beasts. They can be manipulated purely combinatorially. But since they give rise to functions, it means that we can use combinatorics to study functions. For instance, given functions $f,g$, can you find functions $a,b$ such that $af+bg=1$ is quite easily solved using the Euclidean algorithm if all these functions are required to be polynomials (the solution is actually constructive).
Comment: The last point is not the most convincing; certainly if you can find polynomials such that $ag+bg=1$, then you can find (corresponding) polynomial functions as well.
Comment: @MarcvanLeeuwen I did not explain myself well then, as that was precisely my point. I left 'function' unspecified, not even domain and codomain, and tried to emphasize that *if* things are required to be polynomials, then a solution can easily be found using the Euclidean algorithm which is combinatorial.
Answer: Here are some answers with somewhat different conclusions.  Let us call the form of polynomials with coefficients and indeterminates "abstract" or "algebraic" to distinguish them from polynomial functions.
If you want to work with rational functions, the situation becomes foggy if you do not define everything in terms of abstract polynomials:

Is the function $f(x) = +\frac{1}{x} \ -\frac{1}{x}$ equal to the zero function?
Is $\frac{x}{x}$ equal to $1$ for all $x$, or only for $x \neq 0$?
When composing a chain of linear fractional functions $\frac{ax+b}{cx+d}$ do we exclude more and more points from the domain everywhere that one of the denominators is zero, when the end result as a rational function has at most one one singularity? Over a finite field this can empty the domain of all its points.
For an infinite field you can get around some of this by treating polynomial functions and rational functions as function-equal if they are equal at infinitely many points, and defining rational functions as written in lowest terms (which breaks the analogy with fractions).  Over a finite field, nothing like that can work because ratios like ${p(x)^a}/{p(x)^b}$ are not defined if $p=0$ for all elements in the finite field, and if there were a way to define it based on functions (such as using the lowest-degree representation) it would not depend on the exponents.

In the other direction:

if you want representations of the polynomial to not always be centered at $0$ or to be less coordinate dependent, then you might want polynomial to mean a function killed by differential or difference operators of order $n$ for some $n > 0$.
where polynomials appear by a construction that operates on functions, and cannot be performed on the abstract polynomials, then you have no choice but to work with polynomials as functions.

In algebraic uses of polynomial functions, the arithmetic operations, function composition, differentiation and integration are often sufficient and can be done on the abstract form, and a function is demonstrated to be polynomial by exhibiting an abstract form.  So the evaluation that converts algebraic representation into a function can always be postponed by doing all operations on the algebraic representation.
Comment: I think your answer is with just two upvotes, of which one is mine, very underrated. Some of your points aren't yet clear to me though: $$ $$ **1)** Why does the situation becomes foggy, if we work with rational functions ? The maximal domain (if we work consider only real numbers) of the functions $f(x)=\frac{1}{x}-\frac{1}{x}$ resp, $g(x)=\frac{x}{x}$ is $\mathbb{R}\setminus\{0\}$ and thus on this set they are equal to $0$ resp. $1$- no ambiguity here, as far as I can see...[conti-
Comment: [-nuation] I we define these as abstract polynomials, than it doesn't make sense to ask if $f$ and $g$ are equal to a number, since (set-theoretically) they are strings on numbers; it would only make sense to ask for which numbers $f$ and $g$ can be *evaluated*. In this case the considerations from above apply. [last continuation]
Comment: **2)** I don't understand the first proposition of what you wrote in the fourth bullet: Why can we treat over an infinite field polynomial functions and rational functions as equals if the agree for infinite many values ? What does this have do to with writing rational functions in lowest term and why does the analogy with fractions break ?
Comment: For (1) the maximal domain will change depending on the way that $f$ is written, such as $0$ or $1/x - 1/x$ or $1/x(x-1) - 1/x(x-1)$, which also breaks algebraic laws like $g(x) = g(x) + f(x) - f(x) = g(x)f(x)/f(x)$.  You could handle part of this problem by declaring that an equation $A=B$ holds only on the intersection of domains, but this would make chains like $A=B=C=...$ non-reversible, and the domain can become the empty set for rational functions over a finite field.  For [-nuation], we ask if $f=g$ as abstract polynomials, not numbers.
Comment: For (2), abstract (ratios of) polynomials can be recovered from (ratios of) polynomial functions over an infinite field, and equality at an infinite set of points can serve as the definition of equality to replace the problems with "maximal domains".  But this procedure breaks down for finite fields as the ratios $p(x)^m / p(x)^n$ demonstrate, for integer $m$ and $n$ and $p(x)=0$ at all points.  For fractions there is no requirement to write them in lowest terms, and there can might be problems with requiring lowest terms if the coefficients of the polynomials/rational functions are not a UFD.
Comment: (and in the [continuation], we could also ask if $f=g$ as functions, but the question is never about equality between a function or polynomial and a number.  Instead, $0$ can denote a number, or the function that takes every $x$ to $0$, or the abstract polynomial $0 + 0X + 0X^2 + \dots$, or the rational function $0/p(x)$.)
Answer: OK, this is an old question, but I think the following is not covered by the other answers.
The polynomial as defined in point 3 is really a special case of the polynomial expression as defined in point 1. In particular, given the commutative ring the coefficients are from, the "suitable algebraic structure" (a commutative ring) for the polynomial is obtained as follows:

All elements of the original ring are also in the extended ring, and the same relations hold between them (that is, the ring of the coefficients is a subring of the ring of polynomials).
There's an additional element (the "unknown" you mention) that is not member of the coefficient's ring. This additional element fulfils no relations other than those implied by the axioms of commutative rings and the relations between the original elements.
Apart of the elements mentioned above, and those additionally required to be present to make it a ring while fulfilling the condition of point 2, no further elements are added.

In this extended structure (called $R[X]$ if $R$ is the ring of the coefficients and $X$ is the name of the "unknown"), your point 3 polynomial is just the point 1 polynomial expression for the choice $x=X$.
The polynomial function can also be obtained naturally from that construction. First, we find that for any $x\in R$, there's an unique ring homomorphism* $\phi_x:R[X]\to R$ that maps $X$ to $x$ and every element of $R$ to itself. Given a polynomial $p\in R[X]$, the polynomial function then is just the function $x\mapsto \phi_x(p)$.
And for completeness, although that point was already stressed in other answers: While the polynomial uniquely determines the polynomial function (by the construction given above), the reverse is not always true.

*) A homomorphism is a function that keeps the algebraic structure intact. In particular, a ring homomorphism is a function $\phi$ with $\phi(0)=0$, $\phi(1)=1$, $\phi(a+b)=\phi(a)+\phi(b)$, $\phi(-a)=-\phi(a)$ and $\phi(ab)=\phi(a)\phi(b)$.


How to keep drinks carbonated

Question: I like to occasionally, but not regularly, have a carbonated drink such as soda water. Buying these in small containers is more expensive and uses more packaging. Big containers go flat before I have finished them. How can I keep my carbonated drinks from going flat for as long as possible?
Answer: Transfer the contents of the large bottle to several smaller bottles.
Fizzy drinks go flat because each time they are opened & re-closed, the gas is released from the liquid until parity pressure is reached in the container, preventing any more from escaping.
Once you've reached about the halfway point in any size bottle, you're on a losing run from thereon in. Every time you release the pressure, whether you drink or not, you have a lot of gas to release from the liquid to reattain parity pressure.
If you continue to re-use the smaller bottles, the planet will send you a big green hug too ;-)
Comment: You're going to lose some carbonation when you transfer the contents ... but if you're going to do this, I'd recommend using glass bottles, as plastic is more permeable.  (it's why bottled sodas have such a short shelf life, especially in warmer weather).
Comment: What do you consider a "short" shelf life? Looking at bottles I have here right now, the shortest still has 6 months.
Comment: I consider 6 months to be short, but you might even less out of it if it's stored in a warm area.  Soda in aluminum cans or glass bottles are generally fine after a year of storage (I've never done testing to figure out a more specific time)
Comment: I wonder if squeezing the air out of the bottles (provided they aren't glass, of course) before closing them will have any effect... Anyone have any experience with this?
Comment: That would lower the pressure inside, making more gas needing to be released before equilibrium was reached. One thing I didn't note in the answer is that once it's opened, whether it goes flat or not, decanted or not, you're probably down to 1 or 2 week's remaining shelf-life, stored in the fridge, whatever the initial use-by date.

How to keep drinks carbonated


How to insert people picker data into share point list

Question: I have created a  custom people picker using jquery in sand box solutions,upto here working fine.
My question is how to insert custom people picker data into sharepoint list people and group column
Any Idea?
Answer: If you are using custom people picker on your form, then follow below steps to achieve what you are looking for:
Keep sharepoint people control hidden on form using Style="display:none"inline property.
Using jquery Once you get the value of user into your custom control, copy it and assign to the default sharepoint control:
Ex
var inputUserField = $("div[title='People Picker']"); // This will target to the input box of sharepoint people control.

inputUserField.val(customUserControl.val()); // customUserControl is the custom control you have created.

Thanks


What's wrong with "I followed this tutorial" kind of questions?

Question: This meta topic is meant as a reference to users asking questions along the lines of "I was following this tutorial/guide/whatnot [link] and got an error message, how do I fix that?". I'll provide my own point of view in an answer, alternative points of view are welcome.
Comment: Even worse are the "I tried everything, and it doesn't work" "Questions" e.g. https://raspberrypi.stackexchange.com/q/105845/8697
Answer: In essence, you must reproduce the key steps you took from the tutorial in your question, and be careful about which tutorial you pick.

questions and answers on this site are meant to be self-contained. If you ask a question referencing a tutorial explaining how to set up awesome_server, people having problems with it will search for "awesome server" and find your question. If the link to the tutorial in your question is no longer valid, they will get no value whatsoever from the question and any answers it will receive. Your post will in fact have negative value for them, since it will hide more complete questions and answers they could have found otherwise.

more often than not, the issue is not with the tutorial itself, but with the way you understood and followed it. This is one more reason to include the key steps that you took from the tutorial in your question. For instance, if the tutorial was using an EXT4-formatted drive and you took an NTFS-formatted drive instead, there's no way to discover it unless you post the commands you have used to format or mount the drive.

on a related note, if you could not get through the whole tutorial (getting expected results in every step), there's no way for others to know where you got stuck unless you tell this. One more reason to post the actions you performed and the results you've got, even if you copy-pasted every command verbatim from the tutorial page.

finally, be wary of blindly following a series of steps you don't fully understand. For example, I once myself followed a tutorial which resulted in nothing more than a big security hole. Essentially, unless the tutorial you're using is the official one, there's no guarantee that it will work for everyone, or work well, it's just something that may have worked somehow for the person who wrote it.
Comment: Well put. Thank you for that.
Comment: This is all good advice, but there are some bogus and "off-kilter" tutorials. In most cases, I wish the OP would simply go back to the author of the tutorial instead of bringing it here.
Comment: @Seamus I actually sat down to write this exactly after one such nextcloud tutorial (link in the answer) which lets everyone access your files without logging in. I wish I'd just go straight to nextcloud wiki.
Answer: Your question drew my attention again as I sometimes find this class of questions ("I followed a tutorial...") annoying. I feel annoyed, I suppose, for these reasons mostly:

There are a few "tutorial mills" that serve unfiltered crap.
Even some decent tutorials are not maintained or updated.
The "victims" of poor tutorials oftentimes have done nothing to try to help themselves; occasionally coming here to throw their problems over the fence.

I'm not sure there is much we can do about low-quality and ill-maintained tutorials. But, in the interests of improving our quality here on S.E., I wonder if we may be able to address the "failed tutorial contributor".
How to address the "failed tutorial contributor" would seem to depend on one's view of what a reasonable person should do in a failed tutorial situation. My views are:

Try to get in touch with the author of the tutorial. Communicate the issue to the author, and ask for his assistance.
Check the date of the tutorial (i.e. is this a jessie-vintage tutorial?).
Find and compare other tutorials having the same or similar objectives.

Some thoughts and recommendations:

Create a tag (failed-tutorial ?) to identify questions that have arisen while following a tutorial.

Add a section to the "Asking" page of the Help Center with some specific advice for "failed tutorial contributors".


How do I make sure that a custom ROM will fit my HTC Desire?

Question: After rooting your phone and setting S-OFF you will probably want to flash a custom ROM. One thing to consider when flashing a new ROM is the size of the partitions. This is especially important for phones like HTC Desire which has limited internal memory. I will use HTC Desire as an example here but the same principle should apply to other HTC models as well.
Answer: The HTC Desire by default allocates 250 MB of its internal memory for the /system partition, 40 MB for /cache partition and 147 MB for /data partition.
The ROMs are usually packed in ZIP files and are usually about 155 MB in size. However, they do get bigger when unpacked. Here's how to verify that you will be able to flash a custom ROM on your phone.

Download the ROM you want to flash. I will use SuperNova ROM here as
example.
Unpack the ZIP file. In my case, this is
Supernova_18.104.22.168_signed.zip.
Right click on the system folder and click Properties. Note the
size of it. In my case this is 203 MB.
Right click on the data folder and click Properties. Note the size
of it. In my case this is 17.9 MB.
Compare the found sizes to the reference sizes above.

If your system folder is less than 250 MB and your data folder is less than 147 MB then it's all good. You will be able to flash the ROM using the stock HBOOT image. This is true in my case for example.
However, if you find that your data folder is bigger than 147 MB (which is unlikely), OR if you want more free space for things like apps and user data, then you will need to flash a different HBOOT image first which will layout the partitions differently so that you get more memory allocated to the /data partition. One such HBOOT image is called "Bravo Oxygen r2". For more information and to download a differen HBOOT image, go to the AlphaRev website.
What is contained in the system and data folders is what will get copied to the corresponding partition once you flash the ROM.


Issue with extracting certain OSM features using Overpass Turbo and QGIS

Question: When I extract certain features from OSM using either overpass turbo or QGIS - for example: pubs, the data is either point feature (pub) or polygon (building). Showing the polygons is slightly problematic at certain scales and hard to see. Is there anyway to get round this - perhaps an improved SQL query or merge layers?
Answer: You can convert the polygons to points - either just for visualization, styling the polygons as points using Centroid Fill, or extracting the centroids from the polygons using Menu Vector > Geometry Tools > Centroids....
Styling a polygon layer with Centroid Fill in layer styling:
Comment: Thank you - will give that a try!
Answer: You could consider creating centroids from the polygon layer - first select those that do not have any pub features within the polygons (to avoid duplicates).  You probably know how to do that but if you are unsure:

Then select menu Vector>Geometry>Centroids;

Then append the new centroid point features to your existing point layer
Comment: Thank you - will give that a try now!


How to Restore data from binary log

Question: How can I restore my files and photos from binary files?
Answer: Do you know from which binlog files you need to restore and how many binlog files there are?
Using mysqlbinlog utility we can view the binlog file content.
If it's a single file you can recover using:
mysqlbinlog /var/lib/mysql-bin.000016 | mysql –uroot –pReset123

If it's multiple files then just extract all content to one .sql file and directly restore it:
mysqlbinlog /var/lib/mysql-bin.000016 > /logs/allbinlog.sql

To append second binlog content to allbinlof.sql file use below command:
mysqlbinlog /var/lib/mysql-bin.000016 >> /logs/allbinlog.sql

You can also exclude certain statements using option of mysqlbinlog. Try this below for options:
mysqlbinlog --help

Answer:
Use below steps to restore data from binary logs or use this link to understand restoration process: MySQL Binary Log Restoration
First, restore database from the latest backup
mysql -u username -ppassword database_name < dump.sql

Then do either of:

Restore rest of data from binary log.
If you have more than one binary log to execute on the MySQL server, the safe method is to process them all using a single connection to the server.
mysqlbinlog mysql_bin.000001 | mysql -u root -ppassword database_name
mysqlbinlog mysql_bin.000002 | mysql -u root -ppassword database_name

or:
mysqlbinlog mysql_bin.000001 mysql_bin.000002 | mysql -u root -ppassword database_name

Restore data on basis of time
mysqlbinlog --start-datetime="2005-04-20 10:01:00" \
            --stop-datetime="2005-04-20 9:59:59" mysql_bin.000001 \
            | mysql -u root -ppassword database_name

Restore data on basis of position
mysqlbinlog --start-position=368315 \
            --stop-position=368312 mysql_bin.000001 \
            | mysql -u root -ppassword database_name

Comment: The first example of restoring more than one binary log is specifically unsafe, as noted in the documentation.
Answer: First of all, it should be noted that the binlog files contain changes of a database for a time interval, but they do not include ALL data, and it makes no sense to restore only the binlog files. As a rule, to restore a database you need a full backup, and all binlog files that were created after a full backup. To restore data from binlog files, you need to perform a full backup correctly.
mysqldump -u root -ppassword --flush-logs --delete-master-logs  --all-databases > full-backup.sql

There are two important parameters in the command:
--flush-logs - this parameter starts writing to a new binlog file.
--delete-master-logs - removes old binlog files
Thus, in the folder with binary logs there will be only binlog files created after a full backup.
To restore data, firstly you have to restore a full backup
mysql -u root -ppassword  < full-backup.sql

And then restore all the binlog files via mysqlbinlog utility, specifying the paths to the binlog files (the order is important).
mysqlbinlog  mysql_bin.000023 mysql_bin.000024 mysql_bin.000025 | mysql -u root -ppassword

--
Note, if you use master\slave replication, then you should not use --delete-master-logs when performing a full backup on the master server, as this can break replication
But in this case, you have to remember which particular binlog file was created the --flush-log parameter, and for the restore process use it and all the binlog files that were created later.
More details about how to backup and restore incremental backups can be found at this article
Answer: You can use -v option to make .sql file in READABLE format.
For Example
mysqlbinlog -v /var/lib/mysql-bin.000016 > /logs/allbinlog.sql

mysqlbinlog -v /var/lib/mysql-bin.000016 >> /logs/allbinlog.sql

Answer: If you're using binlog with binlog_format=ROW which both is by default as of mysql 8.0,
and haven't done a full backup within the lifespan of available binlog files, i.e. complete mysqldump after the configured time of binlog_expire_logs_seconds before now, to perform the suggested Point-in-Time Recovery,
then you can still try to recover deleted rows with only a binlog file that covers these deleted events and turn them into insert events with this approach in https://github.com/lefred/MyUndelete/issues/5 :

it's able to replace the event type with the original awk script in http://thenoyes.com/littlenoise/?p=307:
BEGIN { regexp = "$^" }

/^BINLOG/ {
  print;
  getline;
  regexp = "^" substr($0, 1, 5) "[CSiy][ABCD]" substr($0, 8, 4);
}

$0 ~ regexp {
  n = $0;
  $0 = substr(n, 1, 5)
  $0 = $0 substr("BRhx", index("CSiy", substr(n, 6, 1)), 1)
  $0 = $0 substr("4567", index("ABCD", substr(n, 7, 1)), 1)
  $0 = $0 substr(n, 8) ;
}

{ print; }

sudo mysqlbinlog --start-position=148418658 --stop-position=484776616 binlog.000117 | awk -f undelete.awk | mysql

How to Restore data from binary log


Looking for an API that gives planet positions for a horoscope app

Question: I'm working on an art project where I want to generate horoscopes based on the current planet positions. I want to makes these somewhat realistic, but I don't know if there is any "planet positions" API, or something for horoscopes that is free. Does anyone know of anything like this? I'm just making a basic web app in html, css, and js if that helps.
Answer: programmableweb.com is the first place I stop looking for web APIs covering all sorts of subject matter.
Quick search there shows promising results under "astrology" like

Cerridwen  Cerridwen provides planetary data that focuses on our solar system and is suitable for both astronomical and astrological
  uses. This data includes sunrise times, phases of the moon, the
  tropical position of the sun, etc. Cerridwen's primary data sources
  are the Swiss Ephemeris library and its own algorithms, which
  calculate the phases of the moon and other planetary aspects and
  events.

and
Under "planet position" you'll find Ephemeris -

Ephemerides (singular: ephemeris) are tables of values that give the
  positions of astronomical objects in the sky at a given point in time.
  Object positions are written in terms of right ascension and
  declination. Davy Wybiral has created the Ephemeris API as a method of
  querying NASA's Jet Propulsion Laboratory (JPL) planetary ephemerides,
  which are generally created to support spacecraft missions to other
  planets. The Astro-Phys.com Ephemeris service can be accessed using
  RESTful calls issued in JSON format.
Comment: Thank you! I think that Cerridwen will work out really well for my purposes!


Is L2TP as secure as IPSEC for VPNs?

Question: Is it as secure to use L2TP for VPN access, rather than IPSEC? Am I introducing any risks by using L2TP?
Answer: L2TP does not provide any confidentiality or authentication. A common setup is using L2TP along with IPSEC (see RFC 3193).
EDIT: L2TP does provide tunnel end-point authentication. It does not provide encryption and message authentication.
Comment: Ah yes I guess I did mean L2TP/IPSEC VPN then.
Comment: In almost all cases when someone says "L2TP VPN" they mean L2TP/IPSEC VPN. While it is possible to set up a pure L2TP tunnel it is rarely done in practice.

Is L2TP as secure as IPSEC for VPNs?


resolv.conf search domain not working on OS X

Question: I use network setup to modify my search domains which works fine so far, but it only does it per device. Once I VPN somewhere, it no longer uses those changes. Is there a way to set the search domains globally (ie. for every device: Ethernet, Wi-Fi, and VPN) on Mac OS X Lion?
Comment: Can you add your resolv.conf into the question?
Answer: There was a similar issue in 2002 with OS X. I found a few articles about it and I've been able to address this issue by simply adding "local" to the Search Domains in the advanced network properties of my network interface. This has allowed those of connecting via VPN to resolve .local hosts.
Comment: worx on yosemite
Answer: Why not just add it to the adapter in question? i.e. ethernet or Wi-Fi: http://support.apple.com/kb/PH14159
Per: https://web.archive.org/web/20150227052942/http://support.apple.com/kb/PH14159
<code>
For example, if you specify the search domain apple.com, typing "store" in your web browser takes you to store.apple.com. Or, if you use campus.university.edu as a search domain, you can type "server1" in the Connect To Server dialog in the Finder to connect to server1.campus.university.edu.

Choose Apple menu > System Preferences, then click Network.
Select the network connection service you want to use (such as Wi-Fi or Ethernet, unless you named it something else) in the list, then click Advanced.
Click DNS, then click Add (+) at the bottom of the DNS Servers list. Enter the IPv4 or IPv6 address for the DNS server.
Click Add (+) at the bottom of the Search Domain list and enter the search domain, for example, apple.com.

When you're finished, click OK.
Domains are searched in the order you list them, and the search stops when a valid name is found.

To search a name hierarchy, use search domains of varying scope. For example: building.campus.university.edu, campus.university.edu, and university.edu.
</code>
com.apple.mDNSResponder.plist can be overwritten by something else/update and you will forget it.  The url above is the "supported" way to add the domain search path to the DNS query.
Comment: I added the text but apparently someone added pictures since then of the same thing and is now the upvoted answer.
Comment: This URL is no longer valid, it would have been helpful to add the relevant information into this answer.
Answer: If you want a strict command line solution, you can add the search domains manually to each adapter/service.

List all networkservices to get the common names:
<code>$ networksetup -listallnetworkservices
Wi-Fi
FT232R USB UART
Thunderbolt Bridge
Thunderbolt Ethernet
</code>
Check the current searchdomain setting on the device you want to update (You must fully quote devices with spaces in the names):
<code>$ networksetup -getsearchdomains "Thunderbolt Ethernet"
yourdomain.com
yourdomain.lan
</code>
Then add the searchdomains you want where they are missing:
<code>$ networksetup -setsearchdomains "Wi-Fi" yourdomain.com yourdomain.lan
</code>


Prove that $A$ is diagonalizable iff $\mbox{tr} A\neq 0$

Question: Prove that $A$ is diagonalizable if and only if $\mbox{tr} A\neq 0$.
$A$ is an $n\times n$ matrix over $\mathbb{C}$, and $\mbox{rk} A=1$.
If $p(t)$ is the characteristic polynomial of $A$, I know that $a(n-1)\neq0$ because $\mbox{tr} A = (-1)^{n+1}a(n-1).$
I also know that $\dim\ker(A-0\cdot I)=\dim\ker A=n-\mbox{rk} A=n-1$ (so the geometric multiplicity of $t=0$ as an eigenvalue is $n-1$).
Though I don't know how to continue from here (on both directions).
Any suggestions?
Thanks
Comment: I think I figured out how to continue. 0's algebric multplicity is always beigger than it's geomtric, so >=n-1. though it can't be n because then p(t)=(-1)^(n+1)*t^n and then trA = 0. so the algebric multiplicity is equal to its geomtric. There is one more eigenvalue t!=0 of algebric mulplicity 1 so the geometric must be 1 also. So all the eigenvalues' algebric and geometric multiplicites are equal, therefore A is diagnolizable.
Comment: Please, make a better statement of your question (Use $LaTeX$ too)
Answer: $A$ is diagonalizable $\implies$ $trA\neq 0$
$A=PDP^{-1}$ where
 $$ D=\begin{pmatrix}
 \alpha & 0 & \cdots & 0 \\
  0 & 0 & \cdots & 0 \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  0 & 0 & \cdots & 0
 \end{pmatrix}$$
with $\alpha\in\mathbb{C}^*$
so $$tr(A)= tr(PDP^{-1}) = tr(P^{-1}PD) = tr(D) = \alpha \neq 0$$
$trA\neq 0$ $\implies$ $A$ is diagonalizable
Since $rk(A)=1$, the first $n-1$ eigenvalues of A are $0$. The last one is different from $0$ since $trA\neq 0$ and fulfill the eigenspace since $dim(E_\alpha)=rk(A)=1$. Therefore, A is diagonalizable.
Answer: Since $\mbox{rk}A=1 $ you have that $0$ is an eigenvalue with geometric multiplicity $n-1$. Your eigenvalues are thus $\lambda_{1}=\dots=\lambda_{n-1}=0$ and $\lambda_n=\mu$ where $\mu$ is a certain complex number.  First of all notice that since $\mbox{tr} A=\sum_{i=1}^{n}\lambda_{i}$ you have that $\mbox{tr} A=\mu$.
$A$ diagonalizable $\Rightarrow$ $\mbox{tr} A\neq0$
Assume now $\mbox{tr} A=0$, then $\mu=0$ and thus $0$ would be an eigenvalue with algebraic multiplicity $n$, but geometric multiplicity $n-1$ (since $\mbox{rk} A=1$). Hence $A$ would not be diagonalizable.
$\mbox{tr} A\neq0$ $\Rightarrow$ $A$ diagonalizable
Conversely assume $\mbox{tr} A\neq0$, then $\mu\neq 0$. Hence algebraic and geometric multiplicity of $\mu$ coincide since they are $1$, and algebraic and geometric multiplicity of $0$ coincide since $\mbox{rk} A=1$.
Answer: Diagonalizable over $\mathbb{C}$  implies there is a basis of eigenvectors, and conversely. Rank one implies nullity ( ie dimension of kernel = dimension of $0$-eigenspace- is $n-1$). Trace $0$ (in this situation) happens if and only if $0$ is the only eigenvalue. But if $0$ is the only eigenvalue, there is no basis of eigenvectors, as $0$-eigenspace is not big enough. Trace non-zero implies that there is an eigenvalue $\lambda \neq 0$, so there are $n-1$ linearly independent vectors with eigenvalue $0$ and a non-zero eigenvector with eigenvalue $\lambda$, so there is a basis of eigenvectors.


How do I safely install an older/newer version of Python?

Question: When I eventually upgrade to 11.04 I will need to install Python 2.6 for development purposes. The 11.04 default is 2.7. Can I just install the python2.6 package alongside the default python package? I don't want anything else to depend on it, I need it for only one purpose. I will be using Distribute and virtualenv to install any further dependencies for Python 2.6.
Comment: thanks for the answers; in retrospect it should have been obvious seeing as I run python3 side-by-side with no problems :)
Comment: updated title to reflect that it applies to newer versions too
Answer: Run synaptic(through the application lens in unity or System -> Administration if you are using classic desktop )
search for python 2.6 in the filter at the top and mark it for installation by right clicking it, and selecting "Mark for Installation".
It should run alongside 2.7 fine as far as I'm aware, now when you need to use 2.6 invoke it directly, i.e with the command "python2.6 "
This should work, let me know if it doesn't though. :)
Comment: thanks for the edit :) i'm new to unity so i'm not used to talking to people in terms of the new GUI
Comment: for anyone applying the question to an older version of Ubuntu or via the Gnome 2 desktop, Synaptic is available under System / Administration / Synaptic Package Manager
Comment: Or just click here for any newer version: http://apt.ubuntu.com/p/python2.6 .
Answer: VirtualEnv is the definitely best way to have multiple python versions, even it it is the same interpreter but with different installed libraries. In each virtual environment you will run the selected python version. Every thing will be transparent.
BTW: you can find a repository with very old python version here: https://launchpad.net/~fkrull/+archive/deadsnakes/+packages
Maybe it will be useful for someone.
Answer: Yes, you can without any problems.
You can even do system wide installs using easy_install. Just instead of invoking it directly, invoke it via python2.6 easy_install.
Answer: You can use pyenv to do this too. I rather simple and also it allows you to switch versions and control your python enviroment. To install and use:

Install the dependencies of python, to prevent weird messages:
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev git

Install pyenv. Sadly this application doesn't have package that you could just apt-get away, but still it's easy to install:
mkdir $HOME/.pyenv
cd $HOME
git clone git://github.com/yyuu/pyenv.git .pyenv

the following is bash exclusive. If you use another shell you must modify the .bashrc entries.
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc

Restart the shell:
exec $SHELL

Check that the installation is ok:
➜  ~  pyenv --version
pyenv 0.4.0-20140110.1-14-g46a01b1

Install python versions away:
➜  ~  pyenv install 2.7.6
Downloading Python-2.7.6.tgz...
-> http://yyuu.github.io/pythons/1d8728eb0dfcac72a0fd99c17ec7f386
Installing Python-2.7.6...

Installed Python-2.7.6 to /home/braiam/.pyenv/versions/2.7.6

Downloading setuptools-2.1.tar.gz...
-> https://pypi.python.org/packages/source/s/setuptools/setuptools-2.1.tar.gz
Installing setuptools-2.1...
Installed setuptools-2.1 to /home/braiam/.pyenv/versions/2.7.6

Downloading pip-1.5.tar.gz...
-> https://pypi.python.org/packages/source/p/pip/pip-1.5.tar.gz
Installing pip-1.5...
Installed pip-1.5 to /home/braiam/.pyenv/versions/2.7.6

Done. Now you may want to do pyenv rehash. Also use pyenv versions, since this will show all the versions possible. pyenv local 2.7.6 will set the version of python used by the current directory and below to that version.
Answer: for testing purpose, you would also install it locally (or not) from the sources :
download the tarball source package. Python is really easy to compile. (the trick is in the altinstall)
./configure --prefix="/home/me/python2.6"
make
make altinstall

then do
export PATH="/home/me/python2.6/bin":$PATH
export LD_LIBRARY_PATH="/home/me/python2.6/lib":$PATH

Plus you may want to play with virtualenv


Is the high influx of new users a result of Stack Overflow's culture?

Question: When you take a look at new questions you see that around 20% of the new questions come from new users. I think this is a little bit high. Are there any statistics that point out the reason for this? Is it possible that some of these new users are established users who feel hesitant or afraid of asking a question? Or are they people who create a new account for every question they make because they be afraid of Stack Overflow's culture?
Comment: Then please revise your question @Michael. You apparently have a clear idea of something that constitutes an SO-specific culture, that might influence the participation of users. I'm not looking for a definition of the word "culture". But if I'm to answer this, I have to make assumptions about what you're thinking but not saying. As the question stands, what you're asking is "Is the thing that I'm not sure is happening caused by something?".
Comment: Yet when Kate provides you with one of her wonderful answers containing a definition of it, you don't even acknowledge if that is what you mean.
Comment: ... what do you mean by "Stack Overflow's culture" though? If you want us to answer whether or not something might be happening as a result of a "culture", then please define what this culture is. (And OT, but why does your profile say "please delete me"?)
Comment: What do you mean by, er, "culture"?
Comment: @Michael -- You posit that the high influx of new users is a result of Stack Overflow's "culture", yet you repeatedly dodge the question/refuse to answer, **what is your definition of Stack Overflow's culture**?  You may not have asked for a definition, but **we have**,  from **you**.
Comment: It's a question not to be asked in an unclear manner. If all you want to ask is, *"Are all these new members truly new members, or is there any indication that a significant number of them might be already actively participating members with a new account?"* then ask that. As for the "psychological reasons", I'm not sure that that discussion will get you much more than unsubstantiated opinion.
Comment: Adapt your title, clarify/focus your question and I'll gladly vote to reopen it.
Comment: @BoltClock'saUnicorn It's hard to define culture in a comment. It's kind of the way of doing things in a group of people. You may have a particular culture in your family, local community, work, country, etc.
Comment: @Bart To be honest i have no idea. On stackoverflow it's different, i just removed it. I can't just explain what culture is. Check wiki what it means.
Comment: @Bart It would be a very lengthy post and involve interviewing many users to create a clear picture of Stack Overflow's culture. Which is actually still interesting, i like psychology and culture. Still i think everybody here has a bit of an idea about Stack Overflow's culture.
Comment: @Kate I did not ask for a definition and i furthermore think it would be a bit limited version of it as well. She appears to be a mind reader as well. According to her i secretly put hidden messages in posts and i disapprove of stack overflow culture. Was it maybe my subconsciousness mind that was speaking there?
Comment: @LBT I'm not dodging anything, i'm staying on topic and constructive. I just mentioned that Kate supplied a limited version of it and that a definition would be lengthy so how would that fit in a 500 character box? And furthermore more important; how would that be on topic and constructive in regards to this question? The only thing i was wondering whether there may be a possible psychological reason for the high influx of new users but i consider it is a question not to be asked which is a shame.
Comment: @Bart If you closely read the question I asked you can see that I asked "When you take a look at new questions you see that around 20% of the new questions come from new users. I think this is a little bit high. Are there any statistics that point out the reason for this?" And then listed possible reasons as an example. I must say I really took considerable time to make it as clear, constructive as possible. However it does not matter any more since you and a couple others closed it. I give up, just never mind...
Comment: @Bart I rather do not do that. I fear altering the question would mean a new influx of comments why it is weird and wrong what I'm asking and that i put hidden messages about nasty people and that i approve of many things. Especially since it will be bumped up to the top again. I rather leave it be. In any case I have to go back doing work in any case.
Comment: This is the odds of getting a good quick answer multiplied by the odds of the Universe never running out of low-rep users multiplied by the odds of them forgetting their previous user account.  The product is indeed 0.2
Answer: Yes, the high influx of new users is a direct and deliberate result of Stack Overflow's culture. This culture:

edits questions until they are readable and answerable
removes chit chat, followup, and non answers from the answer area
votes good answers up and bad answers down
edits answers to make them more readable
kills spam and off topic material on sight
answers questions remarkably quickly

As a result, if you want to ask a question to solve your problem, this is where you come. Since you need an account on SO to ask, you become a new user.
(You seem to also have another slightly different question lurking in there: something like "do the mean nasty people on SO scare a bunch of established users into pretending to be new users?" but I can't see what an established user would gain by pretending to be new, nor why that would be bad for the site, nor what you think could stop that not-necessarily-bad-thing from happening, so I'm just going to answer your title question as written. It's pretty clear you disapprove of the SO culture but again, I can't see why you do and you're resisting when people ask you to elaborate, which is a shame.)
Comment: Here is how. Take the two sentences speculating that people might be afraid and expand them. First, what precisely are they possibly afraid of, and why do you think so? Second, what do you think motivates them to make new accounts as a result of this fear? Third, what do you think the consequence is for SO that people might do this? Fourth, why are you asking at all? Lots of questions are from new users, mumble mumble about fear, ???, end of question. Your question can easily be re-opened if you edit it so that it is an actual question.
Comment: well yes I am, but I did say "seem". Feel free to clarify your question
Comment: @Michael - _You are an experienced mind reader?_ seems quite rude - also look at the votes (which on meta indicate agreement).
Comment: That statement about votes is not entirely correct @UV-D. In this case my downvote was cast because it's simply a bad and unclear question. A regular old downvote.
Comment: That's a very big presumption you just put there my friend. You are an experienced mind reader?
Comment: But you said "It's pretty clear" as well. Regarding the question, I don't know how. But it's ok, never mind. I shouldn't have asked it.
Comment: @Bart after rereading the question, yes, I can see that is very much true.
Answer: SO ranks very highly on Google. Almost any programming question you can imagine is going to send people here, so even programmers who have never heard of us are likely to end up here and ask their question, resulting in a near-perpetual influx of new accounts.
This is a good thing.
Comment: @Michael: SE and Yahoo Answers are hardly comparable.
Comment: Still if you take a look at other q/a websites that excel on google on other topics they have a lesser amount of new users. On Yahoo i can only count around 10%. Is it possible it is only limited to IT questions?
Comment: But if they actually Googled their questions they would just find the answer someone already got to the exact same question on SO instead of just finding the site and asking a new question.
Comment: @Wooble that's a good point also
Comment: @Linuxios Still the concept is the same. They are both q/a answer websites where people register to create questions they want to ask. At yahoo answers it should actually be higher since duplicate questions is not the focus there while at Stack Overflow the concept is to only have unique questions.
Comment: @Michael It doesn't matter too much whether duplicates are a focus on the site; new users will post them either way, since they're new. IMO, a big factor is that SE intentionally makes it as easy as possible to register and ask a question. This is also a good thing.
Comment: @Michael: SE also draws because of one of our main strengths: quality control. We keep things tidy here, and that makes the site more appealing to new users. Only the people who need to or post it really see the very low quality posts.
Answer: Isn't it only natural that most questions come from new users? Most people come here when they have a question. Many might have only one. So after they get their question answered, they are never seen again. Old users on the other hand get more experienced first to search for existing answers and might have in general less questions. With all those possible effects, I think it is very hard to get a meaningful statistic to your question.


After semi-bluffing to balance your range, do you muck or show?

Question: In the book The Course by Ed Miller, he recommends including hands like A5s into your 3-bet range to balance your range. Are you supposed to show after successfully bluffing? If you muck, then your opponent may just assume you had a premium hand. If you show, then low stakes players may assume you bluff frequently and start calling down a lot more thus forcing you to tighten your range.
Answer: Never voluntarily show.  You are just giving away information.
Answer: I never show after successfully bluffing, unless it is a friendly home game and I want to mess with my friends. In live games at a casino, I find it is best to keep your opponents guessing what your hand was. Some opponents may assume that you had a premium and move on, others may not be too sure about whether or not you were bluffing. Either way, this maintains the image that your opponents had already assigned to you.
Showing can encourage your opponents to call you lighter in future hands, but I find that this is not super necessary in lower stakes casino games. Usually the opponents are calling often enough anyways in the 1/2 and 2/3 games I play.
Comment: Keep in mind that sometime you WANT your opponent to have some information. You control what information he gets so you can throw him off by revealing different types of hands as your strategy evolves throughout the game..


Spacing between counters and text in easylist

Question: I have a list with some positives and negatives, so I'm using plus and minus sign instead of the bullets in the itemize style, but there isn't any spacing between them and the text. Which I solved by adding a space after the plus and minus symbol \ListProperties(Hide=2, Progressive=0cm, Style*1=$+$ , Style*2=$-$ ,) but it just feels wrong. Is there any other way or is this how you really do it?
Answer: Ok, it just hit me that you can add \hspace{.3em} after the Style*1=$+$. So like this \ListProperties(Hide=2, Progressive=0cm, Style*1=$+$\hspace{.3em}, Style*2=$-$\hspace{.3em},) and it will be 100% same as the default spacing of easylist


What is required for seasonal maintenace of a heat pump?

Question: Over the years I've had several local HVAC companies provide seasonal maintenance of the heat pumps and propane furnace in my house.  It seems that every technician--even within the same company--does different things.  One tested a capacitor.  Another hosed out the compressors outside.  Some open the air handler up and vacuum it.  They all clean the burners, check/clean the filters, and make sure the condensation drain is clear.  What should they be doing each visit?
Comment: The variation in tasks might be explained by indications the technician observes:  dirty indoor coils?  Clean them.  Noisy outdoor fan?  Clean and lubricate.  Or it could be differences in training and company philosophy.
Answer: Your list is pretty good.  Check/clean flame, filters, condensation drain and coils.  I would also listen for abnormal noise and check both cooling and heating performance by measuring the indoor and outdoor temperature splits.  I would not go measuring capacitors unless I suspected a failure.


Getting Default symbology in a feature class with subtypes

Question: I was wondering if there was a way to get default symbology in a GDB feature class with subtypes?  I don't want to create a layer file for each feature class.  Is there a way to have the symbology built in?
Answer: Technically yes, but it kind of depends on your situation and existing data. What you're talking about are Feature Templates, also discussed at this blog post. However the templates may not display as you set them if there are already features symbolized in the map.
If you do have existing data symbolized in the map, you don't have to create a layer file for each feature class. A layer file can contain symbologies for multiple feature classes or even the same feature class multiple times - you just have to group the layers and then save that group to a layer file. You can then load them as a template and ungroup if you need to (some tools have issues with grouped layers, nested groups, or groups nested more than one level deep).
Comment: Feature Template are part of ESRI Editor framework and is application dependent. The question asker mentions that he doesn't want to create a layer. If you don't add a FC to the map, you can't work with feature templates!
Comment: @FaridCher Actually, he said layer file (as in .lyr), not 'didn't want to add a layer to a map'. The question is somewhat vague, and Feature Representations may be the way to go (although note that's only available at Standard and Advanced, not Basic).
Comment: Nice catch. However a layer is an in-memory layer file, and feature templates are dependent upon Carto and Editor framework.
Answer: Feature representation is the only possible way of embedding Feature Class symbology within database. After enabling feature representation for a feature class, define its subtype base on RULEID field.


Passport validity for transiting Doha

Question: My son will have a close to 3 month validity on his British passport when travelling from New Zealand where we now reside to the UK. We transit Doha both ways on this journey, is this short validity going to be an issue?
Answer: Since you're not clearing immigration in Doha, their passport validity rules don't apply to you.
Even if you were to enter Qatar, the country only requires 3 months validity from the date of entry.
So you will be fine

Passport validity for transiting Doha


Search for strings listed in one file from another text file?

Question: I want to find strings listed in list.txt (one string per line) in another text file in case I found it print 'string,one_sentence' in case didn't find 'string,another_sentence'. I'm using following code, but it is finding only last string in the strings list from file list.txt. Cannot understand what could be the reason?
data = open('c:/tmp/textfile.TXT').read()
for x in open('c:/tmp/list.txt').readlines():
    if x in data:
        print(x,',one_sentence')
    else:
        print(x,',another_sentence')

Comment: I've shortend your code to make it more readable. Could you please add extracts of both files?
Answer: When you read a file with readlines(), the resulting list elements do have a trailing newline characters. Likely, these are the reason why you have less matches than you expected.
Instead of writing
for x in list:

write
for x in (s.strip() for s in list):

This removes leading and trailing whitespace from the strings in list. Hence, it removes trailing newline characters from the strings.
In order to consolidate your program, you could do something like this:
with open('c:/tmp/textfile.TXT') as f:
    haystack = f.read()

if not haystack:
    sys.exit("Could not read haystack data :-(")

with open('c:/tmp/list.txt') as f:
    for needle in (line.strip() for line in f):
        if needle in haystack:
            print(needle, ',one_sentence')
        else:
            print(needle, ',another_sentence')

I did not want to make too drastic changes. The most important difference is that I am using the context manager here via the with statement. It ensures proper file handling (mainly closing) for you. Also, the 'needle' lines are stripped on the fly using a generator expression. The above approach reads and processes the needle file line by line instead of loading the whole file into memory at once. Of course, this only makes a difference for large files.
Answer: readlines() keeps a newline character at the end of each string read from your list file. Call strip() on those strings to remove those (and every other whitespace) characters.


How to prove that the Fourier Transform of white noise is flat?

Question: If we take $X_n$ a series a random vector with its components each having a probability distribution with zero mean and finite variance, and are statistically independent. How do we prove that the power spectrum of $X_n$ is flat?
Comment: Umm...isn't that the *definition*?  ["Constant power spectral density"](http://en.wikipedia.org/wiki/Spectral_density#Power_spectral_density) means the Fourier transform is "flat".
Comment: Thanks for your comment. Ah yes this is the definition of a white noise. I didn't ask the question correctly. Actually I meant if you have a series of X_n following identically independent gaussian distributions, would that have a flat power spectrum?
Comment: Please edit your question if you wish to change it--not everybody will read these comments and most people will answer only what is in the question itself.
Answer: The power spectrum at frequency $\lambda \in [-\pi,\pi]$ can be obtained by taking the Fourier transform of the autocovariances $\gamma(\tau)$ of orders $\tau=-\infty,...,-1,0,1,...\infty$:
$$
f(\lambda) = \frac{1}{2\pi} \sum_{\tau=-\infty}^\infty \gamma(\tau) e^{-i\lambda\tau} \,.
$$
Using the facts that in a white noise process $\gamma(-\tau) = \gamma(\tau)$
and $e^{-i\lambda\tau} = \cos(\lambda\tau) - i \sin(\lambda\tau)$,
$\cos(0)=1$ and that $\sum_{\tau=-\infty}^\infty \sin(\lambda\tau) = 0$ for a given $\lambda$, the above expression can be written as:
$$
f(\lambda) = \frac{1}{2\pi} \left(
\gamma(0) + 2 \sum_{\tau=1}^\infty \gamma(\tau) \cos(\lambda\tau) \right) \,.
$$
$\gamma(0)$ is the variance of the process, while the remaining covariances are zero in a white noise process, $\gamma(\tau)=0$ for $\tau\neq 0$. Thus, we are left with the constant:
$$
f(\lambda) = \frac{\gamma(0)}{2\pi} \,.
$$
According to this view in the frequency-domain, a white noise process can be viewed as the sum of an infinite number of cycles with different frequencies where each cycle has the same weight.
Comment: @Dilip Sarwate, what is required to converge is $\sum_{\tau=-\infty}^\infty \gamma(\tau)\sin(\lambda\tau)$; this will be the case if $\sum_{i=\infty}^\infty|\gamma(\tau)|$ converges, which is usually assumed (ergodicity assumptions).
Comment: What happened to $\gamma$ in the initial formula?
Comment: @whuber It was missing in the first two equations, thanks I fixed it.
Comment: Is it really true that $\sum_{\tau=-\infty}^\infty \sin(\lambda\tau) = 0$? For $\lambda = \pi/2$, the sum is of the form $$\cdots, 0, 1, 0, -1, 0, 1, 0, -1, \cdots$$ and thus does not converge.
Answer: The question in the title is not the same as the question in the
text or as described in the comments.
The Fourier transform of an
infinitely long sequence is a discrete-time
Fourier transform which is a (complex-valued) periodic function of the frequency
variable $\omega$. See also, @javlacalle's answer. Thus, it cannot be "flat" except in the trivial case when the function is a constant, or one
includes any complex number of magnitude $1$ in the notion of "flat".
Furthermore, when the sequence is a realization of a white noise (normal)
process (which is a sequence of i.i.d. (normal) random variables), then the
Fourier transform of the sequence differs from realization to realization,
and it boggles the mind that all of these Fourier transforms turn out to
be "flat" in any sense of the word.
So, what is asked for in the title of the question is meaningless.
The question asked in the text of the question is, as pointed
out by whuber, essentially the definition of white noise. It is
better to approach the problem of defining white noise by
starting with a sequence
of i.i.d random variables of finite variance $\sigma^2$ and noting that
the autocovariance function is a unit pulse function. To borrow
notation from javlacalle, $\gamma(0) = \sigma^2$, and $\gamma(n) = 0$
for all other integers $n$. From this, it follows that the
power spectral density (Fourier transform of the autocovariance
as per the Wiener-Khinchine theorem) is a constant (which is why the
noise process is called white noise, in mistaken analogy with white light
which is a flat mixture of wavelengths, not frequencies).
Answer: Actually, your question is pretty legitimate. However, it needs to be asked in a slightly different manner. You need to specify the distribution of the periodogram ordinates and get a statistical test to examine whether your real data conform to that. One attempt is our recent paper


Switch on daily chatter notifications for all users

Question: We decided that all users should receive daily Chatter digest via Email. Is it possible to turn this on via a mass update of all users, or do users have to turn it on themselves?
Answer: There is a Chatter email notification setting for each Chatter group.  Members of a group can set this option, but it can also be set via the CollaborationGroupMember API.  The default should be set to daily.
I don't think that is the daily digest you were referring to though, as there is another daily digest for records the user follows.  I do not know if this can be changed through the API, but I think the default for this is also daily, so if a user doesn't have it set to daily, they would have intentionally changed it.  Please let me know if you aren't seeing it as the default for a user.


How to update the pallet's storage from the runtime api?

Question: Is it possible to update the storage of pallets through runtime api?
Is yes. Do we have any resources for this same?
Answer: No it is not possible. Conceptually a Runtime API runs outside of consensus. They can be called by anyone on a RPC node and are permissionless.
It would therefore not make any sense to change the on-chain state since that is guarded by the consensus. If someone still wants to do that, then the node would just not be able to import blocks anymore since the state root hash differs.
Imagine I just change the balance of an account through a Runtime API on my node, why would anyone trust that change?
Comment: Yeah got it!.Thank you so much. I'm working on substrate pow chain and if i want to change some logic of miners selection, what all files I need to look into(any rough idea)?


How does the amount of dark matter in measured galaxies vary?

Question: I have recently viewed two news articles announcing a galaxy composed almost entirely of dark matter and one with hardly any. This made me wonder if there is a "continuum" of percentages of dark matter in galaxies, where it has been measured, or if there is a "preferred" range.
Answer: tl;dr: In general, smaller galaxies have relatively more dark matter than larger galaxies. The atypical galaxies that you refer to are discussed in the last paragraph.

Mass fractions in the Universe
Matter in the Universe is dominated by two components; baryons (i.e. atoms in various forms) and dark matter (DM). The baryons predominantly exist in two forms: gas (including plasma) and stars (some gas condenses to form dust, planets, etc., but that's a minor part).
The fraction of the Universe's total energy in the form of matter is $\Omega_\mathrm{M}\simeq0.31$ (most of the rest is dark energy). The baryons and DM have fractions $\Omega_\mathrm{b}=0.05$ and $\Omega_\mathrm{DM}=0.26$, respectively (numbers from Planck Collaboration et al. 2016).
Hence, the baryons and DM comprise fractions
$f_\mathrm{b}  = \Omega_\mathrm{b}  / \Omega_\mathrm{M} = 16$% and
$f_\mathrm{DM} = \Omega_\mathrm{DM} / \Omega_\mathrm{M} = 84$% of the total mass, respectively.
Galaxies have more dark matter than the average Universe
Galaxies formed when DM+gas overdensities decoupled from the Hubble flow and started collapsing, and so were "born" with the "cosmic" fractions. However, observationally it is found that the baryon fraction in galaxies is much smaller; for instance, a "typical" Milky Way-sized galaxy roughly has $f_\mathrm{b}$ only half of the cosmic average, and the DM fraction is correspondingly larger, >$90$% (e.g. Werk et al. 2014).
Gas and dark matter dynamics
The reason is the different mechanisms that affect the dynamics of the particles.
Whereas the DM is collisionless, the gas particles collide and dissipate their energy, making it easier to cool and contract. Thus, the part of the galaxies that we can observe is much smaller than "whole" galaxy; the  typical "half-light radius" is but a few percent of the emcompassing DM halo (Kravtsov 2013, Somerville et al. 2017). The half-light radius is the radius within which half of the light is emitted; when you see an image of a galaxy, it typically looks perhaps 4-5 times larger than this. So, something like this:

A significant fraction of the baryons reside in the halo as well. This is the hot gas of millions of Kelvin, and the high temperature and low density makes it difficult to detect, as it glows only in faint X-rays.
Feedback blows out gas, but dark matter stays
But various physical processes act so as to try to blow the baryons — but not the DM — out of the galaxies. These processes are known as feedback, and are due to energy being "injected" in the baryons.
For massive galaxies with halo masses $M_\mathrm{h}\gtrsim10^{12}\,M_\odot$ this feedback is dominated by their central black hole accreting gas, resulting in extreme luminosities manifesting itself as a quasar, or active galactic nucleus (Silk & Rees 1998; Croton et al. 2006). For smaller galaxies with $M_\mathrm{h}\lesssim10^{12}\,M_\odot$, the feedback is mostly due to stellar winds and exploding stars depositing thermal and kinetic energy in the surrounding gas (Dekel & Silk 1986; Hopkins et al. 2012). At even lower masses, the galaxies are so small that a significant fraction of their gas may be ejected altogether during early epochs of star formation (e.g. Bullock et al. 2000), resulting in galaxies that consist virtually only of DM and a few stars.
The smaller a galaxy is, the shallower its gravitational potential, and thus the easier it is for the gas to escape the galaxy.
Hence, in general the smaller a galaxy is, the larger its amount of dark matter is.
Conversely, the larger a halo is, the more its mass fractions converge toward the cosmic fractions. These are only reached for halos of masses $M_\mathrm{h} \gtrsim 10^{15}\,M_\odot$, which are no longer individual galaxies, but rather groups and clusters. This is seen in the figure below (from a paper from last week by Henden et al. 2018), which shows the stellar mass fraction (left) and gas mass fraction (right) as a function of halo mass:

The baryon fraction is $f_\mathrm{b} = f_\mathrm{stars}+f_\mathrm{gas}$, and the DM fraction — which is what you're asking for — is then given by $f_\mathrm{DM} = 1 - f_\mathrm{stars} - f_\mathrm{gas}$. The stellar fraction is seen to decrease with halo mass, due to the AGN feedback discussed above, but the total star+gas fraction increases.
Note though that although the DM — being collisionless — is not exactly blown out of the galaxy like the baryons, the gravitational attraction between the two components still affects the DM and alters the density profile of the halo (Duffy et al. 2010).
Galaxies with more gas than dark matter (?)
Thus, a galaxy without baryons is not a huge mystery, as long as it's small. Even larger galaxies are apparently able to rid themselves of most the baryons; van Dokkum et al. (2016) reported a MW-sized halo with 98% DM.
A galaxy with baryons, but without DM is more spectacular, but was reported recently by van Dokkum et al. (2018) (yes, the same guy).
In another answer about DF2 I discuss various processes that might lead to such a galaxy, including misinterpretation of the data.
Comment: So, am I right to say that, in general, the smaller the galaxy the higher percentage of dark matter mainly because more of the gas has been "blown away"? Has this been supported by stellar or globular cluster velocity measurements at different radii?
Comment: +1 for a comprehensive answer, and for _not_ saying dark matter is comprised of WIMPs.
Comment: Yes, you're right. I'm not exactly sure what you mean by your second question, but measuring velocities at different radii (using stars, GCs, or gas clouds) is exactly one of the methods used to measure dynamical masses. At higher redshifts, where individual clusters and cloud are not distinguishable, a single emission line from everything in the galaxy may be used, using the width of the line to probe the velocity field.
Answer: The basic method used to measure dark matter in a galaxy is to observe the extra gravitational pull coming from matter which is not visible. The effect on orbits of stars in a galaxy (determined by observing galaxy rotational curves) and the bending of light by gravitational lensing are the some of the techniques used for measuring the gravitational pull of a galaxy.
Comment: I've edited for grammar, but this doesn't really answer the question. You've explained how we measure the amount of dark matter in a galaxy. You haven't said how the amount of dark matter in different galaxies varies.


ROS2 SLAM without Lidar

Question: I am trying to implement SLAM and robot localization for my ROV - remotely operated underwater vehicle- without using lidar. nor wheel encoders since the rov's movement uses T200 thrusters and not wheel encoders- it is not a differential robot. however all implementations i have found are using Lidar primarily and wheel encoders (and IMU sensor).is what i am trying to do possible? if so, how should i change slam to work with imu and any other needed sensor that is not a lidar, using the nav2 stack and if needed the robot localization package. any references to someone who has done the same would be welcome.
Comment: Let's start from the beginning. What is it you want to do? Explain it without using the terms SLAM or localization...
Comment: I have to ask...SLAM means map building. What sensor are you going to use to sense the environment and build your map? You don't need lidar but you need something...sonar? ...radar?
Comment: would a gps work? or a camera? i'm welcome to suggestions with both variations
Comment: What you're looking for here is a field in of itself: take a look at 'underwater SLAM' and you'll find plenty of papers which may have implementations. While it's certainly possible to do this in ROS 2, it's not a part of the core, standard-maintained functionality in the ecosystem.
Answer: You will need to provide your own specialized localization solution since you don't have any of the necessary requirements for 2D or 3D lidar SLAM. There are VSLAMs you might want to check out, but I don't know the particulars of your robot or underwater robotics environments that you're in to know if those are any more viable.
You obviously need to pick the right localization technique for your environment / robot sensor modalities.
Answer: Hello I am a ROS enthusiast myself and I dont know if what I am suggesting would work but you can give it a try.

Yes it is possible to use SLAM without LiDAR. You need a two sensors one t check the distance of statics in the environment and robots movement to or away from it and another internal sensor which tells you how much your robot has travelled. Fuse these data together and you have your own SLAM.
Sensors for underwater like Sonar or radar would work.
Localisation is just how your robot understands where it is given a little prior knowledge of the map. (or Environment)

ROS2 SLAM without Lidar


Flatness of relative canonical bundle

Question: I was wondering if there is any general theorem, which guarantees the flatness of $\omega_{X/B}$ over $B$ for a flat morphism $f : X \to B$ of schemes of finite type over $\mathbb{C}$ with equidimensional fibers. I am specially interested in statements which apply to the case of non-reduced $B$. Here by $\omega_{X/B}$ I mean $h^{-n}(f^! \mathcal{O}_B)$ where $n$ is the relative dimension of $f$ and $h^{-n}$ means the cohomology of the complex at the $-n$-th position.
Answer: A sufficient condition is that $f:X \rightarrow B$ is flat and locally finite type map between locally noetherian schemes such that its fibers are local complete intersection morphism (see EGA IV$\_4$, 19.2 for relative lci maps), in which case $\omega_{X/B}$ is even a line bundle on $X$ whose formation commutes with any base change on $B$.  This covers the case of flat families of semistable curves, for example, and this lci condition on fibers is open on the base.
Comment: Thanks for the nice answer and for the precise reference. Is it, by any chance, known for the little more general case of Gorenstein morphisms?
Answer: It sounds like you may want Exercise 9.7 in Hartshorne's "Residues and Duality".  I paraphrase the statement:

Exercise 9.7 (RD):
Let $f: X \to B$ be a flat morphism of finite type of locally Noetherian preschemes.  Then, $f^!(\mathcal{O}_B)$ has a unique non-zero cohomology sheaf, which is flat over $B$, iff all the fibers of $f$ are Cohen-Macaulay schemes of the right dimension.  Moreover $f^!(\mathcal{O}_B)$ is isomorphic to (a shift of) an invertible sheaf (on $X$) iff all the fibers of $f$ are Gorenstein schemes of the right dimension.

In particular, this addresses the case you mention in your comment ($f$ Gorenstein), since then $f^!(\mathcal{O}_Y)$ is locally free on $X$ and, since $f$ is flat, certainly flat over $B$.
[Aside: I believe I learned this reference from Brian's book "Grothendieck Duality and Base Change", which I think also contains a proof of this.]
Comment: Theorem 3.5.1 in my duality book is the reference for a solution to the Exercise 9.7.  (When I wrote my original response I wanted to say the CM case is sufficient, but I didn't remember offhand if the flatness of that sheaf over the base also held.  So I was lazy and just went with lci, which is certainly somewhat restrictive.)

I would guess that assuming just $S_2$ is insufficient, but have no idea on a counterexample.
Comment: Thanks again, so it seems everything works in the CM case. Now the new question is can we weaken it even more. What about $S_r$. I am specially interested in the $S_2$ case.

Flatness of relative canonical bundle


Is every Formal system expressible as a Turing machine and vice versa?

Question: Similarly, does There exist a Turing Machine which takes a Formal system and a string input and returns whether it is a wff or not? Ie it must be a decidable TM. I have heard there are Turing machines that correspond to formal systems, so this leads me to believe this is false, but im not sure. My intuition says you can construct a new formal system through a diagonal argument, proving this machine cannot exist.
Comment: What is your definition of "formal system," precisely?
Comment: A finite set of symbols known as the alphabet, A grammar, a set of axioms, and a set of inference rules. Basically just the standard formalization of "axiomatic system"
Comment: In general axiom systems are not required to be recursively enumerable - do you want your formal systems to be?
Comment: I want a TM that can take in a formal system and a string and tell if it is provable. Im just wondering if this is some halting problem or Accepts(A) problem in disguise.
Comment: How is a formal system presented to the Turing machine? Are you demanding that formal systems be somehow "finitely generated"? (Actually it's moot, the answer even for nice formal systems is no, but this is still a point you need to realize requires a precise definition.)
Answer: In a comment above, the OP clarifies:

I want a TM that can take in a formal system and a string and tell if it is provable.

First, note that this question is ill-posed: what is a "formal system" and what does it mean for a TM to "take [one] in"? Even if we take "formal system" to mean "first-order theory," which is reasonable, the second question is still problematic: a general first-order theory is a very infinite object, so there's no way in general to treat a theory as an input to a Turing machine.
So we need to restrict attention to "finitely describable" theories. One very good candidate notion is the finitely (equivalently, singly) axiomatizable theories; another significantly broader one is the recursively enumerable theories (here we really talk about codes for the theory rather than the theory itself).
Either way, however, the answer to your question is no. Indeed, this is true even for individual seemingly-nice formal systems, like (first-order) Peano arithmetic (or even much weaker theories of arithmetic): the set of theorems of Peano arithmetic is not computable.
This is a consequence of Godel's incompleteness theorem (or more precisely, its later improvement by Rosser).
Roughly speaking, Godel says that if $T$ is a consistent and recursively enumerable theory which is "strong enough to encode basic arithmetic" (this can be made precise, I'm just avoiding doing that), then $T$ is not complete. This isn't immediately what you're asking about; however, it does have as a quick corollary that if $T$ is such a theory then there is no algorithm for determining whether a given sentence is provable in $T$.
Why? Well, if there were, we could use a kind of greedy algorithm to build a recursive completion of $T$:

Enumerate the sentences in our language as $\varphi_i$ ($i\in\mathbb{N}$).
Define a sequence of sentences $\psi_i$ $(i\in\mathbb{N}$) inductively as follows:

If $\varphi_0$ is a theorem of $T$, then $\psi_0=\varphi_0$; otherwise $\psi_0=\neg\varphi_0$.
Having defined $\psi_i$ for all $i<n$: if $(\psi_0\wedge\psi_1\wedge...\wedge\psi_{n-1})\rightarrow\varphi_n$ is a theorem of $T$, then $\psi_n=\varphi_n$; otherwise $\psi_n=\neg\varphi_n$.

It's now easy to check that the theory $T\cup\{\psi_i:i\in\mathbb{N}\}$ is complete, consistent, recursively enumerable, and extends $T$; and this contradicts Godel.

That said, if $T$ is a recursively enumerable theory (equivalently, a recursively axiomatizable theory), then the set of $T$-theorems is recursively enumerable - not quite as good as recursive, but still much better than nothing. And here we do more-or-less have an equivalence: every r.e. set is of equivalent complexity to the set of theorems of some r.e. theory (indeed, of some finitely axiomatizable theory). So there is a "computations/theories connection," it's just a bit more complicated.