# DO

While DOLIST and DOTIMES are convenient and easy to use, they aren’t flexible enough to use for all loops. For instance, what if you want to step multiple variables in parallel?

(do (variable-definition*)
(end-test-form result-form*)
statement*)


— Practical Common Lisp

— Peter Seibel

.

(defun split-if (fn lst)
(let ((acc nil))
(do ((src lst (cdr src)))
((or (null src) (funcall fn (car src)))
(values (nreverse acc) src))
(push (car src) acc))))


 >(split-if #'(lambda (x) (> x 4)) '(1 2 3 4 5 6 7 8 9 10))

(1 2 3 4) (5 6 7 8 9 10)

— p.50

— On Lisp

— Paul Graham

.

Exercise 4.5

Implement the function split-if without using the macro do.

— Me@2019-01-30 09:58:30 PM

.

.

2019.01.30 Wednesday ACHK

# Problem 14.5d3

Counting states in heterotic SO(32) string theory | A First Course in String Theory

.

d) Write a generating function $\displaystyle{f_L(x) = \sum_{r} a(r) x^r}$ for the full set of GSO-truncated states in the left-moving sector (include both NS’+ and R’+ states).

Use the convention where $\displaystyle{a(r)}$ counts the number of states with $\displaystyle{\alpha' M_L^2 = r}$.

Use $\displaystyle{f_L(x)}$ and an algebraic manipulator to find the total number of states in heterotic string theory at $\displaystyle{\alpha' M_L^2 = 8}$.

~~~

.

— This answer is my guess. —

~~~

.

\displaystyle{ \begin{aligned} \alpha' M_L^2: \end{aligned}}

.

\displaystyle{ \begin{aligned} &f_{L, NS'+}(x) \\ &= a_{NS'+} (r) x^r \\ &= \frac{1}{2x} \left[ \prod_{r=1}^\infty \frac{(1 + x^{r-\frac{1}{2}})^{32}}{(1 - x^r)^8} + \prod_{r=1}^\infty \frac{(1 - x^{r-\frac{1}{2}})^{32}}{(1 - x^r)^8} \right] \\ & \\ &= \frac{1}{x} + 504 + 40996 x + 1384320 x^{2} + ... \\ \end{aligned}}

.

\displaystyle{\begin{aligned} &f_{L, R'+}(x) \\ &= a_{R'+} (r) x^r \\ &= 2^{15} x \prod_{r=1}^\infty \frac{(1 + x^{r})^{32}}{(1 - x^r)^8} \\ & \\ &= 32768 \, x+1310720 \, x^{2}+27131904 \, x^{3}+387973120 \, x^{4}+4312727552 \, x^{5} + ... \end{aligned}}

.

\displaystyle{ \begin{aligned} \alpha' M_R^2: \end{aligned}}

\displaystyle{ \begin{aligned} f_{NS+}(x) &= 8 + 128 \, x + 1152 \, x^{2} + 7680 \, x^{3} + 42112 \, x^{4} + ... \\ \end{aligned}}

\displaystyle{ \begin{aligned} f_{R-}(x) &= 8 + 128 x + 1152 x^{2} + 7680 x^{3} + 42112 x^{4} + ... \\ \end{aligned}}

.

So the total number of states in heterotic string theory at \displaystyle{ \begin{aligned} \alpha' M^2 = 8 \end{aligned}} is

\displaystyle{ \begin{aligned} &\left(1384320 + 1310720 \right) \times \left(1152 + 1152\right) \\ \end{aligned}}.

\displaystyle{ \begin{aligned} &= 6209372160 \\ \end{aligned}}.

~~~

— This answer is my guess. —

— Me@2019-01-26 04:49:37 PM

.

.

# Quantum logic, 3

The more common view regarding quantum logic, however, is that it provides a formalism for relating observables, system preparation filters and states.$^\text{[citation needed]}$ In this view, the quantum logic approach resembles more closely the C*-algebraic approach to quantum mechanics. The similarities of the quantum logic formalism to a system of deductive logic may then be regarded more as a curiosity than as a fact of fundamental philosophical importance. A more modern approach to the structure of quantum logic is to assume that it is a diagram – in the sense of category theory – of classical logics (see David Edwards).

— Wikipedia on Quantum logic

.

.

2019.01.26 Saturday ACHK

# PhD, 3.2

.

（問：那樣，會不會在你成功，出版學術文章之前，就已經被同行之中的害群之馬，盜取了你的原創概念，從而捷足先登，出版了文章？）

（問：你的「其精神」，是指「release early, release often」？）

（問：你的意思是，要透過每天出版一篇短文，累積成每數個月一篇，可出版的學術期刊文章；然後，再透過那數篇學術期刊文章，累積成你那本博士論文？）

— Me@2019-01-22 06:46:23 PM

.

.

# duplicate

If (member o l) finds o in the list l, it also returns the cdr of l beginning with o. This return value can be used, for example, to test for duplication. If o is duplicated in l, then it will also be found in the cdr of the list returned by member. This idiom is embodied in the next utility, duplicate:
 >(duplicate ’a ’(a b c a d)) (A D) 

(defun duplicate (obj lst &key (test #’eql))
(member obj (cdr (member obj lst :test test))
:test test))


— p.51

— On Lisp

— Paul Graham

.

Exercise 4.4

Without using the existing function member, define duplicate as in
 >(duplicate ’a ’(a b c a d)) (A D)

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

— This answer is my guess. —


(defun my-member (obj lst)
(cond ((not lst) NIL)
((eq obj (car lst)) lst)
(t (my-member obj (cdr lst)))))



— This answer is my guess. —

— Me@2019-01-21 06:34:46 AM

.

.

# Problem 14.5d2

Counting states in heterotic SO(32) string theory | A First Course in String Theory

.

d) Write a generating function $\displaystyle{f_L(x) = \sum_{r} a(r) x^r}$ for the full set of GSO-truncated states in the left-moving sector (include both NS’+ and R’+ states).

Use the convention where $\displaystyle{a(r)}$ counts the number of states with $\displaystyle{\alpha' M_L^2 = r}$.

Use $\displaystyle{f_L(x)}$ and an algebraic manipulator to find the total number of states in heterotic string theory at $\displaystyle{\alpha' M_L^2 = 8}$.

~~~

.

— This answer is my guess. —

~~~

.

The left R’+ sector:

.

\displaystyle{\begin{aligned} (-1)^{F_L} |R_\alpha \rangle_L &= + |R_\alpha \rangle_L \\ (-1)^{F_L} |R_\alpha \rangle_R &= - |R_\alpha \rangle_L \\ \end{aligned}}

.

\displaystyle{\begin{aligned} \alpha'M^2=1,~~~&N^\perp = 0:~~~~~&|R_{\alpha} \rangle_L \\ \alpha'M^2=2,~~~&N^\perp = 1:~~~~~&|{\bar \alpha}_{-1} |R_\alpha \rangle_L, \lambda_{-1} |R_\alpha \rangle_R \\ \end{aligned}}

.

\displaystyle{ \begin{aligned} \alpha' M_L^2 &= 1 + N^\perp \\ \end{aligned}}

$\displaystyle{N^\perp:}$

\displaystyle{\begin{aligned} \left( 1 + \bar \alpha_1 x + (\bar \alpha_1)^2 x^2 + ... \right)^8 \left( 1 + \bar \alpha_2 x + (\bar \alpha_2)^2 x^4 + ... \right)^8 ... \left( 1 + \lambda_{-1} x^{1} \right)^{32} \left( 1 + \lambda_{-2} x^{2} \right)^{32} ... \\ \end{aligned}}

.

However, there are $\displaystyle{2^{15}}$ ground states $\displaystyle{|R_\alpha\rangle_L}$ and $\displaystyle{2^{15}}$ ground states $\displaystyle{|R_\alpha \rangle_R}$:

\displaystyle{\begin{aligned} (2^{15} + 2^{15}) \left[ \left( 1 + \bar \alpha_1 x + (\bar \alpha_1)^2 x^2 + ... \right)^8 ... \left( 1 + \lambda_{-1} x^{1} \right)^{32} ... \right] \\ \end{aligned}}

\displaystyle{\begin{aligned} 2^{16} \prod_{r=1}^\infty \frac{1}{(1 - x^r)^8} (1 + x^{r})^{32} \\ \end{aligned}}

.

“Keep only states with $\displaystyle{(-1)^{F_L} = +1}$; this defines the left R’+ sector.”

\displaystyle{\begin{aligned} \frac{2^{16}}{2} \prod_{r=1}^\infty \frac{(1 + x^{r})^{32}}{(1 - x^r)^8} \\ \end{aligned}}

.

\displaystyle{ \begin{aligned} \alpha' M_L^2: \end{aligned}}

\displaystyle{\begin{aligned} &f_{L, R'+}(x) \\ &= a_{R'+} (r) x^r \\ &= 2^{15} x \prod_{r=1}^\infty \frac{(1 + x^{r})^{32}}{(1 - x^r)^8} \\ & \\ &= 32768 \, x+1310720 \, x^{2}+27131904 \, x^{3}+387973120 \, x^{4}+4312727552 \, x^{5}+39739981824 \, x^{6} + ... \end{aligned}}

.

~~~

— This answer is my guess. —

— Me@2019-01-20 09:09:37 PM

.

.

# Logical arrow of time, 6.4

The source of the macroscopic time asymmetry, aka the second law of thermodynamics, is the difference of prediction and retrodiction.

In a prediction, the deduction direction is the same as the physical/observer time direction.

In a retrodiction, the deduction direction is opposite to the physical/observer time direction.

.

— guess —

If a retrodiction is done by a time-opposite observer, he will see the entropy increasing. For him, he is really doing a prediction.

— guess —

.

— Me@2013-10-25 3:33 AM

.

The existence of the so-called “the paradox of the arrow of time” is fundamentally due to the fact that some people insist that physics is about an observer-independent objective truth of reality.

However, it is not the case. Physics is not about “objective” reality.  Instead, physics is always about what an observer would observe.

— Lubos Motl

— paraphrased

— Me@2019-01-19 10:25:15 PM

.

.

# Good intentions

.

The road to hell is paved with good intentions.

.

Hell is full of good meanings, but heaven is full of good works.

.

.

2019.01.19 Saturday ACHK

# （反對）開夜車 2.1

Ken Chan 時光機 1.4.2.1

.

.

.

（我暫時不記得，他以下說話的上半句是什麼。）

… 如何不是那樣，我就毋須於，放榜當天的晚上，在家裡哭。唉！還是不說了。

.

.

— Me@2019-01-18 03:47:50 PM

.

.

# Equality Predicates

6.3. Equality Predicates

Common Lisp provides a spectrum of predicates for testing for equality of two objects: eq (the most specific), eql, equal, and equalp (the most general).

eq and equal have the meanings traditional in Lisp.

eql was added because it is frequently needed, and equalp was added primarily in order to have a version of equal that would ignore type differences when comparing numbers and case differences when comparing characters.

If two objects satisfy any one of these equality predicates, then they also satisfy all those that are more general.

.

[Function]
eq x y

(eq x y) is true if and only if x and y are the same identical object. (Implementationally, x and y are usually eq if and only if they address the same identical memory location.)

.

The predicate eql is the same as eq, except that if the arguments are characters or numbers of the same type then their values are compared. Thus eql tells whether two objects are conceptually the same, whereas eq tells whether two objects are implementationally identical. It is for this reason that eql, not eq, is the default comparison predicate for the sequence functions defined in chapter 14.

.

[Function]
eql x y

The eql predicate is true if its arguments are eq, or if they are numbers of the same type with the same value, or if they are character objects that represent the same character.

.

[Function]
equal x y

The equal predicate is true if its arguments are structurally similar (isomorphic) objects. A rough rule of thumb is that two objects are equal if and only if their printed representations are the same.

Numbers and characters are compared as for eql. Symbols are compared as for eq. This method of comparing symbols can violate the rule of thumb for equal and printed representations, but only in the infrequently occurring case of two distinct symbols with the same print name.

.

[Function]
equalp x y

Two objects are equalp if they are equal; if they are characters and satisfy char-equal, which ignores alphabetic case and certain other attributes of characters; if they are numbers and have the same numerical value, even if they are of different types; or if they have components that are all equalp.

— Common Lisp the Language, 2nd Edition

— Guy L. Steele Jr.

.

Conrad’s Rule of Thumb for Comparing Stuff:

1. Use eq to compare symbols

2. Use equal for everything else

— Land of Lisp, p.63

— Conrad Barski, M. D.

.

.

2019.01.16 Wednesday ACHK

# Problem 14.5d1.1.2

Counting states in heterotic SO(32) string theory | A First Course in String Theory

.

d) Write a generating function $\displaystyle{f_L(x) = \sum_{r} a(r) x^r}$ for the full set of GSO-truncated states in the left-moving sector (include both NS’+ and R’+ states).

Use the convention where $\displaystyle{a(r)}$ counts the number of states with $\displaystyle{\alpha' M_L^2 = r}$.

Use $\displaystyle{f_L(x)}$ and an algebraic manipulator to find the total number of states in heterotic string theory at $\displaystyle{\alpha' M_L^2 = 8}$.

~~~

.

— This answer is my guess. —

~~~

p.322

$\displaystyle{\alpha' M_L^2 = \alpha' M_R^2}$

$\displaystyle{\frac{1}{2} \alpha' M^2 = \alpha' M_L^2 + \alpha' M_R^2}$

$\displaystyle{\alpha' M^2 = 2 \left( \alpha' M_L^2 + \alpha' M_R^2 \right) = 4 \alpha' M_L^2}$

.

The left NS’+ sector:

\displaystyle{ \begin{aligned} \alpha' M_L^2 &= -1 + N^\perp \\ \end{aligned}}

$\displaystyle{N^\perp:}$

\displaystyle{\begin{aligned} \left( 1 + \bar \alpha_1 x + (\bar \alpha_1)^2 x^2 + ... \right)^8 \left( 1 + \bar \alpha_2 x + (\bar \alpha_2)^2 x^4 + ... \right)^8 ... \left( 1 + \lambda_{-\frac{1}{2}} x^{\frac{1}{2}} \right)^{32} \left( 1 + \lambda_{-\frac{3}{2}} x^{\frac{3}{2}} \right)^{32} ... \\ \end{aligned}}

\displaystyle{\begin{aligned} \prod_{r=1}^\infty \frac{1}{(1 - x^r)^8} (1 + x^{r-\frac{1}{2}})^{32} \\ \end{aligned}}

.

\displaystyle{ \begin{aligned} \alpha' M_L^2: \end{aligned}}

\displaystyle{\begin{aligned} &f_{L, NS'}(x) \\ &= a_{NS'} (r) x^r \\ &= \frac{1}{x} \prod_{r=1}^\infty \frac{(1 + x^{r-\frac{1}{2}})^{32}}{(1 - x^r)^8} \\ \end{aligned}}

.

“The left NS’ sector is built with oscillators $\displaystyle{\bar \alpha_{-n}^I}$ and $\displaystyle{\lambda_{-r}^A}$ acting on the vacuum $\displaystyle{|NS' \rangle_L}$, declared to have $\displaystyle{(-1)^{F_L} = + 1}$:”

$\displaystyle{(-1)^{F_L} |NS' \rangle_L = + |NS' \rangle_L}$

So all the states with integer $\displaystyle{N^{\perp}}$ have $\displaystyle{(-1)^F = +1}$.

.

\displaystyle{ \begin{aligned} &f_{L, NS'}(x) \\ \end{aligned}}

$\displaystyle{ = \frac{1}{x}+\frac{32}{\sqrt{x}}+504+5248 \, \sqrt{x}+40996 \, x+258624 \, x^{\frac{3}{2}}+1384320 \, x^{2}+6512384 \, x^{\frac{5}{2}} + ...}$

.

Let

\displaystyle{ \begin{aligned} &g (\sqrt{x}) \\ &= \prod_{r=1}^\infty \frac{(1 + x^{r-\frac{1}{2}})^{32}}{(1 - x^r)^8} \\ &= 1+32 \, \sqrt{x}+504 \, x+5248 \, x^{\frac{3}{2}}+40996 \, x^{2}+258624 \, x^{\frac{5}{2}}+1384320 \, x^{3}+6512384 \, x^{\frac{7}{2}} + ... \\ \end{aligned}}

Then

\displaystyle{ \begin{aligned} &g (-\sqrt{x}) \\ &= \prod_{r=1}^\infty \frac{(1 - x^{r-\frac{1}{2}})^{32}}{(1 - x^r)^8} \\ &= 1 - 32 \sqrt{x} + 504 x - 5248 \, x^{\frac{3}{2}} + 40996 \, x^{2} - 258624 \, x^{\frac{5}{2}}+1384320 \, x^{3} - 6512384 x^{\frac{7}{2}} + ... \\ \\ \end{aligned}}

.

\displaystyle{ \begin{aligned} &f_{L, NS'+}(x) \\ &= \frac{1}{x} + 504 + 40996 x + 1384320 x^{2} + ... \\ &= \frac{1}{2x} \left[ g(\sqrt{x}) + g(-\sqrt{x}) \right] \\ &= \frac{1}{2x} \left[ \prod_{r=1}^\infty \frac{(1 + x^{r-\frac{1}{2}})^{32}}{(1 - x^r)^8} + \prod_{r=1}^\infty \frac{(1 - x^{r-\frac{1}{2}})^{32}}{(1 - x^r)^8} \right] \\ \end{aligned}}

.

The left R’+ sector:

\displaystyle{ \begin{aligned} \alpha' M_L^2 &= 1 + N^\perp \\ \end{aligned}}

.

~~~

— This answer is my guess. —

— Me@2019-01-14 04:28:10 PM

.

.

# EPR paradox, 5.3

According to special relativity, in EPR, which of Alice and Bob collapses the wavefunction is not absolute. In other words, they do not have any causal relations.

— Me@2012-04-12 10:42:22 PM

.

.

Publish! 11

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

— Me@2011.07.03

.

.

# PhD, 3.1

.

— Me@2019-01-13 06:22:43 PM

.

.

# Problem 14.5d1.2 | SageMath

The generating function is an infinite product:

\displaystyle{ \begin{aligned} \alpha' M_L^2: \end{aligned}}

\displaystyle{\begin{aligned} &f_{L, NS+}(x) \\ &= a_{NS+} (r) x^r \\ &= \frac{1}{x} \prod_{r=1}^\infty \frac{(1 + x^{r-\frac{1}{2}})^{32}}{(1 - x^r)^8} \\ \end{aligned}}

To evaluate the infinite product, you can use SageMath with the following commands:

typeset_mode(True)

 (1/x)*prod(((1+x^(n-1/2))^(32)/(1-x^n)^8) for n in (1..oo)) a = (1/x)*prod(((1+x^(n-1/2))^(32)/(1-x^n)^8) for n in (1..200)) F = a.taylor(x,0,6) g = "+".join(map(latex, sorted([f for f in F.operands()], key=lambda exp:exp.degree(x)))) 

g

\displaystyle{ \begin{aligned} &f_{L, NS+}(x) \\ \end{aligned}}

$\displaystyle{ \approx \frac{1}{x}+\frac{32}{\sqrt{x}}+504+5248 \, \sqrt{x}+40996 \, x+258624 \, x^{\frac{3}{2}}+1384320 \, x^{2}+6512384 \, x^{\frac{5}{2}} + ...}$

— Me@2019-01-11 11:52:33 AM

.

.

# Problem 14.5d1

Counting states in heterotic SO(32) string theory | A First Course in String Theory

.

d) Write a generating function $\displaystyle{f_L(x) = \sum_{r} a(r) x^r}$ for the full set of GSO-truncated states in the left-moving sector (include both NS’+ and R’+ states).

Use the convention where $\displaystyle{a(r)}$ counts the number of states with $\displaystyle{\alpha' M_L^2 = r}$.

Use $\displaystyle{f_L(x)}$ and an algebraic manipulator to find the total number of states in heterotic string theory at $\displaystyle{\alpha' M_L^2 = 8}$.

~~~

.

— This answer is my guess. —

~~~

p.322

$\displaystyle{\alpha' M_L^2 = \alpha' M_R^2}$

$\displaystyle{\frac{1}{2} \alpha' M^2 = \alpha' M_L^2 + \alpha' M_R^2}$

$\displaystyle{\alpha' M^2 = 2 \left( \alpha' M_L^2 + \alpha' M_R^2 \right) = 4 \alpha' M_L^2}$

.

The left NS’+ sector:

\displaystyle{ \begin{aligned} \alpha' M_L^2 &= -1 + N^\perp \\ \end{aligned}}

$\displaystyle{N^\perp:}$

\displaystyle{\begin{aligned} \left( 1 + \bar \alpha_1 x + (\bar \alpha_1)^2 x^2 + ... \right)^8 \left( 1 + \bar \alpha_2 x + (\bar \alpha_2)^2 x^4 + ... \right)^8 ... \left( 1 + \lambda_{-\frac{1}{2}} x^{-\frac{1}{2}} \right)^{32} \left( 1 + \lambda_{-\frac{3}{2}} x^{-\frac{3}{2}} \right)^{32} ... \\ \end{aligned}}

\displaystyle{\begin{aligned} \prod_{r=1}^\infty \frac{1}{(1 - x^r)^8} (1 + x^{r-\frac{1}{2}})^{32} \\ \end{aligned}}

.

\displaystyle{ \begin{aligned} \alpha' M_L^2: \end{aligned}}

\displaystyle{\begin{aligned} &f_{L, NS+}(x) \\ &= a_{NS+} (r) x^r \\ &= \frac{1}{x} \prod_{r=1}^\infty \frac{(1 + x^{r-\frac{1}{2}})^{32}}{(1 - x^r)^8} \\ \end{aligned}}

.

The left R’+ sector:

\displaystyle{ \begin{aligned} \alpha' M_L^2 &= 1 + N^\perp \\ \end{aligned}}

.

~~~

— This answer is my guess. —

— Me@2019-01-10 01:49:43 PM

.

.

# Consistent histories, 6

.

an observer ~ a consistent history

— Me@2019-01-05 04:02:43 PM

.

.

# Ken Chan 時光機 2.2

— Me@2019-01-06 02:18:47 PM

.

.