Tuesday 3 September 2019

python notes

Basics

variables and assignment

Variable can be combination of only letters and numbers and underscore "_". Can't start with a number. Variable names are case sensitive. Also, variable cannot have reserved words in python.

Types:-
  1. Integer: stores integer values, 1, -12 etc. "x=1".
  2. Float: stores floating values like 1.0, 1.2e-12 etc. "x=-12.56","x=float(1)".
  3. Complex: stores complex numbers. "x=1e12 + 12.65j","x=complex(1.5)".
  4. string: stores text in form of string of letters. "x="this is a string of words"".
"x=1" is same as "x = 1". Spaces in the beginning of a line has a meaning.

Input and output statements

  • print(x),print("the value of x is",x," and the value of y is",y)
  • x=input("the value of x is:")

Monday 19 August 2019

Open Quantum system

Probability Theory

$\Omega$, the sample space, is the space of events. The most basic indivisible event $\omega \in \Omega$ is called elementary event.
We are usually interested only in a subset $A \in P(\Omega)$. This A is called a $\sigma$-algebra, and by definition should satisfy following conditions-
  1. $\Omega , \emptyset \in A$. 
  2. For all $A_1 ,A_2 \in A$, $A_1 \cap A_2 , A_1 \cup A_2 \in A$.
  3. For some mysterious reason, if $A_1,A_2,... \in A$, where the $A_n$'s are countably many, then $\cup_{n=1} ^\infty A_n \in A$. Why doesn't this automatically follow from the second condition?
Probability measure is a map $\mu : A \rightarrow [0,1]$. 
$\mu (A|B)$ means probability that A will happen given B has happened. If occurrence of B does not change the likelihood of A, then A and B are called statistically independent of each other.
The $\sigma$-algebra of Borel sets of R is the smallest $\sigma$-algebra which contains all subsets of the form $(-\infty, x), x \in R$. Borel Set contains all open and closed intervals of the real axis.

Random variable 

is a map $X: \Omega \rightarrow R$, which assigns to each elementary event $\omega \in \Omega$ a real number $X(\omega)$.
A further condition on the function X is that each point on the number line must be mapped to some $\omega \in A$, so that the reverse mapping exists for each point on the number line.

Stochastic process

It is a time dependent random variable.
Practically, it is understood with the means of probability dependent paths evolving with time, as a function of the real line.
$P(B_1,t_1; B_2;t_2;...;B_m,t_m) \equiv \mu (X(t_1)\in B_1, X(t_2) \in B_2, ..., X(t_m) \in B_m)$
The above equation means that the probability that a particle will evolve through Borel sets $B_1, B_2,...,B_m$ at discrete times $t_1,t_2,...,t_m$ depends on the path, and is denoted by the LHS notation.
As further elucidation, note that
$$P(R,t)=1$$
$$P(B_1,t_1; B_2;t_2;...;B_m,t_m) \geq 0$$
$$P(B_1,t_1; B_2,t_2;...;B_m,t_m;R,t_{m+1})=P(B_1,t_1; B_2;t_2;...;B_m,t_m)$$
Note that generally, the probability that a certain path will jump to some other path might depend on its past. So, the jump probability is a function of past values of the path. This not the case in Markovian evolution.

Markov process

A stochastic evolution of a path with short memory. Precisely,
$$X(t_{m+1}) \in B| X(t_m)=x_m, ... , X(t_1) = x_1)= \mu(X(t) \in B| X(t_m)=x_m)$$
where, $t_1 < t_2 < ... < t_m < t_{m+1}$. This equation means that the probability that the jump to B happens depends only on $x_m$.
Let $T(x,t|x',t') \equiv p_{1|1}(x,t|x',t')$ mean the probability that the jump from x' at t' to x at t happens. The RHS is called conditional transition probability or propagator.

Chapman-Kolgorov equation

