text:
# Mock exam paper - solutions¶

## Question 1¶

### (a) definition of a Normal form game:¶

An $N$ player normal form game consists of:

• A finite set of $N$ players
• Strategy spaces for the players: $\{S_1,S_2,S_3,\dots,S_N\}$;
• Payoff functions for the players: $u_i:S_1\times S_2\dots\times S_N\to\mathbb{R}$

[2]

### (b) utilities of strategies¶

(i) $$\sigma_r A \sigma_c = 1\qquad \sigma_r B \sigma_c = 1$$ [1]

(ii) $$\sigma_r A \sigma_c = 3/2\qquad \sigma_r B \sigma_c = 5/3$$ [1]

(iii) $$\sigma_r A \sigma_c = 7/4\qquad \sigma_r B \sigma_c = 5/2$$ [1]

Some code to verify:

In [1]:
import numpy as np
A, B = np.array([[3, 1], [0, 2]]), np.array([[2, 1], [0, 3]])
strategies = [(np.array([1, 0]), np.array([0, 1])),
(np.array([1/2, 1/2]), np.array([1/3, 2/3])),
(np.array([1/4, 3/4]), np.array([0, 1]))]
for sigma_r, sigma_c in strategies:
print(np.dot(sigma_r, np.dot(A, sigma_c)), np.dot(sigma_r, np.dot(B, sigma_c)))

1 1
1.5 1.66666666667
1.75 2.5

### (c) define LH¶

For a nondegenerate 2 player game $(A, B)\in{\mathbb{R}^{m\times n}_{>0}}^2$ the following algorithm returns all nash equilibria:

1. Start at the artificial equilibrium: $(0, 0)$ [1]
2. Choose a label to drop. [1]
3. Remove this label from the corresponding vertex by traversing an edge of the corresponding polytope to another vertex. [1]
4. The new vertex will now have a duplicate label in the other polytope. Remove this label from the vertex of the other polytope and traverse an edge of that polytope to another vertex. [1]
5. Repeat step 4 until the pair of vertices is fully labelled. [1]

### (d) obtain best response polytopes¶

We start by scaling $A, B$:

$$A \to A + 1 = \begin{pmatrix}4&2\\1&3\end{pmatrix} \qquad B \to B + 1 =\begin{pmatrix}3&2\\1&4\end{pmatrix}$$

The row player best response polytope $\mathcal{P}$ is defined by $x\geq0, xB\leq 1$:

$$x_1 \geq 0\\ x_2 \geq 0\\ 3x_1+x_2 \leq 1\\ 2x_1+4x_2 \leq 1$$

which corresponds to:

$$x_1 \geq 0\\ x_2 \geq 0\\ x_2 \leq 1 - 3x_1\\ x_2 \leq 1/4-1/2x_1$$

[1]

The vertices (and their corresponding labels) are then given by:

• $a=(0, 0)$ with labels: $\{0, 1\}$
• $b=(1/3, 0)$ with labels: $\{1, 2\}$
• $c=(0, 1/4)$ with labels: $\{0, 3\}$
• $d=(3/10, 1/10)$ with labels: $\{2, 3\}$

[1]

The column player best response polytope $\mathcal{Q}$ is defined by $Ax\leq 1, x\geq0$:

$$4x_1+2x_2 \leq 1\\ x_1+3x_2 \leq 1\\ x_1 \geq 0\\ x_2 \geq 0\\$$

which corresponds to:

$$x_2 \leq 1/2 - 2x_1\\ x_2 \leq 1/3-1/3x_1\\ x_1 \geq 0\\ x_2 \geq 0$$

[1]

The vertices (and their corresponding labels) are then given by:

• $w=(0, 0)$ with labels: $\{2, 3\}$
• $x=(1/4, 0)$ with labels: $\{0, 3\}$
• $y=(0, 1/3)$ with labels: $\{1, 2\}$
• $z=(1/10, 3/10)$ with labels: $\{0, 1\}$

[1]

### (e) Drawing the best response polytope¶

[1] mark for each polytope.

In [2]:
%matplotlib inline

import matplotlib.pyplot as plt
import numpy as np
import scipy.spatial

V = [np.array([0, 0]), np.array([1 / 3, 0]), np.array([0, 1 / 4]), np.array([3/10, 1/10])]
P = scipy.spatial.ConvexHull(V)
scipy.spatial.convex_hull_plot_2d(P)
plt.title("$\mathcal{P}$")
plt.text(0.001, .1, "Label: 0")
plt.text(0.15, .005, "Label: 1")
plt.text(0.15, .18, "Label: 3")
plt.text(0.26, .05, "Label: 2")
for v, s in zip(V, "abcd"):
plt.text(v[0] + 0.001, v[1] + 0.001, s);

In [3]:
V = [np.array([0, 0]), np.array([1 / 4, 0]), np.array([0, 1 / 3]), np.array([1/10, 3/10])]
Q = scipy.spatial.ConvexHull(V)
scipy.spatial.convex_hull_plot_2d(Q)
plt.title("$\mathcal{Q}$")
plt.text(0.001, .15, "Label: 2")
plt.text(0.10, .005, "Label: 3")
plt.text(0.05, .32, "Label: 1")
plt.text(0.2, .1, "Label: 0")
for v, s in zip(V, "wxyz"):
plt.text(v[0] + 0.001, v[1] + 0.001, s);

### (f) Carrying out the LH algorithm¶

Using the plot we can carry out the Lemke-Howson algorithm:

• Dropping label 0:

• $(a, w)$ have labels $\{0, 1\}, \{2, 3\}$. Drop 0.
• $\to (b, w)$ have labels $\{1, 2\}, \{2, 3\}$. In $\mathcal{Q}$ drop 2.
• $\to (b, x)$ have labels $\{1, 2\}, \{0, 3\}$. Fully labeled vertex pair.
• Dropping label 1:

• $(a, w)$ have labels $\{0, 1\}, \{2, 3\}$. Drop 1.
• $\to (c, w)$ have labels $\{0, 3\}, \{2, 3\}$. In $\mathcal{Q}$ drop 3.
• $\to (c, y)$ have labels $\{0, 3\}, \{1, 2\}$. Fully labeled vertex pair.
• Dropping label 2:

• $(a, w)$ have labels $\{0, 1\}, \{2, 3\}$. Drop 2.
• $\to (a, x)$ have labels $\{0, 1\}, \{0, 3\}$. In $\mathcal{P}$ drop 0.
• $\to (b, x)$ have labels $\{1, 2\}, \{0, 3\}$. Fully labeled vertex pair.
• Dropping label 3:

• $(a, w)$ have labels $\{0, 1\}, \{2, 3\}$. Drop 3.
• $\to (a, y)$ have labels $\{0, 1\}, \{1, 2\}$. In $\mathcal{P}$ drop 1.
• $\to (c, y)$ have labels $\{0, 3\}, \{1, 2\}$. Fully labeled vertex pair.

[2]

We see that we have obtained two equilibria:

$$(b, x) = ((1/3, 0), (1/4, 0))$$$$(c, y) = ((0, 1/4), (0, 1/3))$$

which gives the following two Nash equilibria:

$$((1, 0), (1, 0))$$$$((0, 1), (0, 1))$$

[2]

Some code to verify:

In [4]:
import nashpy as nash
A, B = np.array([[3, 1], [0, 2]]), np.array([[2, 1], [0, 3]])
game = nash.Game(A, B)
for label, eq in enumerate(game.lemke_howson_enumeration()):
print(label, eq)

0 (array([ 1.,  0.]), array([ 1.,  0.]))
1 (array([ 0.,  1.]), array([ 0.,  1.]))
2 (array([ 1.,  0.]), array([ 1.,  0.]))
3 (array([ 0.,  1.]), array([ 0.,  1.]))

### (g) Using a different initial vertex pair¶

• $(b, x)$ has labels $\{1, 2\}, \{0, 3\}$. Drop 3.
• $\to (b, z)$ have labels $\{1, 2\}, \{0, 1\}$. In $\mathcal{P}$ drop 1.
• $\to (d, y)$ have labels $\{2, 3\}, \{0, 1\}$. Fully labeled vertex pair.

[1]

This gives the Nash equilibria:

$$((3/4, 1/4), (1/4, 3/4))$$

some code to verify the result:

In [5]:
list(game.vertex_enumeration())

Out[5]:
[(array([ 1.,  0.]), array([ 1.,  0.])),
(array([ 0.,  1.]), array([ 0.,  1.])),
(array([ 0.75,  0.25]), array([ 0.25,  0.75]))]

### (h) Sketch of proof¶

• We know that there is a path between $(0, 0)$ and a fully labelled vertex pair. [1]
• Similarly, from a fully labelled vertex pair we can assume that it's possible to drop another fully labelled vertex pairs. [1]
• We can construct a graph of pairs of fully labelled vertex pairs. [1]
• As we have pairs this corresponds to an even number of fully labelled vertex pairs. Removing $(0, 0)$ this implies there is an odd number of Nash equilibria. [1]

## Question 2¶

### (a) Definition of a Prisoner's Dilemma (bookwork)¶

$$A = \begin{pmatrix} R & S\\ T & P \end{pmatrix}\qquad B = \begin{pmatrix} R & T\\ S & P \end{pmatrix}$$

with the following constraints:

$$T > R > P > S$$$$2R > T + S$$

[2]

### (b) Finding valid Prisoner's Dilemmas¶

(i)

For $A, B$ to be valid we need:

$$\begin{pmatrix} 3 & S\\ 5 & 1 \end{pmatrix} = \begin{pmatrix} R & S\\ T & P \end{pmatrix}$$

which gives: $R=3, T=5, P=1$

further more:

$$\begin{pmatrix} 3 & T\\ -1 & 1 \end{pmatrix} = \begin{pmatrix} R & T\\ S & P \end{pmatrix}$$

[2]

which gives: $R=3, S=-1, P=1$

Thus we have (R, S, P, T) = (3, -1, 1, 5) which also follows the two required inequalities:

$$T > R > P > S \Leftrightarrow 5 > 3 > 1 > -1$$$$2R > T + S \Leftrightarrow 6 > 4$$

[2]

(ii)

For $A, B$ to be valid we need:

$$\begin{pmatrix} 2 & S\\ -2 & 1 \end{pmatrix} = \begin{pmatrix} R & S\\ T & P \end{pmatrix}$$

which gives: $R=2, T=-2, P=1$

We immediately see that $R > T$ so this cannot be a Prisoner's Dilemma.

[4]

### (c) Markov chain representation of a reactive player match¶

$$M = \begin{pmatrix} 3/10 & 3/10 & 1/5 & 1/5\\ 3/8 & 3/8 & 1/8 & 1/8\\ 3/20 & 9/20 & 1/10 & 3/10\\ 3/16 & 9/16 & 1/16 & 3/16\\ \end{pmatrix}$$