$$T(x_3,t_3|x_1,t_1)= \int dx_2 T(x_3,t_3|x_2,t_2)T(x_2,t_2|x_1,t_1)$$
In the differential form,
$$\frac{\partial}{\partial t}T(x,t|x',t')=A(t)T(x,t|x',t')$$
Here, A(t) is a linear operator, a matrix with uncountably large size, which acts on the real number. Explicitly,
$$A(t)T(x,t|x',t') \equiv \lim_{\Delta t\to 0} \frac {1}{t}\left[ \int dx'' T(x,t+ \Delta t|x'',t)T(x,t|x',t')\right]$$
Note that both these equations are valid generally, not just valid for the Markov process.

Stationary and homogeneous stochastic processes

A stochastic process is stationary if the probability weight of all the paths remain invariant under time translation. Explicitly,
$$p_m(x_m,t_m +T;...;x_1,t_1 + T)= p_m(x_m,t_m;...;x_1,t_1)$$
A homogeneous process is one in which the propagator, T(x,t|x',t,) depends only on t-t', for a given x. So, a homogeneous process is statistically time invariant, while a stationary process's probability distribution remains invariant in time. An example of a process which is homogeneous but not stationary is Wiener process, they claim. Wiener process is just Brownian motion. Brownian motion is not stationary because it spreads.

Thursday 18 July 2019

Latex notes

Latex notes

  • The write notation for dagger is \dagger and not \dag. Check for instance, $\dagger$ and $\dag$ (This error is intended for illustration).
  • Curly bracket, if intended to be visible, should be denoted by \{ and \}. For example, $\} \{$.
  • Three dots $\cdots$ \cdots 

Random Math notes

Random Math notes

  • Trace of any operator $A$ is preserved under unitary change of basis $U$ because in the new basis, $A' = U^{\dagger}AU$ and $Tr\{AB\}=Tr\{BA\}$ implies $Tr\{A'\}=Tr\{A\}$.
  • Note that $e^{A+B}=e^A . e^ B$ only if A and B commute. If they don't commute, the RHS will have terms of the type $C_{n,r} A^{n-r}B^r$ while the similar terms on LHS will be of the form $A^{n-r}B^r + A^{n-r-1}BAB^{r-1} + \cdots + B^{r}A^{n-r}$. If the terms don't commute, then these similar terms on LHS and RHS are not really equivalent. If they commute, then they are equal.

Monday 15 July 2019

How to solve Pyramid solitaire (work in progress)

How to solve Pyramid solitaire (work in progress)

There are 52 cards in the pyramid solitaire, out of which 28 are in visible in the form of a pyramid, while the remaining 24 are stacked together in an unknown order. So, by looking at the visible cards, we can know what is there in the stacked ones.
The version of Pyramid Solitaire that I am interested in right now is where it is possible to go through the stacked cards three times.
Now, A can annihilate Q, 2 can annihilate J and so on. In good interest, one wants to annihilate the cards already in the pyramid with each other, so that the stacked cards options don't get exhausted.

Here is the instruction to solve or find whether the card stack is solvable or not-
  1. Make a list of A, 2, 3,... , Q and note how many of these cards are there in the pyramid.
  2. If there are x A's and y Q's in the pyramid, then there has to be at least $z=x+y-4$ links between A and Q within the pyramid, which means that at least z number of pairs of A and Q must annihilate themselves within the pyramid itself. This restriction for all the other pairs puts an upper limit to the score in the solitaire as well as reducing the possible solution space to be scanned.
  3. Note that it is possible for a pyramid to compulsorily have no links within if sum of each of its pairs is 4 and there are also 4 kings in the pack, which will add up to 28. Also note that if there are less than 4 kings, then at least one compulsory interlink exists.

Thursday 23 May 2019

Deriving electromagnetism from relativity and electrostatics.

Part 1: Liénard–Wiechert potential

The Liénard–Wiechert potential is given by-
$$\varphi(\mathbf{r}, t) = \frac{1}{4 \pi \epsilon_0} \left(\frac{q}{(1 - \mathbf{n} \cdot \mathbf{v_s})|\mathbf{r} - \mathbf{r}_s|} \right)_{t_r}$$
Here, $q$ is the source charge, $n$ is unit vector pointing towards the charge from location $\mathbf{r}$, $v_s$ is the source velocity at a retarded time, and $\mathbf{r}$ is the source location at a retarded time.

There is a similar potential given in Feynman Lecture Vol. 2 which is only an approximation and misses the $\frac{1}{1 - \mathbf{n} \cdot \mathbf{v_s}}$ factor. In spite of the extra factor in the LW potential, it is simpler because the local time component $\varphi$ of four vector field potential is invariant under Lorentz transformation. We will prove this now. The advantage of this invariance is that once we know the local field potential, we do not need to worry about change in the far away charge distribution after Lorentz transformation. The local four vector field potential contains the complete information about the far-away charges. The same is not true for the approximate potential given in the Feynman Lecture.

The equation given in Feynman lecture is different because it is inside an integral. When doing this integral, the required factor will turn up, due to apparent change in the size of a body approaching or receding from us, due to the fact that speed of light is finite for all observers. If speed of light was infinite, approaching bodies will not appear larger, and so would charge.

Let there be a source charge stationary at point $(x_0,y_0,0)$ with respect to an observer O at origin. Let there be another observer $O'$ at origin, moving with velocity $\mathbf{v}=-v \hat{i}$. Then locally, in the $O'$ frame, one would expect that $$\varphi '=\gamma \varphi$$, where $\gamma=\frac{1}{\sqrt{1-v^2}}$.

Let us see whether the same result follows from LW potential in the new frame.

In the frame O,
$$\varphi(0, t) = \frac{1}{4 \pi \epsilon_0} \left(\frac{q}{|\mathbf{r}|}\right)$$
In the new frame,
$$\varphi \prime(0, t) = \frac{1}{4 \pi \epsilon_0} \left(\frac{q}{(1 - \mathbf{n'} \cdot \mathbf{v})|\mathbf{r'}|}\right)$$

Note that in the new frame, $x_0 '=\gamma (x_0 + vr)$ where $r=\sqrt {x_0^2+y_0^2}$. Also, $y_0\prime=y_0$.
Also, Note that $$(1 - \mathbf{n'} \cdot \mathbf{v})=1-\frac{v x_0 '}{r'}$$, where $r'=\sqrt {x_0 '^2+y_0^2}$
$$=\frac{r\prime -v x_0\prime}{r\prime}$$
$$\implies \varphi \prime(0, t) = \frac{1}{4 \pi \epsilon_0} \left(\frac{q}{r\prime -v x_0\prime }\right)$$
Now, $r\prime -x_0\prime v$ turns out to be equal to $\frac {r}{\gamma}$, as can be checked. Hence, we obtain the expected equation.

Part 2: The actual Proof

Let there be a source charge stationary at point $(x_0,y_0,0)$ with respect to an observer O at origin. Let there be a charge $q$ at the origin moving with the velocity $\mathbf{u'}=u_x \hat{i}+u_y \hat{j}$ w.r.t O. Let there be another observer $O'$ at origin, moving with velocity $\mathbf{v}=v \hat{i}$, such that in the O' frame, the source appears to move with velocity $-v \hat{i}$.

What we are going to prove is, if we assume that for a stationary source, electrostatic force is as given by coulomb's law, then a Lorentz transformation of this force from frame O to O' is equivalent to the force arising from electromagnetic fields generated when solving the same result using the LW potential.

According to electromagnetic theory:-
$$\mathbf{E}=-\nabla \varphi - \frac{\partial \mathbf{A}}{\partial t}$$
$$\mathbf{B}=\nabla \times \mathbf{A}$$
$$ \mathbf{F}\propto \left( \mathbf{E} + \mathbf{B} \times \mathbf{v}\right)$$
Now, $\nabla \varphi = \varphi _x +\varphi _y + \varphi _z$. Also, 
$$\varphi_x= \frac{-x_0}{r^3}$$
$$\varphi_y= \frac{-y_0}{r^3}$$
$$\varphi_z=0$$
Then, in the O' frame,
$$\varphi '=\gamma \varphi$$
$$\mathbf{A}=-\gamma v \varphi$$
$$-\varphi _x' - \frac{\partial \mathbf{A'}}{\partial t} = \frac {\varphi \prime _x}{\gamma} = \varphi _x$$, because $\frac {\partial \mathbf {A'}}{\partial t}$ cancels the time component of $\varphi \prime _x'$ as seen in the O frame.
$$\implies \mathbf{E'}=\varphi _x \hat{i} + \gamma \varphi _y \hat{j}$$
Also, $$\mathbf{B'}=-v \gamma \varphi _y \hat{k}$$
$$\mathbf {F'}=q \left( \mathbf{E'} + \mathbf {B'}(u_y \prime \hat{i} - u_x \prime \hat{j})  \right)$$
Note that $u_y \prime$ and $u_x \prime$ are the velocity components of the second charge placed at origin, as seen in the O' frame.
Now in the frame O, $F=\varphi _x \hat{i} + \varphi _y \hat{j}= F_x \hat{i}+F_y \hat{j}$.
Let $ F'=F'_{x'} \hat{i}+ F'_y \hat{j}$.

Then $$F'_{x'}=F_x - \frac {F_y v u_y}{1- v u_x}$$.
Also, $$F'_y= \gamma F_y + v \gamma F_y \left( \frac {u_x -v}{1- v u_x} \right)$$
$$\implies F'_y= \frac {F_y}{\gamma (1-v u_x)}$$

This is the force that you would get when you apply Lorentz transformation from frame O to O'.

Concluding points

  1. The LW potentials are completely part of classical electromagnetism. But it can be noted that classical electromagnetism is not consistent under Galilean transformation. The correct transformation that preserves invariance of experimental results between inertial frames is that given by Lorentz transformation, which was discovered before Einstein's result.
  2. Hence magnetism is nothing more than relativistic effects on Force acting on a moving body as viewed from a frame of reference other than the one in which the object is stationary. It should be noted that this should apply for other forces of nature as well. For example gravito-magnetism is as real an effect.
  3. What I did in this post was what was historically done in the reverse order. Relativity was deduced to make electromagnetism consistent. I, instead, assumed SR and derived EM as a consequence. It should be noted though that SR is more fundamental than EM.

Saturday 18 May 2019

Axioms of Set theory

A very good video explaining the axioms of Set theory. https://youtu.be/zcvsyL7GtH4

Following are the 9 axioms of Set Theory.

  1. Axiom of extensionality: Two sets are equal (are the same set) if they have the same elements.
  2. Axiom of regularity (also called the Axiom of foundation): If element of a set X is another set Y, then X and Y are disjoint. This means Y cannot contain any elements that X contains, including Y itself. Hence, this prevents Y from containing itself.
  3. Axiom schema of specification (also called the axiom schema of separation or of restricted comprehension): In order to avoid paradoxes, if you are building a set X by describing some property of its elements, then you need to specify another set Y from where you need to pick the elements of X in question. (Note: Wikipedia says that this restriction is necessary to avoid Russell's paradox, but I do not see how, since the Paradox can be solved simply by applying the axiom of Regularity- Set that contains itself does not exist in the first place. Russell's paradox questions the existence of set of all sets that do not contain themselves.)
  4. Axiom of pairing: If x and y are sets, then there exists a set which contains x and y as elements.
  5. Axiom of union: The union over the elements of a set exists
  6. Axiom schema of replacement: When a function f acts on a set X, the image or the range of X is also a set.
  7. Axiom of infinity: There exist a set of infinite size.
  8. Axiom of power set: Power set exists for every set.
  9. Axiom of choice: Given a set X that contains other non empty sets $Y_1, Y_2, Y_3$ etc. within it. Then there exists a function f from X to $Y_1 \cup Y_2 \cup Y_3 \cup...$ such that $f(Y_n) \in Y_n$.

Proof of Godel's incompleteness Theorem

 This proof borrows from the book 'Godel's proof' by Nagel and Newman.

First Incompleteness theorem:


The first incompleteness theorem states that 'Any consistent formal system F within which a certain amount of elementary arithmetic can be carried out is incomplete; i.e., there are statements of the language of F which can neither be proved nor disproved in F.'
  1. Uniquely number every theorem in a system of mathematics. We can do this by assigning 10 symbols like $0$,$1$,$\subset$ (short for ‘if . . . then . . .’) etc a number between 1 to 10. Also, we can assign numerical variables, sentential variables and predicate variables to first, second and third powers of prime numbers greater or equal to 11, respectively. Note that the use of prime number ensures that all these variables get assigned a unique number, because otherwise $11^2$ is nothing but 121. Another way of doing it could have been assigning 11, 12 and 13 with variable of each type sequentially, and so on.
  2. Now that each letter of the language has a unique numerical representation, we assign a number to a formula by raising the nth prime to the power of the numerical value of the nth symbol, and taking product of all such numbers. Strings of formulas separated by comma is also a formula.
  3. The fact that a formula with Godel number x is the proof of a Godel number z hints towards a mathematical property that these two numbers share in the general case. This mathematical property depends upon the syntax as well as the rule of inference of the proof system. Let us denote the fact that the numbers x and z share this specific property by the formula $ Dem(x,z)$. This formula might not be true for a given value of x and z. Note that here, $Dem$ is a predicate variable.
  4. Next, let $sub(m,13,m)$ denote the Godel number of the formula that you get when you replace in the formula with Godel number m, each occurrence of the variable with Godel number 13 (here y) the number m.
  5. Now, note the meaning of $\sim \exists x Dem(x,sub(n,13,n))$ where n is Godel number of the statement $\sim \exists x Dem(x,sub(y,13,y))$. Note that $sub(n,13,n)$ is just the Godel number of the first formula. Hence, the first formula states that it cannot be proven within the system. (Although seen at mathematical level, the first formula just claims that a number does not have a given mathematical property. It is only when interpreted at metamathematical level that we infer a second layer of meaning to this statement- that it is claiming that it cannot be proven within the system). Now, if this statement is false, then it can be proven. A system of mathematics that can prove even false results is inconsistent. Hence, it must be true, and hence cannot be proven.
  6. Note that $\sim \exists x Dem(x,sub(n,13,n))$ expresses a property that no number possesses. Hence, it represents a new axiom of mathematics.

Notes:-
  1. If there are finitely many rules of inference, then Godel's theorem holds. If there are infinitely many of them, then we get another Godel like situation, where instead of infinite axioms, there infinite rules of inference. But the question is, is there an equivalent formulation of logic where there are only axioms but no rule of inference? I don't think so. Rules of inference are necessary to get from one axiom to another. They can be encompassed by a property that Godel numbers possess, as given by $Dem(x,z)$. Hence the rules of inference link numbers based on some property. Godel statement of a system of axioms is a statement that numbers don't possess a certain property.
  2. How does the choice of syntax affect the numerical relations as in $Dem(x,z)$? There should be some invariance regarding some general properties of these relations, independent of the choice of syntax.

Second Incompleteness theorem


The second incompleteness theorem states that 'Assume F is a consistent formalized system which contains elementary arithmetic. Then the consistency of F is not provable within F.'

The proof of the second incompleteness theorem follows from the first one. Even though the Godel statement G of a system F states that it is not provable, the reason why we cannot prove it within the system is that we are assuming that our system is consistent, and hence cannot prove a statement which says that it is not provable. Hence the consistency of F implies its incompleteness. The last sentence itself can be formalized as a theorem in F, and can also be proven within F. The proof follows because if we know that our system is consistent, then there is no more barrier in proving that G must be true. It is the lack of proof of consistency that prevents a proof a G. But if G is proven, then we will get an absurd result. Hence if F is consistent, its consistency itself is necessarily not provable to establish the non-provability of G.