### (d) Expected utility (bookwork)¶

The first player:

$$s_1s_2\times R + s1(1-s_2) \times S + (1-s_1)s_2 \times T + (1-s_1)(1-s_2)\times P$$

The second player:

$$s_1s_2\times R + s1(1-s_2) \times T + (1-s_1)s_2 \times S + (1-s_1)(1-s_2)\times P$$

where:

$$s_1 = \frac{q_2r_1+p_2}{1-r_1r_2}\qquad s_2 = \frac{p_2r_2+q_2}{1-r_1r_2}$$

for:

$$r_1=p_1-p_2\qquad r_2=q_1-q_2$$

### (e) Expected utility for specific type of player¶

We have:

$$r_1=x-x/2=x/2\qquad r_2=1/2-1/4=1/4$$

thus

$$s_1 = \frac{1/4x/2+x/2}{1-x/8}=\frac{5x}{8-x}\qquad s_2 = \frac{1/4x/2+1/4}{1-x/8}=\frac{x+2}{8-x}$$

Direct substitution gives:

$$\frac{5x(x+2)}{(8-x)^2}\times R + \frac{5x(6-2x)}{(8-x)^2} \times S + \frac{(8-6x)(x+2)}{(8-x)^2} \times T + \frac{(8-6x)(6-2x)}{(8-x)^2}\times P$$

expanding:

$$\frac{R\times(5x^2+10x) + S\times (35x-10x^2) + T\times (-6x^2+16-4x) + P\times (48-52x+12x^2)}{(8-x)^2}$$

substituting $(R, S, T, P)=(3, 0, 4, 1)$:

$$\frac{3x^2 - 38x + 112}{(8-x)^2}$$

factorising the $(8-x)$ term gives:

$$\frac{(8-x)(14-3x)}{(8-x)^2}= \frac{\left(3 x-14\right)}{\left(x - 8\right)}$$

Some code to verify the calculations:

In [6]:
import sympy as sym
x, R, S, T, P = sym.symbols("x, R, S, T, P")

expr = R * (5 * x ** 2 + 10 * x) + S * (35 * x - 10 * x ** 2) + T * (-6 * x ** 2 + 16 - 4 * x) + P *(48 - 52 * x + 12 * x ** 2)

In [7]:
expr.subs({R:3, S:0, T:4, P:1}).factor()

Out[7]:
(x - 8)*(3*x - 14)
In [8]:
import numpy as np

r_1 = p[0] - p[1]
r_2 = q[0] - q[1]
s_1 = (q[1] * r_1 + p[1]) / (1 - r_1 * r_2)
s_2 = (p[1] * r_2 + q[1]) / (1 - r_1 * r_2)
return np.array([s_1 * s_2, s_1 * (1 - s_2), (1 - s_1) * s_2, (1 - s_1) * (1 - s_2)])

def theoretic_utility(p, q, rstp=np.array([3, 0, 5, 1])):
return np.dot(pi, rstp)

In [9]:
p = np.array([x, x / 2])
q = np.array([sym.S(1) / 2, sym.S(1) / 4])
expr = theoretic_utility(p=p, q=q, rstp=np.array([3, 0, 4, 1]))
sym.factor(expr)

Out[9]:
(3*x - 14)/(x - 8)

Here is a plot of the utility (calculated both ways)

Note that this is not requested in the question: just here to help understanding.

In [10]:
xs = np.linspace(0, 1, 25)
ys = [theoretic_utility(p=[x, x / 2], q=q, rstp=np.array([3, 0, 4, 1])) for x in xs]
simplified_ys = [(3 * x - 14) / (x - 8) for x in xs]
plt.plot(xs, ys, label="$u(x)$")
plt.scatter(xs, simplified_ys, label="$\\frac{3x-14}{x-8}$")
plt.legend();

### (f) Identifying the optimal behaviour¶

Direct differentiating gives:

$$\frac{3x - 24 - (3x - 14)}{\left(x - 8\right)^2}=\frac{-10}{\left(x - 8\right)^{2}}$$

[2]

simplifying gives the required result.

We see that our function is decreasing for all values of $x$ (it has negative derivative). Thus, the optimal value of $x$ is $0$.

[2]

In [11]:
sym.factor(expr.diff(x))

Out[11]:
-10/(x - 8)**2

## Question 3¶

### (a) Defining equations (bookwork)¶

The matrix $A$ correspods to the utility of a row player in a game where the row player is a given individual and the column player is the population.

This gives:

$$f_1=ax_1+bx_2\qquad f_2=cx_1+dx_2$$

[1]

or equivalently:

$$f=Ax\qquad \phi=fx$$

thus we have the same equation as before but in matrix notation:

$$\frac{dx}{dt}=x(f-\phi)$$

[1]

### (b) Defining mutated population (bookwork)¶

Given a strategy vector $x=(x_1, x_2)$, some $\epsilon>0$ and another strategy $y=(y_1, y_1)$, the post entry population $x_{\epsilon}$ is given by:

$$x_{\epsilon} = (x_1 + \epsilon(y_1 - x_1), x_2 + \epsilon(y_2 - x_2))$$

[2]

### (c) Defining an evolutionary stable strategy (bookwork)¶

Given a stable population distribution, $x$ it represents an Evolutionary Stable Strategy (ESS) if and only if there exists $\bar\epsilon>0$:

$$u(x, x_{\epsilon})>u(y, x_{\epsilon})\text{ for all }0<\epsilon<\bar\epsilon, y$$

[1]

where $u(x, y)$ corresponds to the fitness of strategy $x$ in population $y$ which is given by:

$$xAy^T$$

[1]

### (d) Proof of result for ESS (bookwork)¶

Theorem:

If $x$ is an ESS, then for all $y\ne x$, either:

1. $u(x,x)>u(y,x)$
2. $u(x,x)=u(y,x)$ and $u(x,y)>u(y,y)$

Conversely, if either (1) or (2) holds for all $y\ne x$ then $x$ is an ESS.

[2]

Proof:

If $x$ is an ESS, then by definition:

$$u(x,x_{\epsilon})>u(y,x_{\epsilon})$$

which corresponds to:

$$(1-\epsilon)u(x,x)+\epsilon u(x,y)>(1-\epsilon)u(y,x)+\epsilon u(y,y)$$
• If condition 1 of the theorem holds then the above inequality can be satisfied for $\epsilon$ sufficiently small. If condition 2 holds then the inequality is satisfied.
• Conversely:

• If $u(x,x) < u(y,x)$ then we can find $\epsilon$ sufficiently small such that the inequality is violated. [1]

• If $u(x, x) = u(y,x)$ and $u(x,y) \leq u(y,y)$ then the inequality is violated. [1]

### (e) Obtain all ESS for a 2 by 2 game¶

First step is to identify the Nash equilibria. Identify best responses for the associated two player game $(A, A^T)$:

$$A=\begin{pmatrix} 1&\underline{4}\\ \underline{2}&1 \end{pmatrix}\qquad A^T=\begin{pmatrix} 1&\underline{2}\\ \underline{4}&1 \end{pmatrix}$$

[1]

This immediately gives 2 pure Nash equilibria, however they are not symmetrix so are not:

$$(\sigma_r, \sigma_c) \in \{((1, 0), (0, 1)), ((0, 1), (1, 0))\}$$

To find the remaining Nash equilibria, we use the support enumeration algorithm which gives:

$${\sigma_r}_1 + 4{\sigma_r}_2 = 2{\sigma_r}_1 + {\sigma_r}_2$$$${\sigma_c}_1 + 4{\sigma_c}_2 = 2{\sigma_c}_1 + {\sigma_c}_2$$

This gives:

$$3{\sigma_r}_2 = {\sigma_r}_1$$

which gives, a final Nash equilibrium of:

$$x = (3/4, 1/4)$$

[2]

some code to verify this:

In [12]:
A = np.array([[1, 4], [2, 1]])
game = nash.Game(A, A.transpose())
list(game.support_enumeration())

Out[12]:
[(array([ 1.,  0.]), array([ 0.,  1.])),
(array([ 0.,  1.]), array([ 1.,  0.])),
(array([ 0.75,  0.25]), array([ 0.75,  0.25]))]

Considering this final equilibria, we have:

$$u(x, x)=u(y, x)\text{ for all }y$$

Applying the theorem we thus consider:

$$u(x, y)=(5/4)y_1 + (13/4)y_2=(5/4)y_1 + (13/4)(1-y_1)=-2y_1+13/4$$\begin{align} u(y, y)&=y_1^2+4y_1y_2+2y_1y_2+y_2^2\\ &=y_1^2+6y_1-6y_1^2+1 - 2y_1 + y_1^2\\ &=1+4y_1-4y_1^2 \end{align}

Thus:

$$u(x, y) - u(y, y) = 4y_1^2 - 6y_1+9/4 = 4(y_1 - 3/4)^2$$

[2]

however $y_1\ne3/4$ thus $x=(3/4, 1/4)$ is an ESS.

### (f) Discussing the research paper¶

• (i) This paper looks at GT and cancer: it is a proof of concept sitting in literature that already exists on the subject. The main result is confirming intuitive understanding of proliferation/motility. Increased nutrients implies less motility. This is done in two ways: a theoretic game and a simulation. [3]
• (ii) The game matrix should in fact be: $\begin{pmatrix}b/2 & b - c\\ b & b - c / 2\end{pmatrix}$ [2]
• (iii) The theorem is used in the paper, although it is not done explicitly it is used to implictely describe the stability of the equilibria. [2]
• (iv) Another approach would be to use a Moran process. The main difference with the approach in the paper would be to use a Moran process. This would correspond to considering a finite population size as opposed to the infinite population model used. This would correspond more closely to the simulation model used in the paper. [3]

## Question 4¶

### (a) Definition of a Moran process on a game¶

Consider a matrix $A\in\mathbb{R}^{m\times n}$ representing a game with two strategies.

$$A= \begin{pmatrix} a & b\\ c & d \end{pmatrix}$$

The Moran process is as follows:

• At a given time step: all individuals play all other individuals.
• Obtain their fitness as given by the game.
• Randomly select an individual proportional to their fitness as an individual to be reproduced
• Uniformly select an individual to be replaced
• Proceed to the next time step.
• The process terminates when there is only one type of individual in the population.

### (b) Theorem¶

Theorem: Fixation probabilities for the birth death process

Given a birth death process as defined above, the fixation probability $x_i$ is given by:

$$x_i=\frac{1+\sum_{j=1}^{i-1}\prod_{k=1}^j\gamma_k}{1+\sum_{j=1}^{N-1}\prod_{k=1}^j\gamma_k}$$

where:

$$\gamma_k = \frac{p_{k,k-1}}{p_{k,k+1}}$$

Proof

We have:

\begin{align} p_{i,i+1}x_{i+1} & = -p_{i,i-1}x_{i-1} + x_i(1 - p_{ii}) \\ p_{i,i+1}x_{i+1} & = p_{i,i-1}(x_{i} - x_{i-1}) + x_ip_{i,i+1} \\ x_{i+1} - x_i & = \frac{p_{i, i-1}}{p_{i, i+1}}(x_i-x_{i-1})=\gamma_i(x_i-x_{i-1}) \end{align}

We observe that:

\begin{align} x_2 - x_1 &= \gamma_1(x_1-x_{0})=\gamma_1x_1\\ x_3 - x_2 &= \gamma_2(x_2-x_1)=\gamma_2\gamma_1x_1\\ x_4 - x_3 &= \gamma_3(x_3-x_2)=\gamma_3\gamma_2\gamma_1x_1\\ &\; \vdots & \\ x_{i+1} - x_i &= \gamma_i(x_i-x_{i-1})=\prod_{k=1}^i\gamma_kx_1\\ &\; \vdots & \\ x_{N} - x_{N-1} &= \gamma_{N-1}(x_{N-1}-x_{N-2})=\prod_{k=1}^{N-1}\gamma_kx_1\\ \end{align}

thus we have:

$$x_i=\sum_{j=0}^{i-1}x_{j+1}-x_j=\left(1+\sum_{j=1}^{i-1}\prod_{k=1}^j\gamma_k\right)x_1$$

we complete the proof by solving the following equation to obtain $x_1$:

$$x_N=1=\left(1+\sum_{j=1}^{N-1}\prod_{k=1}^j\gamma_k\right)x_1$$

### (c) Moran process for the game¶

Assuming $i$ individuals of the first type, for this game we have $N=5$ and $(a, b, c, d)=(4, 1, 6, 2)$ the fitness of both types is given respectively by:

$$f_{1i}=\frac{a(i-1)+b(N-i)}{N-1}=\frac{4i-4+5-i}{4}=\frac{3i+1}{4}$$$$f_{2i}=\frac{c(i)+d(N-i-1)}{N-1}=\frac{6i+2(4-i)}{4}=\frac{4i+8}{4}=i$$

which gives:

$$\gamma_i=\frac{f_{2i}}{f_{1i}}=\frac{4i+8}{3i+1}$$

thus:

$$x_1=\frac{1}{1+\sum_{j=1}^{4}\prod_{k=1}^j\frac{4k+8}{3k+1}}=\frac{1}{1+3+3(16/7)+3(16/7)2+3(16/7)2(24/13)}=\frac{91}{4540}$$$$x_{4}=\frac{1+\sum_{j=1}^{3}\prod_{k=1}^j\frac{4k+8}{3k+1}}{1+\sum_{j=1}^{4}\prod_{k=1}^j\frac{4k+8}{3k+1}}=\frac{1+3+3(16/7)+3(16/7)2}{1+3+3(16/7)+3(16/7)2+3(16/7)2(24/13)}=\frac{559}{1135}$$

Thus the two fixation probabilities $x_1$ are:

• Cooperation: $\frac{91}{4540}\approx 0.02$
• Defection $1-\frac{559}{1135}=\frac{576}{1135}\approx 0.51$

Some code to verify the result:

In [13]:
def theoretic_fixation(N, game, i=1):
"""
Calculate x_i as given by the above formula
"""
f_ones = np.array([(game[0, 0] * (i - 1) + game[0, 1] * (N - i)) / (N - 1) for i in range(1, N)])
f_twos = np.array([(game[1, 0] * i + game[1, 1] * (N - i - 1)) / (N - 1) for i in range(1, N)])
gammas = f_twos / f_ones
return (1 + np.sum(np.cumprod(gammas[:i-1]))) / (1 + np.sum(np.cumprod(gammas)))

In [14]:
import sympy as sym
game = np.array([[sym.S(4), sym.S(1)], [sym.S(6), sym.S(2)]])
theoretic_fixation(N=5, game=game), 1- theoretic_fixation(N=5, game=game, i=4)

Out[14]:
(91/4540, 576/1135)
In [15]:
[float(x) for x in _]

Out[15]:
[0.020044052863436124, 0.507488986784141]

### (d) Game for TfT vs Alternator¶

The history of 5 turns would give between TfT and Alternator

1. TfT: C Alternator: C with scores: (4, 4)
2. TfT: C Alternator: D with scores: (1, 6)
3. TfT: D Alternator: C with scores: (6, 1)
4. TfT: C Alternator: D with scores: (1, 6)
5. TfT: D Alternator: C with scores: (6, 1)

The history of 5 turns would give between TfT and TfT

1. TfT: C TfT: C with scores: (4, 4)
2. TfT: C TfT: C with scores: (4, 4)
3. TfT: C TfT: C with scores: (4, 4)
4. TfT: C TfT: C with scores: (4, 4)
5. TfT: C TfT: C with scores: (4, 4)

The history of 5 turns between Alternator and Alternator:

1. Alternator: C Alternator: C with scores: (4, 4)
2. Alternator: D Alternator: D with scores: (2, 2)
3. Alternator: C Alternator: C with scores: (4, 4)
4. Alternator: D Alternator: D with scores: (2, 2)
5. Alternator: C Alternator: C with scores: (4, 4)

Summing these, the payoff matrix is thus given by:

$$\begin{pmatrix} 20 & 18 \\ 18 & 16\\ \end{pmatrix}$$

### (e) Moran calculations¶

Repeating the previous calculations:

$$f_{1i}=\frac{a(i-1)+b(N-i)}{N-1}=\frac{20(i - 1) + 18(5-i)}{4}=\frac{2i+70}{4}$$$$f_{2i}=\frac{c(i)+d(N-i-1)}{N-1}=\frac{18i+16(4-i)}{4}=\frac{2i+64}{4}=i$$

which gives:

$$\gamma_i=\frac{f_{2i}}{f_{1i}}=\frac{2i+64}{2i+70}$$

thus:

$$x_1=\frac{1}{1+\sum_{j=1}^{4}\prod_{k=1}^j\frac{2k+64}{2k+70}}=\frac{1}{1+11/12+(11/12)(34/37)+(11/12)(34/37)(35/38)+(11/12)(34/37)(35/38)(12/13)}=\frac{247}{1050}$$$$x_4=\frac{1+\sum_{j=1}^{3}\prod_{k=1}^j\frac{2k+64}{2k+70}}{1+\sum_{j=1}^{4}\prod_{k=1}^j\frac{2k+64}{2k+70}}=\frac{1+11/12+(11/12)(34/37)+(11/12)(34/37)(35/38)}{1+11/12+(11/12)(34/37)+(11/12)(34/37)(35/38)+(11/12)(34/37)(35/38)(12/13)}=\frac{923}{1110}$$

Thus the two fixation probabilities $x_1$ are:

• TfT: $\frac{247}{1050}\approx 0.24$
• Alternator $1-\frac{923}{1110}=\frac{187}{1110}\approx 0.17$

Some code to verify the result:

In [16]:
game = np.array([[sym.S(20), sym.S(18)], [sym.S(18), sym.S(16)]])
theoretic_fixation(N=5, game=game), 1 - theoretic_fixation(N=5, game=game, i=4)

Out[16]:
(247/1050, 187/1110)
In [17]:
[float(x) for x in _]

Out[17]:
[0.23523809523809525, 0.16846846846846847]
Previous

Next


text:
# Changing the index of a summation for probability density functions

I'm trying to solve a problem on Prasanna Sahoo's book on Probability and Statistics. One problem assumes that $X$ is a random variable with probability density function $$f(x)=\frac{2c}{3^{x}}$$ for $x=1,2,3,...,\infty$ where $c$ is constant. According to the answer key, the value of $c$ is 1. Since $x$ is countable, then an infinite series must be used. Also, by a theorem, its summation must be equal to 1. So we have the equation $$\sum_{x=1}^{\infty}\frac{2c}{3^{x}}=1.$$ The summation above is a geometric series. Hence we can use the formula $$\sum_{n=1}^{\infty}ar^{n}=\frac{a}{1-r}.$$ However, $$\sum_{x=1}^{\infty}\frac{2c}{3^{x}}=\sum_{x=1}^{\infty}2c\Big(\frac{1}{3}\Big)^{x}=\frac{2c}{1-1/3}=1.$$ Thus, $c=1/3$. This does not coincide with the answer stated at the back of the book. One solution that I thought of is by changing the index of the summation, as follows: $$\sum_{x=1}^{\infty}\frac{2c}{3^{x}}=\sum_{x=0}^{\infty}\frac{2}{3}\Big(\frac{1}{3}\Big)^x.$$ From here, we can let $a=2/3$ and $r=1/3$, which will make $c=1$. However, I can't justify the change in the index of summation. Some textbooks use $n=1$ in the summation of an infinite geometric series, while some use $n=0$. I haven't found an article stating the difference between the two indexes when considering a probability density function.

You missed the first term in the formula of sum of decreasing GP is: $$S=\color{red}{\frac13}+\frac{1}{3^2}+\cdots =\frac{\color{red}{\frac13}}{1-\frac13}=\frac12.$$ Hence $c=1$.

Hint:

$$\sum_{x=1}^n r^x=r\cdot \frac{1-r^n}{1-r}=r\cdot \left(\frac{1}{1-r}-\frac{r^n}{1-r} \right)$$

For $|r|<1$

$$\lim_{n\to \infty}r\cdot \left(\frac{1}{1-r}-\frac{r^n}{1-r} \right)= \frac{r}{1-r}$$

Another (classical) version of the partial sum is

$$\sum_{x=\color{red}0}^{\color{red}{n-1}} r^x= \frac{1-r^n}{1-r}=\frac{1}{1-r}-\frac{r^n}{1-r}$$

For $|r|<1$

$$\lim_{n\to \infty} \frac{1}{1-r}-\frac{r^n}{1-r} = \frac{1}{1-r}$$

The different of the two versions are the upper bounds and lower bounds of the partial sums. In both cases the number of summands are $n$

• Why did you use the formula for partial sums instead of an infinite series? There's an obvious difference, but I honestly don't understand the difference. – Liam Ceasar Feb 22 '18 at 10:20
• @LiamCeasar I have used the partial sum formula to show how the formula of the infinite case is derived. Yes there is a difference what you have posted, which was not right. Please ask a specific question what do you not understand about my answer. I will give an reply. – callculus Feb 22 '18 at 10:32
• I mean why was r/(1-r) derived instead of using the classic formula a/(1-r) for an infinite series? – Liam Ceasar Feb 22 '18 at 10:38
• @LiamCeasar I will make an edit. – callculus Feb 22 '18 at 10:40
• @LiamCeasar I´ve finished the edit. – callculus Feb 22 '18 at 10:48

format: plain


text:
# Portal:Electronics

## The Electronics Portal

Modern surface-mount electronic components on a printed circuit board, with a large integrated circuit at the top.

The field of electronics is a branch of physics and electrical engineering that deals with the emission, behaviour and effects of electrons using electronic devices. Electronics uses active devices to control electron flow by amplification and rectification, which distinguishes it from classical electrical engineering, which only uses passive effects such as resistance, capacitance and inductance to control electric current flow.

Electronics has hugely influenced the development of modern society. The central driving force behind the entire electronics industry is the semiconductor industry sector, which has annual sales of over $481 billion as of 2018. The largest industry sector is e-commerce, which generated over$29 trillion in 2017. (Full article...)

## Good articles - load new batch

These are Good articles, which meet a core set of high editorial standards.

## Selected biography

Nikola Tesla (10 July 1856 - 7 January 1943) was an inventor, electrical and mechanical engineer known for his patents and theoretical work that contributed to modern alternating current electric power (AC) systems, including the polyphase power distribution systems and the AC induction motor. His contribution was recognized and the derived SI unit measuring magnetic flux density or magnetic induction (commonly known as the magnetic field ${\displaystyle B\,}$), the tesla, was named in his honor.

## Selected article

Capacitance is a measure of the amount of electric charge stored (or separated) for a given electric potential. The capacitance of the majority of capacitors used in electronic circuits is several orders of magnitude smaller than the farad. The energy (measured in joules) stored in a capacitor is equal to the work done to charge it.

${\displaystyle C={\frac {Q}{V}}}$

In a capacitor, there are two conducting electrodes which are insulated from one another. The charge on the electrodes is +Q and -Q, and V represents the potential difference between the electrodes. The SI unit of capacitance is the farad; 1 farad = 1 coulomb per volt.

${\displaystyle C=\epsilon {\frac {A}{d}}}$

The capacitance can be calculated if the geometry of the conductors and the dielectric properties of the insulator between the conductors are known, such as above, where; C is the capacitance in farads, ε is the permittivity of the insulator used (or ε0 for a vacuum), A is the area of each plane electrode in square metres, d is the separation between the electrodes in metres. The equation is a good approximation if d is small compared to the other dimensions of the electrodes.

## Consumer showcase

Columbia is a supercomputer built by Silicon Graphics for NASA. The supercomputer was installed at the NASA Advanced Supercomputing facility in 2004. According to the TOP500 list, it is currently the eighth fastest computer in the world running at 51.87 teraflops, or 51.87 trillion floating point calculations per second. It is composed of twenty SGI Altix 3000 nodes each of which have 512 Intel Itanium 2 processors bringing the total number of processors to 10,240. It was named in honour of the crew of the Space Shuttle Columbia.

## Subcategories

Select [►] to view subcategories

## Associated Wikimedia

The following Wikimedia Foundation sister projects provide more on this subject:

Discover Wikipedia using portals


text:
# Why do some things resonate more than others? - How does resonance work?

Why do some things resonate more than others? I was holding a guitar next to a bass amplifier, when the bass hit the string at a certain note, the same note began to vibrate in the guitar. If I pressed certain strings in the guitar, the bass strings in the guitar, the chord vibrated too without having to pluck it. However, if I did the same for the thin strings I didn't see much vibration (maybe there was and I didn't perceive it). Why doesn't it vibrate the same if they have both the same frequency as the source?

• The question is clear and makes sense. – Bill N Nov 3 '17 at 20:35
• Also note that the guitar body is not intended to be a resonator, but a phase inverter (a bass reflex system) while the guitar top matches the impedance of the strings to the impedance of the air. Both the body and top ensure the maximum energy transfer not only from the strings to the air, but also from the air to the strings. This explains your guitar reacting to the external sound. A more detailed explanation is here: physics.stackexchange.com/questions/365557/… – safesphere Nov 4 '17 at 5:05

The structure of some systems is such that admitted energy can flow internally between different forms at a regular frequency (potential and kinetic or electrical and magnetic as examples) with minor energy losses. Or else the rate of loss of energy is no greater than the rate at which it is driven. These are known as resonant, high-Q systems, systems whose structures do not include means for dissipating energy input say in the form of heat. Resonant systems can feed off external energy, particularly if the energy is supplied at the same natural frequency as the system itself.

Two identical mechanical systems are thus said to vibrate sympathetically with one another by the transfer of energy, say from your example through sound waves. But the same can happen between radio transmission and receiving circuits by means of electromagentic wave transmission.

When two high Q systems have different natural frequencies, one system that transmits energy between them by whatever means will likely not trap and excite resonance within the other. They are anti-sympathetic. This is why the cochlea, a structure within your ear cannot receive and interpret the ultrasound from a dog whistle for example.

Resonance is a phenomenon in which the frequency of some driving force closely matches a natural frequency of the system exposed to the force. The system will have low damping at that frequency and energy from the driving force source can build up and cause vibrations in the exposed system.

If a guitar string is exposed to a sound which has a frequency component, a la Fourier decomposition and analysis, then all those frequencies could be driving the guitar string. If the string has a natural frequency component which matches one of the frequencies in the sound, it will absorb energy begin to vibrate with that frequency.

In a stringed instrument, the natural frequencies are integer multiples of a lowest frequency, the fundamental, $f_0$. The fundamental frequency depends on the length ($L$), density ($\rho$), radius ($r$), and tension ($F_T$) of the string: $$f_0=\frac{1}{2L}\sqrt{\frac{F_T}{\rho\pi r^2}}.$$

For a given musical note on the bass (e.g., $A_2$), the 6 lowest natural frequencies will be close to $A_2$, $A_3$, $E_4$, $A_4$, $C^{\#}_5$, $E_5$. The strengths of these overtones will decrease as you go up in frquency. If a natural frequecy of the guitar string is $A_3$ or $E_4$, you might expect a good amount of interaction. This would be case for the lower $A$ and $E$ strings. The thinner strings will have a higher fundamentals, and although their frequencies might theoretically match an overtone (harmonic) of the bass string, the amplitude of that higher frequency will be too small to produce any noticeable resonant behavior.

• "The system will have low damping at that frequency" - for a typical constant coefficient 2nd order ODE, the damping is independent of frequency so I wonder if you're thinking of something else here. – Alfred Centauri Nov 3 '17 at 21:07
• @AlfredCentauri Damping may not be the precise word. Maybe you can help me. When one plucks a guitar string, the input is multiple frequencies, based on the triangular shape giving multiple wavelengths. The frequencies from the waveform of the pluck which persist match the natural frequencies of the string. What happens to the others? – Bill N Nov 4 '17 at 1:44

Trying to think the guitar string as a circuit analogy, not all resonating circuits have the same "Q factor", which implies that a bigger Q will be a more sharpen resonator centered in the resonating frequency with ampitudes increasing as the Q factor increases I do not know how to calculate the Q factor in a mechanical circuit but I guess that the Q factors of each string are different ant this cause of course different effects


text:
# How to predict the correct splitting pattern in a NMR spectrum

If I were to do a simulation and obtain all the chemical shifts and coupling constants between the different atoms, how would I then predict the NMR spectrum with coupling. Without coupling, I just use the chemical shifts and compare those to a base (TMS for example) and then I have all the peak locations and I'm pretty much done. But how do I incorporate all the splittings?

My guess would be to compare the chemical shift difference between two nuclei, $i$ and $j$ with their coupling constant and when $\Delta\sigma_{ij} > J_{ij}$ then I need to split the peaks corresponding to particle $i$ and $j$ but this would mean that coupling between nuclei that are very far apart with a very small $J$ would also be split, which is not really what you want.

• Ah, coupling is a hard one to pin down. Sometimes it is just not visible … – Jan Aug 28 '17 at 13:56


text:
## Students Q and A

### Question

by Tasnim Taofiq Simin -
Number of replies: 1

Tasnim Taofiq Simin

ID :192-34-973

What is the difference between Z-score and standard deviations?

In reply to Tasnim Taofiq Simin

### Re: Question

by Khaled Mussaruf -

Typically you have a collection of values of some variable. If the variable is human height, these values might be expressed in inches or centimetres; if it’s human weight, in pounds or kilograms. The standard deviation is a specific number of these units; roughly speaking, it’s the size of a typical deviation from the mean of these measurements. To compare two different collections of measurements, it’s generally very desirable to express them in units that make these typical deviations the same size. We might call such units standard units: standard units are units chosen so that the mean (average) of the measurements is 00, and a typical deviation −− technically, the standard deviation −− has size 11. The zz-scores are just the original measurements expressed in these standard units instead of the original units of measurement.

The conversion is actually quite similar to the conversion between two more familiar units of measurement. If you measure a length in inches (or centimetres) and then convert that measurement to feet (or metres), you have to multiply by 112112 (or 11001100), because each inch is 112112 of a foot (each centimetre is 11001100 of a metre). Suppose that you’re measuring human heights, and you get a standard deviation of 33 inches. Then for this sample 11 standard unit is 33 inches, and each inch is 1/31/3 of a standard unit. Someone whose height is 4.54.5 inches above the mean is 4.5⋅13=1.54.5⋅13=1.5 standard units above the average. This deviation of 1.51.5 standard units is the zz-score corresponding to that height of 4.54.5 inches above average.

You might say that the standard deviation is a yardstick, and a zz-score is a measurement expressed in terms of that yardstick.

The situation is a little different from simple conversion between inches and feet, though. It’s more like conversion between Fahrenheit and Celsius temperatures: not only does the size of the unit change, but also the 00 point. Just as 0∘0∘ C is 32∘32∘ F, not 0∘0∘ F, the 00 point for zz-scores is generally not the same as the 00 point for the actual measurements. A sample of adult American males, for instance, might have an average height of 7070 inches, so that someone 4.54.5 inches above the average would be 74.574.5 inches tall. The 00 point for zz-scores, measured in standard units, is always right at the average, so in this case a height of 7070 inches would correspond to a zz-score of 00. A height of 74.574.5 inches, being 4.54.5 inches and therefore (as we saw before) 1.51.5 standard units above average, would correspond to a zz-score of 0+1.5=1.50+1.5=1.5. And so on.

When you calculate

z=x−x¯s

z=x−x¯s

to get a zz-score zz from a measurement xx, you’re doing the same kind of unit conversion that you do in converting a temperature from one scale to the other. The calculation x−x¯x−x¯ gives you the deviation of your actual measurement from the mean; in my example, that’s 74.5−70=4.574.5−70=4.5 inches. When you divide by ss, the standard deviation, you’re changing ‘yardsticks’ from inches to standard units. In the example s=3s=3 inches, so you’re multiplying the deviation of 4.54.5 inches by the conversion (scaling) factor of 1313 of a standard unit per inch.

One point of these standard units is that the permit comparison of distributions. For example, women are on average shorter than men, and their heights vary a bit less. Thus, a woman who is 33 inches above the female average is, relative to the female population, taller than a man who is 33 inches above the male average. But how much taller? Use of standard units makes it possible to answer that kind of question. I’m using data that are now a bit out of date, but very roughly she is 1.21.2 standard units above the female average, while he is only 11 standard unit above the male average.


text:
# ggplot in Python¶

## Introduction¶

This tutorial will introduce the reader to the python package ggplot, the python equivalent of Hadley Wickham's immensely popular R package, ggplot2. ggplot2 is a graphics and visualizations package, based on the Grammer of Graphics, in the statistical language, R. The Grammer of Graphics is built around graphics as the summation of building blocks. These building blocks include data, aesthetics, statistical transformations, and faceting.

## Why ggplot¶

For those readers with background in R, the use of ggplot is obvious. The ggplot package for python is virtually identical to the R package. For those readers unfamiliar with R and ggplot, ggplot has a number of distinct advantages over some other graphics packages:

• With the use of "building blocks", superposition of information is extremely simple.
• Multiple data sets can easily be presented in the same plot.
• Faceting can be done without the use of loops.
• There is a heavily active community of users, tutorials, guides and question/answers available online.
• Geoms are intuitive to use.
• The package is built upon one of the major schools of data visualization.

## Tutorial Content¶

In this tutorial we will cover some of the most important and impressive features of ggplot. We will use the builtin datasets; more information on those can be found at http://docs.ggplot2.org/current/. ggplot will work with most datasets, provided the data is in readable formats.

We will cover the following topics in this tutorial:

## Set up¶

If ggplot is not installed it can be installed using pip install in the command line or through the git: https://github.com/yhat/ggplot.

In [5]:
#pip install numpy
#pip install pandas
#pip install matplotlib
#pip install ggplot

We will begin by importing three packages needed for ggplot. numpy gives us access to needed mathematical functions, pandas gives us access to dataframes, the preferred method for data in R, and matplotlib.pyplot gives us access to what is considered python's more traditional graphics and visualization package.

Without matplotlib the graphs will open in a separate window.

In [6]:
import numpy as np
import pandas as pd
#import scipy as sp
import matplotlib.pyplot as plt
%matplotlib inline
from ggplot import *
#from scipy.stats import iqr

For our tutorial we will use two of ggplot's built in datasets: diamonds and mtcars. Below we call .head() to visibly display the data stored in those two datasets.

In [50]:
mtcars['gear'] = mtcars['gear'].astype('category')

                name   mpg  cyl   disp   hp  drat     wt   qsec  vs  am gear  \
0          Mazda RX4  21.0    6  160.0  110  3.90  2.620  16.46   0   1    4
1      Mazda RX4 Wag  21.0    6  160.0  110  3.90  2.875  17.02   0   1    4
2         Datsun 710  22.8    4  108.0   93  3.85  2.320  18.61   1   1    4
3     Hornet 4 Drive  21.4    6  258.0  110  3.08  3.215  19.44   1   0    3
4  Hornet Sportabout  18.7    8  360.0  175  3.15  3.440  17.02   0   0    3

carb
0     4
1     4
2     1
3     1
4     2
carat      cut color clarity  depth  table  price     x     y     z
0   0.23    Ideal     E     SI2   61.5   55.0    326  3.95  3.98  2.43
1   0.21  Premium     E     SI1   59.8   61.0    326  3.89  3.84  2.31
2   0.23     Good     E     VS1   56.9   65.0    327  4.05  4.07  2.31
3   0.29  Premium     I     VS2   62.4   58.0    334  4.20  4.23  2.63
4   0.31     Good     J     SI2   63.3   58.0    335  4.34  4.35  2.75

## Scatterplots¶

A scatterplot is one of the most used plots in the statistical and data science world. Since both the dependent and independent variables are quantatative, scatterplots can be used with regression, distributions and other statistical needs. Our scatterplot will plot miles per gallon (mpg) versus horsepower (hp) of the mtcars dataset. We start by creating a ggplot object.

In [10]:
mpg_hp_scatter = ggplot(mtcars, aes(x = 'hp', y = 'mpg'))

type(mpg_hp_scatter)

Out[10]:
ggplot.ggplot.ggplot

We add geom_point() to our object to make our scatterplot. We will also add labels and a title to our plot using xlab and ylab to add axis labels and ggtitle to add the title.

In [11]:
mpg_hp_scatter = mpg_hp_scatter + \
ylab('Miles per Gallon') + \
xlab("Horsepower") + \
ggtitle("Miles per Gallon vs. Horsepower")

mpg_hp_scatter_wg = mpg_hp_scatter + geom_point()

mpg_hp_scatter_wg

Out[11]:
<ggplot: (17214342)>

The plot above shows the miles per gallon versus the horsepower of the mtcars dataset. There is a clear negative relationship between the two variables as evidenced by the increasing horsepower and decreasing miles per gallon.

Below we have plotted the same scatterplot, with the addition of a third variable gear which colors the points of the plot.Wi

In [51]:
mpg_hp_wc_scatter = ggplot(mtcars, aes(x = 'hp', y = 'mpg', color = 'gear'))

mpg_hp_wc_scatter = mpg_hp_wc_scatter + \
ylab('Miles per Gallon') + \
xlab("Horsepower") + \
ggtitle("Miles per Gallon vs. Horsepower\nColored by Gear")

mpg_hp_wc_scatter_wg = mpg_hp_wc_scatter + geom_point()

mpg_hp_wc_scatter_wg

Out[51]:
<ggplot: (24499835)>

With the addition of the coloring above we can see both the relationship between horsepower and mpg as well as the distribution of gears across that relationship.

## Histograms¶

Histograms are statistical visualizations used to display the frequency, range and skew of one quantitative variable. Using our mtcars dataset, we will graph mpg.

In [34]:
mpg_hist = ggplot(mtcars, aes(x = "mpg"))

mpg_hist = mpg_hist + \
xlab("Miles per Gallon") + \
ylab("Frequency") + \
ggtitle("Frequency of Miles per Gallon")

mpg_hist_wg = mpg_hist + geom_histogram()

mpg_hist_wg

Out[34]:
<ggplot: (24541546)>

We can see on the graph above that mpg is skewed right with a center around 17. Since binsize and number are not statistically relevant in histograms we can adjust their values until we get the best possible histogram.

We will use the Freedman-Diaconis Rule, a statistical equation for selecting the proper binwidth. Our function best_binwidth is the Freedman-Diaconis Rule in python. The plot below is the same plot with an updated binwidth.

In [35]:
def best_binwidth(x):

iqr = float(np.subtract(*np.percentile(x, [75, 25])))
iqr = 2 * iqr

leng = len(x)
leng = leng**(1/3.0)

divisor = iqr / leng

xmax =  x.max() / divisor
xmin =  x.min() / divisor

return (xmax - xmin)

mpg_hist_bb_wg = mpg_hist + geom_histogram(binwidth = best_binwidth(mtcars['mpg']))

mpg_hist_bb_wg

Out[35]:
<ggplot: (24541546)>

Additionally, we can add lines to our plot to better display some information. In the graph below, we have added a red line for the mean of the data and a green line for the median.

In [36]:
mpg_hist_wg_lines = mpg_hist + \
geom_histogram() + \
geom_vline(x = mtcars["mpg"].mean(), color = "red") + \
geom_vline(x = mtcars["mpg"].median(), color = "green")

mpg_hist_wg_lines

Out[36]:
<ggplot: (24541546)>

Since the mean of the plot above is larger than the median. Our initial thoughts on the skew are shown to be accurate.

## Density Plots¶

In [40]:
mpg_density = ggplot(mtcars, aes(x = "mpg"))
mpg_density = mpg_density + \
xlab("mpg") +\
ylab("Frequency") +\
ggtitle("Frequency of MPG")

mpg_density_wg = mpg_density + geom_density()

mpg_density_wg

Out[40]:
<ggplot: (25676064)>

While histograms are a poweful way to view the distribution of quantatative variables, we can also use density plots to display the same information in a different format. Density plots display the densities of a quantatiative variable in line format instead of the histograms bars. To create a density plot, we use geom_density to create the plot. We will continue to use our mpp example.

In comparison to the histograms above, our density plot shows the distribution of mpg with a single line. We continue to see the right skew we discussed earlier and the center between 15 - 20. As we mentioned above, there are those who find density plots easier to read than histograms and vice versa, it is a matter of preference for many of the visualization the reader will need.

ggplot can also display multiple distributions if we split the variable based on another variable. To do this, we add a parameter to our initial ggplot call. In our example below, we have set the parameter color to gear one of the other variables in the dataset.

In [52]:
mpg_g_density = ggplot(mtcars, aes(x = "mpg", color = "gear"))
mpg_g_density = mpg_g_density + \
xlab("mpg") +\
ylab("Frequency") +\
ggtitle("Frequency of MPG\nSplit by Gear")

mpg_g_density_wg = mpg_g_density + geom_density()

mpg_g_density_wg

Out[52]:
<ggplot: (25664702)>

We can see that the distributions of mpg are different for each of the gears. Thus adding a categorical variable can add to an understanding of different variable.

Since histograms and density plots are different plot types of the same data, we can call geom_histogram instead of geom_density to get the histogram of the plot we above.

In [53]:
mpg_g_hist_wg = mpg_g_density + geom_histogram()

mpg_g_hist_wg

Out[53]:
<ggplot: (25664702)>

## Bar Charts¶

Bar charts are often confused with histograms due to their visual similarities. However, they display different types of data and different information can be gained each plot type. Where histograms display one quantatative variable, bar charts display one categorical variable. Since histograms display quantatitive data, the skew, mean and median are all statistical information that has meaning. Since a bar chart displays the categories of a categorical variable, none of that information is sensical.

To create a bar chart in ggplot, we use geom_bar. Below, we have plotted cut from the diamond dataset.

In [19]:
cut_bar = ggplot(diamonds, aes(x = "cut"))
cut_bar = cut_bar + \
xlab("Cut") +\
ylab("Frequency") +\
ggtitle("Distribution of Cut")

cut_bar_wg = cut_bar + geom_bar()

cut_bar_wg

Out[19]:
<ggplot: (19004592)>

In a bar chart neither the order of the categories nor the width of the bars matters. Generally the important part of the bar chart is the height of the bars. In our example, Ideal is the most frequent in our dataset, while Fair is the least frequent.

If we wanted to see the frequency of one categorical variable split by another categorical variable, we have two options. The first option is a stacked bar chart where each bar of the first variable is colored by another variable. Below we have written a stacked bar chart of cut split by color by adding the position parameter to geom_bar and setting it equal to stack.

In [20]:
cut_c_bar = ggplot(diamonds, aes(x = "cut", fill = "color"))
cut_c_bar = cut_c_bar + \
xlab("Cut") +\
ylab("Frequency") +\
ggtitle("Stacked Bar Chart of Cut\nColored by Diamond Color")

cut_c_bar_stack_wg = cut_c_bar + geom_bar(stat = "identity", position = "stack")

cut_c_bar_stack_wg

C:\Users\isaac\Anaconda2\lib\site-packages\ggplot\ggplot.py:602: FutureWarning: sort(columns=....) is deprecated, use sort_values(by=.....)
fill_levels = self.data[[fillcol_raw, fillcol]].sort(fillcol_raw)[fillcol].unique()

Out[20]:
<ggplot: (17566258)>

In our example, we see that the color G represents the largest part of the Ideal column, while in the Very Good column it appears with the same frequency as H.

The other way to display the data is with a side-by-side bar chart. This is done by changing the position parameter to dodge. Below we have plotted the same data with position changed.

In [21]:
cut_c_bar = ggplot(diamonds, aes(x = "cut", fill = "color"))
cut_c_bar = cut_c_bar + \
xlab("Cut") +\
ylab("Frequency") +\
ggtitle("Side-by-Side Bar Chart of Cut\nColored by Diamond Color")

cut_c_bar_dodge_wg = cut_c_bar + geom_bar(stat = "identity", position = "dodge")

cut_c_bar_dodge_wg

Out[21]:
<ggplot: (17464149)>

There are those who find the side-by-side bar chart easier to understand than the stacked bar chart. This is a matter of preference and either can be used appropriately.

## Faceting¶

Faceting is a method of splitting a plot by a categorical variable and plotting the resulting subsets of the data together. Our first example will recreate the density plots of mpg_density_wg. We will facet the dataset by gear so we can best compare it against our mpg_g_density_wg from earlier.

In [54]:
mpg_g_density_facet = ggplot(mtcars, aes(x = "mpg", color = "gear"))
mpg_g_density_facet = mpg_g_density_facet + \
xlab("mpg") +\
ylab("Frequency") +\
ggtitle("Frequency of MPG\nSplit by Gear")

mpg_g_density_facet_wg = mpg_g_density_facet + geom_density() + facet_grid("gear")

mpg_g_density_facet_wg

Out[54]:
<ggplot: (26485024)>

The plot above displays the same information as mpg_g_density_wg with the different distributions on different plots.

We can also split plots of categorical distributions with facets as well. We will recreate cut_bar and facet our bar charts by color.

In [23]:
cut_bar = ggplot(diamonds, aes(x = "cut"))
cut_bar = cut_bar + \
xlab("Cut") +\
ylab("Frequency") +\
ggtitle("Distribution of Cut")

cut_bar_facet_wg = cut_bar + geom_bar() + facet_grid("color")

cut_bar_facet_wg

Out[23]:
<ggplot: (22021647)>

## Smoothing Lines¶

Besides plotting data, ggplot can also plot regression lines. Using stat_smooth, we can visualize different regression lines on scatter plots and other such plots. As an example we will plot mtcars disp versus hp. In other words, we will hypothesize that disp is dependent on hp.

In [24]:
disp_hp = ggplot(mtcars, aes(x = "hp", y = "disp"))
disp_hp = disp_hp + \
xlab("Horsepower") +\
ylab("Displacement") +\
ggtitle("Displacement vs. Horsepower")

disp_hp_wg = disp_hp + geom_point()

disp_hp_wg

Out[24]:
<ggplot: (24071614)>

We see a somewhat positive, linear relationship between horsepower and displacement, the smoothing lines may better display those relationships.

When we add in geom_smooth without any other parameters defined we get the same plot as above with the default smooth.

In [25]:
disp_hp_smooth_wg =  disp_hp + geom_point() + stat_smooth()

disp_hp_smooth_wg

C:\Users\isaac\Anaconda2\lib\site-packages\ggplot\stats\stat_smooth.py:77: FutureWarning: sort(columns=....) is deprecated, use sort_values(by=.....)
smoothed_data = smoothed_data.sort('x')

Out[25]:
<ggplot: (24071614)>

The smooth that stat_smooth chose appears linear with larger error bars near the ends of the data, adding evidence to our suspicions.

If we were curious about a particular model type we could change the method of stat_smooth with the added method parameter.

In [ ]:
disp_hp_lm_wg = disp_hp + geom_point() + stat_smooth(method = "loess")

disp_hp_lm_wg

Above is the same plot with a different smooth that we tried.

We can remove the standard error bars from the smooth line with the paramter se.

In [58]:
disp_hp_lmse_wg = disp_hp + geom_point() + stat_smooth(method = "lm", se = False)

disp_hp_lmse_wg

Out[58]:
<ggplot: (24071614)>

## Themes¶

The last topic we will cover in this tutorial is themes. While themes are not a statistical choice, they are an important part of proper visualizations. We will plot a histogram of price of the diamonds dataset using the standard ggplot theme.

In [59]:
price_density = ggplot(diamonds, aes(x = "price"))
price_density = price_density + \
xlab("Horsepower") + \
ylab("Frequency") + \
ggtitle("Frequency of Horsepower")

price_density_wg = price_density + geom_density()

price_density_wg

Out[59]:
<ggplot: (27284856)>

Below we have plotted the same plot with our own theme, aptly named our_theme.

In [9]:
our_theme = theme(axis_text=element_text(size=8, color='black'), x_axis_text=element_text(angle=45))

price_density_theme =  price_density + geom_density() + our_theme

price_density_theme

Out[9]:
<ggplot: (17076901)>

We can see that our theme changed the orientation of the numbers on the x-axis as well as the sizes of the numbers. While there are other stylistic choices one could make in writing a theme, we chose to keep it simple.

## Conclusion¶

In this tutorial we have covered the important elements of the ggplot package. We recommend recreating our examples with different colors, themes and other asthetic choices until the user is satisified. Any questions not addressed in this tutorial are addressed in the ggplot documentation which can be found here: https://github.com/yhat/ggplot

In [ ]:


text:
# Flux and emf induced graphs when magnet is dropped through a coil

I've been told that if you drop a magnet through a coil the induced emf and flux graphs would look like this:

I understand that when the bar magnet is in the middle of the coil the emf induced is zero as flux change in top and bottom is in opposite directions but why is flux maximum when emf induced is zero, shouldn't the effective flux be zero as well? And, in the second half of the magnets jounery shouldn't the effective flux be negative as more of the flux linkage is contributed by the top half of the magnet when it is leaving the coil?

• As you can see from the dimension Vs , the flux graph is the integral of the voltage graph, also if the dropping magnet is in the middle one B field in the coil is at its maximum – trula Mar 6 at 11:52

The closer the magnet gets to the coil, the bigger is the magnetic field going thrue the coil and thus the bigger the flux thrue the coil. This is due to the magnetic field being stronger closer to the magnet ($$V$$ is the Volume of the magnet which we integrate over) $$\vec B(\vec r)=\frac{\mu_0}{4\pi}\int_V \frac{\vec j(\vec r')\times (\vec r-\vec r')}{|\vec r-\vec r'|^3}dV',$$ and because the flux $$\Phi$$ depends on the magnetic field inside the coil (thrue the surface $$S$$) $$\Phi=\int_S \vec B \cdot d\vec S.$$ Thus, when the magnet is inside the coil, the magnetic field going thrue $$S$$ is at its maximum because $$S$$ is near to $$V$$ (the magnet). You can understand this intuitively imagining a finite amount of magnetic field lines. When the magnet is inside the coil all of the field lines go thrue the coil. Before or after reaching the coil, only some field lines go thrue the coil. This explains the second Graph.
By Faraday's Induction Law $$\vec \nabla\times \vec E=-\partial_t \vec B,$$ the inductive voltage is defined as $$U_{\rm ind}=-\partial_t \Phi.$$ Thus the inductive voltage is proportional to the derivative of the Flux $$\Phi$$ with respect to time. This explains the first Graph.


text:
# Vapor Pressure, Equillibrium, and Increasing Pressure

I'm trying to make sure my understanding of vapor pressure and transients is correct.

Let's assume I have a thermally-controlled sealed environment which started out as the regular air (i.e. atmospheric gasses and their respective ratios) with no gaseous water or ethanol at 101.325 kPa, 30 C. This container will maintain a temperature of 30 C after the start of this experiment.

Inside this environment there are two containers which can be remotely opened.

When I open the first container, exposing the pure water inside with a saturation vapor pressure (First question: is that the right term?) of 4.2455 kPa (from Wikipedia) and wait until it reaches equilibrium (100% humidity), does this mean this is the new state of the container?

• Pressure: 101.325 + 4.2455 = 105.5705 kPa

• Partial-Pressure of H2O: 4.2455 kPa

Then I open the second container, exposing pure isopropyl alcohol inside with a saturation vapor pressure of 10.555 kPa (from WolframAlpha) and wait until it reaches equilibrium again, does this mean this is the new state of the container?

• Pressure: 101.325 + 4.2455 + 10.555 = 116.1255 kPa

• Partial-Pressure of H2O: 4.2455 kPa

• Partial-Pressure of Ethanol: 10.555 kPa

So, in the end, the pressure of the vessel increased each time a new liquid was introduced.

In this hypothetically-ideal environment, would the pressures simply rise until it reached that perfectly equilibrium? If so, I expect in a real environment the pressure would rise but there would always be a cold spot somewhere which caused the vapor pressure (in that specific area) to drop, leading to water condensing, leading to the partial pressure being lower as the air mixes, leading to more evaporation; is this correct?

Some notes:

• Assume that there is enough of each liquid to reach equilibrium without running out of liquid.

• The sealed environment effectively adds energy to counteract the heat of vaporization of each liquid, and also prevents the gasses from releasing/absorbing energy into/from the external environment or from changing due to pressure changes. It is essentially a magic make-everything-this-one-temperature machine.

There are a couple of gotchas' with the problem.

The volumes of the liquids and gases are specified. So 1 drop of water in a million gallon tank of dry air isn't going to be enough water to reach saturation.

You stated that "This container will maintain a temperature of 30 C after the start of this experiment." However the problem statement doesn't explicitly state that the contents of the container will be in thermal equilibrium with the container. That does seem to be a reasonable interpretation however. (If the evaporation had taken place adiabatically, then the liquid and gas would have to cool to account for the evaporation.)

There is another significant factor here. The water would absorb ethanol, and the ethanol would absorb water. You can't really figure this out without knowing all the volumes, or at least the relative volumes.

Now if you assume that there is enough liquid to saturate the gas phase, that the system (gas phase and liquid phase) absorbs heat from outside the system, then the vapor pressure of the liquid at $30\ ^\circ\mathrm{C}$ is added to the internal pressure of the gas phase before the evaporation takes place.

• "If the evaporation had taken place adiabatically, then the liquid and gas would have to cool to account for the evaporation" - Yes, my intention with that statement was to say that the container would keep the liquid at that temperature, adding energy to compensate for evaporation. And yes, my assumption was that there was enough water to reach equilibrium without running out of water. – iAdjunct Dec 30 '17 at 21:35
• "...is added to the internal pressure of the gas phase before the evaporation takes place" - are you saying that the pressure change leads the actual water vaporization? So, once the first canister is opened, in [comparatively] short order, the chamber would rise to 105.5705 kPa, even though there may not actually be H2O vapor in the air? – iAdjunct Dec 30 '17 at 21:37
• I didn't think about the water/ethanol cross-absorption; I'll have to research that part further. Before the ethanol container is opened, is my original question combined with my previous comment a correct understanding of the system? – iAdjunct Dec 30 '17 at 21:40
• I didn't look it up, but I'll assume that the vapor pressure of water at 30C is 4.2455 kPa. So once the gas phase is saturated with water vapor, then the pressure will rise to 101.325 + 4.2455 = 105.5705 kPa. How long it takes once the first canister is opened is another matter entirely... – MaxW Dec 30 '17 at 22:10
• water/ethanol cross-absorption - I think you'd end up with one of the three situations (1) all ethanol migrates to water (2) All water migrates to ethanol or (3) two volumes of ethanol-water at the same concentration. With one of the possibilities would come true would depend on the (relative) volumes. – MaxW Dec 30 '17 at 22:14


text:
# Does NASA really report the power of rockets in horsepower?

On a recent episode of The Late Show with Stephen Colbert, Dr. Neil deGrasse Tyson said:

And to this day NASA will still report the power of rockets in horsepower, which is completely absurd, because no matter how many horses you string together, they will not elevate into space.So it just doesn’t make any sense!

Question: Is it true? Does NASA still report the power of rockets in horsepower?

Is this in press briefings, or educational material, or scientific literature?

cued at 04:35:

• Why not, it's a unit of power people are familiar with. They use other absurd units such as inches and lbf
– user20636
Mar 7, 2020 at 12:11
• @JCRM I suppose because power is not a useful unit for launch vehicles. The question here is about does or doesn't, not should or shouldn't.
– uhoh
Mar 7, 2020 at 13:04
• It (or power/weight) is useful to get a feeling of just how much energy is being processed by such a small device. Mar 7, 2020 at 22:54
• – uhoh
Mar 8, 2020 at 23:17
• Maybe this question can be rephrased to "does NDGT use humor as a rhetorical device?". Mar 9, 2020 at 12:45

Yes, part of NASA's function is public communication. As such they will use units such as "Aircraft Carriers" "School Buses" and "horsepower"

While not precise, expressing thrust in terms of horsepower notionally allows people to understand it more.

"What's impressive about this test is when ignited, the booster will be operating at about 3.6 million pounds of thrust, or 22 million horsepower," said Alex Priskos, manager of the SLS Boosters Office at Marshall. "This test firing is critical to enable validation of our design."

• Yes, for PR purposes only. Mar 7, 2020 at 14:05
• I've just asked How does NASA calculate "rocket horsepower"?
– uhoh
Mar 7, 2020 at 14:44
• The content of the links is unimportant (all three mention horsepower) They're merely recent examples. If they do disappear, that may mean the answer has changed.
– user20636
Mar 7, 2020 at 14:45
• It shouldn't be necessary for each reader to go off-site three times to get the answer to the question. Link-only answers are always discouraged in SE and actively discouraged here in Space SE. It's a long-standing policy.
– uhoh
Mar 7, 2020 at 14:49
• There's a video of an airline pilot who's quite into technical things related to cars and planes, in which he calculates how many horsepowers a F-14 Tomcat has -> youtube.com/watch?v=JC-7wRmMH2g While computing horsepower for a jet plane is fun and bogus, it allows an average human to grasp to difference jet power makes when compared to propeller driven planes. So, horsepowers of a rocket may be bonkers, but it's a concept everyday people are familiar with. How powerful is the Saturn V? Very. How much? Very much. Horsepower may be a good crutch to convey the meaning of "Very much" May 12 at 8:37

Using the inappropriate unit horsepower for rocket engines has a very long tradition. When the V2 A4 rocket of WWII was presented to ignorant NSDAP government officials by the Wernher von Braun team, the only useful comparative value was horsepower known from automotive engines. A thrust value using forth units was not understood.

One offical had the very stupid idea of using rocket engines for railway locomotives.

• It does make one wonder about "government officials". Some things never change, irrespective of time or the politics of "government officials". Some "government officials" around the world think Covid-19 is fake, others that coal still has a future as an energy source, not to mention other misconceived ideas. If horse power is all their little uneducated or inexperienced minds can understand, talk to them about horse power. They hold the purse strings & "someone" needs finance.
– Fred
May 11 at 17:53
• Sandia Nation labs rocket rail test system May 11 at 18:48
• This is a great anecdote. Do you have a source? A quick Google didn't find anything. May 11 at 19:31
• I remember reading about that in a book some decades ago. I have to search about 5 books in my book shelf.
– Uwe
May 11 at 19:37


text:
# Probabilities, CDF

fateswarm

## Homework Statement

Given the function F(x) = 1 - e^(-ax) - axe^(-ax) for x>=0 and 0 elsewhere, for which values of 'a' does the function constitute a CDF?

## The Attempt at a Solution

I started with saying for that to occur, provided x1>x2 -> F(x1) > F(x2)

Though I've only managed to say for x1=0 and x2=1 -> a>0 but I'm not sure if it's an unequivocal answer.

How can I prove it decisively?

Mentor
I started with saying for that to occur, provided x1>x2 -> F(x1) > F(x2)
That should be ≥.

Did you check the derivative?

If all of them are fine, you are done.

Homework Helper
If you want to show that F is an increasing function, then show that its derivative is never negative.

1 person
fateswarm
If you want to show that F is an increasing function, then show that its derivative is never negative.

Oh, good idea (+thanks). I'll look into it. I may return if I see an issue.

fateswarm
I've got a bit of trouble. The derivative>0 appears to conclude to (a^2)xe^(-ax)>0 which appears to be true for any 'a' belonging in IR. It appears to be more direct to do 0<=F(x)<=1 which appears to conclude to 0<=(e^-ax)(1-ax)<=1 but how do I learn how to solve that inequality?

$$(1) \; f(x) \geq 0 \text{ for all }x; \text{ and }\\ (2)\; \int_{-\infty}^{\infty} f(x) \, dx = 1.$$


text:
# Homework Help: Electric Potential homework

1. Apr 14, 2016

### nfcfox

1. The problem statement, all variables and given/known data
The electric potential a distance r from a point charge q is 195 V, and the magnitude of the electric field is 2870 N/C. Find the values of q and r.

2. Relevant equations
2780q=F
Fr=W
W/q=195

3. The attempt at a solution
Using substitution I got r=.00679 meters, which is correct. I can't substitute to find q... I have no idea what to do.

2. Apr 14, 2016

### Staff: Mentor

What are the equations for the electric field and electric potential at a distance r from a point charge q? Your text or class notes must have these two equations as they are quite fundamental. Hint: They both involve the constant from Coulomb's law.

3. Apr 15, 2016

### nfcfox

Ik the equation F=(kQ1Q2)/(r^2) that's Coulomb's law. We never really did anything with fields or potentials... I found that electric field=F/q which I already have up there.
I already have the electric field equation up there and the electric potential is U=(kQq)/r

4. Apr 15, 2016

### Staff: Mentor

I suspect that your method for finding the distance r was actually flawed, and your correct result was a coincidence. I say this because one of your relevant equations, Fr = W, is not correct for this situation. If F is meant to be force and W the work done, then it doesn't hold if the force varies with the distance (F is not constant so W = F⋅d doesn't hold).

Your new equation, U=(kQq)/r, gives the electric potential energy (in Joules) for a system of two charges. That's the energy required to bring them from infinity to a separation distance of r. What you need is the electric potential (in Volts) for a point charge at distance r.

The equations that you're seeking are:

$E = k \frac{q}{r^2}~~~~~~~~~~$ Electric field strength (N/C)

$V = k \frac{q}{r}~~~~~~~~~~~$ Electric potential (Volts)

You should verify that these equations are given in your text book.


text:
LAPPD Figures for Papers and Talks

 56Spacer's station. Full stack view. 55Spacer's station. Opened. 54Spacers station assembled and in operation. 53Populated analog card with tile. 52The initial PSEC4 application: a high-channel density waveform digitization of a large-area MCP RF microstrip anode. 51 The geometry of the test setup: A signal is input on the near end of the central strip (shown in red) and is detected at the far end. The power is measured on the near and far ends of the neighboring strips.} 50Comparison of total normalized power summed over all strip-lines for three different anode geometries: a single 30-strip tile (triangles), a single 40-strip tile (circles), and three 30-strip tiles in series. 49{The mechanism of cross-talk for a positive signal with a linear rising edge~\cite{Bogatin}. Two adjacent strip-lines are shown; the common ground plane is not shown for clarity. The active line is driven on the near end with a signal pulse of rise-time $t_r$. At the far end of the active line the same pulse is seen a time $t_d$ later, determined by the length and characteristic velocity of the line. The neighboring line, the quiet line, is coupled to the active line capacitively and inductively by the electric and magnetic fields, respectively. At the near end of the quiet line a positive voltage appears at the start of the signal and persists for 2$t_d$. For an inductive coupling, at the far end a negative voltage appears starting at $t_d$ with a width~$t_r$. 48The bandwidth measured at 3db loss on the central strip versus the log of the total anode length. The anodes consisted of 3 and 4 tiles in series (746.7 mm and 916 mm, respectively, including the length of the fanout card strips), a single tile (288.5 mm), and only the 2 fanout PC cards connected to each other (zero tiles'- 59.4 mm). 47The normalized power (output power/input power) versus log-frequency for a single 229.1 mm-tile plus fanout cards(288.5 mm) with 30 strips (red, middle trace), 40 strips (blue, bottom trace), and the fanout PC cards alone(zero-tile', in green, top trace). See Figure~\ref{fig:single_tile}. The (black) horizontal line represents the 3db loss level (50\% loss in power).


text:
# Almost Complex Structures: 'Tame' versus 'Compatible'

Consider a symplectic manifold $(M,\omega)$ and the space of almost complex structures. These are $J:TM\to TM$ with $J^2=-\text{id}$. A given $J$ is $\omega$-tame when $\omega(v,Jv)>0$, and $J$ is $\omega$-compatible when it is $\omega$-tame and $\omega(J\cdot,J\cdot)=\omega(\cdot,\cdot)$. The set of either such $J$ forms a contractible subspace. Note that in either scenario we can form a Riemannian metric $g_J$ by twisting $\omega$ in some way with $J$.

In practice, I sometimes see $J$ being tame, and more often I see $J$ being compatible, but in either case I am unsure of the restrictions that each imposes. Is there any context in which it is necessary/helpful to use one condition over the other? This need not be related to pseudo-holomorphic curves in Floer theory. Do certain results fail when I relax "compatible" to "tame"?

A fundamental difference I see (quoted from McDuff-Salamon's big textbook) is that compatible $J$ minimize the energy of a J-holomorphic curve in its homology class, but not necessarily for tame $J$.

• In your first sentence, the word "contractible" should not be there. The spaces of tame or compatible a.c.s. are contractible, but not spaces of general a.c.s.
– BS.
Sep 9, 2012 at 9:49

If you assume that $M$ is compact and of dimension $4$ then Donaldson has conjectured that if $J$ is $\omega$-tame then $J$ is $\omega'$-compatible for some symplectic form $\omega'$, see Question 2 here. By classical results of Gromov and Taubes this is known to hold if $M=\mathbb{CP}^2$. It is also not hard to verify this when $J$ is integrable (so $(M,J)$ is a compact complex surface), using the classification of surfaces. It is also known to hold when $(M,J)$ is homogeneous.

In this same paper Donaldson proposed a way to attack this question by suitably extending the Calabi-Yau theorem to the symplectic case. Such an extension is still conjectural, but see this survey for some work that has been done in this direction.

On the other hand Taubes has developed a different way of attacking Donaldson's question, and has succeeded in the case when $b^+(M)=1$ and $J$ is suitably generic.

In higher dimensions ($6$ or more) the analogous statement is false.

I think YangMills's answer is fantastic. I will go in a slightly different direction, and address the "usefulness" of each definition part of the question.

A very useful feature of tame acs is that tameness is an open condition. This means that it is more straightforward to talk about generic perturbations, e.g. so that somewhere injective curves are transverse. The whole discussion can be carried through with compatible, but it becomes more involved (most recently, I've seen this discussed in some detail in Massot-Niederkruger-Wendl on filling questions for higher dimensional contact manifolds.) The compatible case works, if I am not mistaken, because the space of compatible $J$ is a Banach manifold.

A useful feature of a compatible almost complex structure $J$ is that for a $J$-holomorphic curve, $u^* \omega = |du|^2_J d \operatorname{vol}$. If you have a tamed almost complex structure, you obtain an inequality that is good enough for compactness, but the proofs become a little more involved.

To the best of my knowledge, there is nothing that anyone has proved for $J$-holomorphic curves for compatible $J$ that is believed to be false for tame $J$. Many results, however, are only proved for compatible $J$ because it makes life easier. I personally would love to see an example of a result that wasn't overly technical for which the difference mattered.

To add to Sam's answer, compatible almost complex structures are often needed in applications of Gromov-Witten theory to Hofer geometry. Even more fundamentally they are necessary in the construction of spectral invariants, since we must have a well defined filtration on the Floer chain complexes, and if we are working with only tamed almost complex structures I guess we cannot get such a well defined filtration, although I must admit I have not thought about this very deeply.

A high dimensional situation, where one doesn't have the choice to work with a compatible almost complex structure is the case of a contact manifold $$(V,\xi)$$ weakly filled by a symplectic manifold $$(W,\omega)$$. I do not want to give the precise definition of weak fillings here, but the important thing to understand is that to work in a sensible way with $$J$$-holomorphic curves on a manifold with boundary, we would like to choose a $$J$$ that is

• (at least!) tamed by the symplectic structure $$\omega$$ so that we can measure energy and hopefully use Gromov compactness,
• furthermore we require $$\xi$$-convexity along the boundary so that the holomorphic curves cannot move "up" and escape from the symplectic manifold.

The correct definition of weak fillability is a compatibility condition between $$\omega$$ and $$\xi$$ that guarantees the existence of such almost complex structures satisfying both conditions.

Unfortunately, it is not always possible to find a $$J$$ that in this situation is both compatible with $$\omega$$ and with $$d\alpha|_\xi$$ (for a contact form $$\alpha$$), and we have to stick to tamed almost complex structures, see Remark 2.3 in

Massot, Patrick; Niederkrüger, Klaus; Wendl, Chris, Weak and strong fillability of higher dimensional contact manifolds, Invent. Math. 192, No. 2, 287-373 (2013). ZBL1277.57026..


text:
从特殊的图论模型谈开去

斯坦纳树

背景

Steiner tree problem, or minimum Steiner tree problem, named after Jakob Steiner, is an umbrella term for a class of problems in combinatorial optimization. While Steiner tree problems may be formulated in a number of settings, they all require an optimal interconnect for a given set of objects and a predefined objective function. One well-known variant, which is often used synonymously with the term Steiner tree problem, is the Steiner tree problem in graphs. Given an undirected graph with non-negative edge weights and a subset of vertices, usually referred to as terminals, the Steiner tree problem in graphs requires a tree of minimum weight that contains all terminals (but may include additional vertices). Further well-known variants are the Euclidean Steiner tree problem and the rectilinear minimum Steiner tree problem.

(这个翻译我真的尽力了.)(我再翻译一些)

Pollak−Gilbert 猜想

Pollak-Gilbert 猜想指出，平面上任意 $n$ 点集，斯坦纳最小树长与最小生成树之长的比值的最小值是 $\frac{\sqrt{3}}{2}$

求解问题

• 先通过对 $j$ 进行划分求得对于 $i,j$ 下的最优解。
• 再通过 $i,j$ 去优化 $j$ 下的其他根的答案。

图的遍历问题

(注：下文顶点和结点混用，但其实是一回事，vertex or vertice)

Edmonds-Johnson 算法

case 1: $G$ 正好有两个奇次(度)顶点

case 2: $G$$2n$ 个奇次顶点

case 3:其余情况无解


text:
Question

# If a given number is increased by 8% of itself, then it gives the value 135. Find the actual value of given number?(a) 112(b) 100(c) 125(d) None of these

Hint: We start solving the problem by assuming the variable for the actual number. We use the given information increasing 8% about the number to proceed through the problem. We use the fact that a% of y is defined as $\dfrac{a}{100}\times y$ to proceed further through the problem. We make necessary calculations to get the required value of ‘x’.

Given that we had a number and when it is increased by 8% of itself, we get the value of 135. We need to find the value of the actual number.
Let us assume the number is ‘x’ and when this is increased by 8% of itself, we get the value of 135.
So, (100% + 8%) of the value of x = 135.
Then 108% of the value of x = 135 ---(1).
We know that a% of y is defined as $\dfrac{a}{100}\times y$. We use this result in equation (1).
$\Rightarrow \dfrac{108}{100}\times x=135$.
$\Rightarrow 1.08\times x=135$.
$\Rightarrow x=\dfrac{135}{1.08}$.
x = 125.
We have found the value of ‘x’ before increasing to 125.
∴ The actual value of the given number is 125.

So, the correct answer is “Option C”.

Note: We should not multiply 108 to x i.e., $108\times x=135$, to find the value of x. We should not make any calculation mistakes while solving this problem. We can also expect problems to find the 20% of x after getting the value of x.


text:
What to call substructures in universal algebra in which we restrict the signature? - MathOverflow most recent 30 from http://mathoverflow.net 2013-05-25T09:02:17Z http://mathoverflow.net/feeds/question/95925 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://mathoverflow.net/questions/95925/what-to-call-substructures-in-universal-algebra-in-which-we-restrict-the-signatur What to call substructures in universal algebra in which we restrict the signature? Andrej Bauer 2012-05-03T22:15:09Z 2012-05-03T22:28:45Z
Suppose \$\Sigma\$ is a signature in the sense of universal algebra and \$\Sigma' \subseteq \Sigma\$ a sub-signature. Every \$\Sigma\$-algebra is also a \$\Sigma'\$-algebra in a forgetful way. Suppose \$A\$ is a \$\Sigma\$-algebra and \$B \subseteq A\$ is a \$\Sigma'\$-subalgebra of \$A\$ viewed as a \$\Sigma'\$-algebra. Is there an accepted phrase which describes the relationship of \$B\$ to \$A\$? For example, we might say that \$B\$ is a \$\Sigma'\$-restriction of \$A\$, or something like that? It seems wrong to use the word "subalgebra" in this context.

Here is an example: the semiring of natural numbers \$\mathbb{N}\$ is contained in the ring of real numbers \$\mathbb{R}\$. This makes \$\mathbb{N}\$ a what of \$\mathbb{R}\$? A subsemiring? What is the general phrase? A \$\Sigma'\$-subalgebra? I would prefer a word which does not refer to the signature explicitly.

The concrete example which I need this for is when \$A\$ is the \$\Sigma\$-algebra freely generated by a set of generators \$X\$ and \$B\$ is the free \$\Sigma'\$-aglebr freely generated by the same set of generators \$X\$.
 http://mathoverflow.net/questions/95925/what-to-call-substructures-in-universal-algebra-in-which-we-restrict-the-signatur/95927#95927 Answer by Joel David Hamkins for What to call substructures in universal algebra in which we restrict the signature? Joel David Hamkins 2012-05-03T22:19:27Z 2012-05-03T22:28:45Z
If the domain of \$B\$ is the same as \$A\$, but you only forget the interpretation of the extra language elements, then \$B\$ is called a reduct of \$A\$ to signature \$\Sigma'\$. But you don't merely have a reduct, since you are taking a substructure in the smaller language. Thus, what you have is that \$B\$ is a substructure of the reduct of \$A\$ to \$\Sigma'\$. Having needed this concept in a recent article, I used the term reduct substructure in exactly this situation, but I haven't seen this terminology elsewhere and I don't think there is an established terminology.


text:
# Homework Help: Understanding Arc Length

1. Dec 19, 2011

### Screen

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

This is probably very simple, but I'm teaching myself arc length via Paul's Online Calculus Notes and there's a simplification on the page:

I was wondering why the first $Δx^2$ was simplified to 1? I understand the other $Δx^2$ came out of the square root.

2. Dec 19, 2011

### vela

Staff Emeritus
What you're thinking is akin to $\sqrt{a^2+b^2} = \sqrt{a^2+1}\ b$, which isn't correct. You can only pull something out of a radical if it's a factor. What Paul is doing is this:
$$\sqrt{\Delta x^2 + [f'(x_i^*)]^2 \Delta x^2} = \sqrt{\Delta x^2(1 + [f'(x_i^*)]^2)}$$Now because Δx2 is a factor under the radical, you can say
$$\sqrt{\Delta x^2(1 + [f'(x_i^*)]^2)} = \sqrt{\Delta x^2}\sqrt{1 + [f'(x_i^*)]^2}= \Delta x \sqrt{1 + [f'(x_i^*)]^2}$$

3. Dec 19, 2011

### Screen

Oh you are completely right, sorry for such a silly question and thank you for explaining.