Problem 14.5d1.2.3

A First Course in String Theory

.

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 wxMaxima. However, it does not provide \LaTeX rendering of answers yet. Instead, you can call Maxima‘s code in SageMath, if you use Jupyter Notebook to access SageMath.

reset()

%display latex

maxima('taylor((1/x)*product((1 + x^(r - 1/2))^32 / (1 - x^r)^8, r, 1, oo), x, 0, 6)')

\displaystyle {{1}\over{x}}+{{32}\over{\sqrt{x}}}+504+5248\,\sqrt{x}+40996\,x+  258624\,x^{{{3}\over{2}}}+1384320\,x^2+6512384\,x^{{{5}\over{2}}}+  27623826\,x^3+107640288\,x^{{{7}\over{2}}}+390667136\,x^4+1334500992  \,x^{{{9}\over{2}}}+4325559288\,x^5+13390178752\,x^{{{11}\over{2}}}+  39794729472\,x^6+\cdots

— Me@2024-12-02 06:33:46 AM

.

.

2024.12.31 Tuesday (c) All rights reserved by ACHK

SageMath for Ubuntu 24.04

0. In this tutorial, you will need to go to the official website of NixOS. Make sure that its website is the real, official one. Any instructions from an imposter website can get your machine infected with malware.

1. Assuming your computer’s OS is Ubuntu 24.04 or above, go to the NixOS official website. Follow the instructions to install the Nix package manager (not the NixOS operating system) onto your OS. Choose the “single-user installation” method.

.

2. Run this command to install SageMath:

nix-env -iA nixpkgs.sage

3. Run this to open:

sage --notebook=jupyterlab

— Me@2024-11-27 12:28:48 AM

.

.

2024.12.24 Tuesday (c) All rights reserved by ACHK

Euler problem 24.2

import Data.List ( delete )

fac :: (Eq t, Num t) => t -> t
fac n = f n 1
  where
    f 0 acc = acc
    f m acc = f (m - 1) (m * acc)

perms :: Eq a => [a] -> Int -> [a] -> [a]
perms [] _ acc = reverse acc
perms xs n acc
  = perms (delete x xs) (mod n m) (x : acc)
  where 
    m = fac $ length xs - 1
    y = div n m
    x = xs !! y

p24 :: [Char]
p24 = perms "0123456789" 999999 []

λ> :set +s
λ> p24
"2783915460"
(0.02 secs, 121,968 bytes)
λ> 

— Me@2024-11-18 07:22:15 PM

.

.

2024.11.19 Tuesday (c) All rights reserved by ACHK

Euler problem 23.3

Watermelon 3

.

isAbundant[n_] :=
    Module[{sumDivisors},
        sumDivisors = Total[Divisors[n]] - n;
        sumDivisors > n]

abundantNumbers[a_, b_] :=
    Select[
        Range[a, b],
        isAbundant]

L := 28123

abundantList := abundantNumbers[1, L]

firstHalfAbundantList :=
    abundantNumbers[1, Quotient[L,2]]

abundantSums[aList_, bList_] :=
    DeleteDuplicates[
        Flatten[
            Table[
                aList[[i]] + bList[[j]],
                {i, Length[aList]},
                {j, Length[bList]}]]]

nonAbundantSums[limit_] :=
    Total[
        Complement[
            Range[1, limit],
            abundantSums[
                firstHalfAbundantList,
                abundantList]]]

result = Timing[nonAbundantSums[L]]

{1.73236, 4179871}

— Me@2024-10-20 01:49:38 PM

.

.

2024.10.25 Friday (c) All rights reserved by ACHK

Ex 1.29 A particle of mass m slides off a horizontal cylinder, 1.1

Structure and Interpretation of Classical Mechanics

.

A particle of mass m slides off a horizontal cylinder of radius R in a uniform gravitational field with acceleration g. If the particle starts close to the top of the cylinder with zero initial speed, with what angular velocity does it leave the cylinder?

~~~

Along the tangential direction,

\displaystyle{m \frac{dv}{dt} = m g \sin \theta - f_a - f}

Assuming there is only air friction,

\displaystyle{m \frac{dv}{dt} = m g \sin \theta - f_a}

.

If the air resistance \displaystyle{f_a} equals \displaystyle{\frac{\beta m v^2}{2 R}},

\displaystyle{    m \frac{dv}{dt} = m g \sin \theta - \frac{\beta m v^2}{2 R}    }

.

Along the normal direction,

\displaystyle{\begin{aligned}      F_{\text{net}} &= F_C \\    m g \cos \theta - F_R &= \frac{m v^2}{R} \\     \end{aligned}},

where \displaystyle{F_R} is the normal reaction force.

So

\displaystyle{\begin{aligned}      m R \frac{d \dot \theta}{dt} &= m g \sin \theta - \frac{\beta}{2} \left( m g \cos \theta - F_R \right)  \\     R \ddot \theta &=  g \sin \theta - \frac{\beta}{2} \left( g \cos \theta - F_R \right)  \\    \end{aligned}}

This equation is not useful yet, because \displaystyle{F_R(\theta(t))} is still not known. So we keep using the original equation:

\displaystyle{\begin{aligned}      m \frac{dv}{dt} &= m g \sin \theta - \frac{\beta m v^2}{2 R} \\     R \frac{d^2 \theta}{dt^2} &= g \sin \theta - \frac{\beta R \dot \theta^2}{2} \\     \end{aligned}}

Let

\displaystyle{\begin{aligned}      u &= \dot \theta^2 \\    \end{aligned}}

— Me@2023-05-23 11:02:25 AM

.

.

2023.05.25 Thursday (c) All rights reserved by ACHK

Ex 2.1-2 Particle in a Box

Quantum Methods with Mathematica

.

Reproduce Figure 2.1-1 …

~~~

phi[n_, x_] := Sin[n Pi x]

p[n_] := Plot[phi[n,x],{x,0,1}]

GraphicsColumn[{p[1], p[2], p[3]}]

— Me@2023-03-03 01:30:46 PM

.

.

2023.03.05 Sunday (c) All rights reserved by ACHK

Ex 2.1-1 Particle in a Box

Remove["Global`*"]

hbar := \[HBar]

H[V_] @ psi_  := -hbar^2/(2m) D[psi,{x,2}] + V psi

SchD[V_] @  psi_ := H[V] @ psi - En psi

SchD[V[x]] @ psi[x] == 0 // TeXForm

\displaystyle{-\text{En} \psi (x)-\frac{\hbar ^2 \psi ''(x)}{2 m}+\psi (x) V(x)=0}

phi[n_, x_] := Cn Sin[n Pi x/L]

SchD[0] @ phi[n,x] == 0 // ExpandAll

SchD[0] @ phi[n,x] / phi[n,x] == 0 // Simplify // TeXForm

\displaystyle{2 \text{En} L=\frac{\pi ^2 n^2 \hbar ^2}{L m}}

Starting with a linear superposition A E^(Ikx) + B E^(-Ikx) of independent plane waves, where A and B are constants, verify the box eigen-functions and eigen-energies given above.

Thus, show that this superposition is a solution of the Schrodinger equation and, by invoking the boundary condition, that k -> n Pi/L.

— Quantum Methods with Mathematica

phi[k_, x_] := A E^(I k x) + B E^(- I k x)

eq1 := SchD[0] @ phi[k,x]/phi[k,x] == 0 // Simplify

Ek[k_] := En /. Solve[eq1, En] [[1]]

Ek[k] // TeXForm

\displaystyle{\frac{k^2 \hbar ^2}{2 m}}

.

The boundary conditions are \displaystyle{\phi_{x=0} = \phi_{x=L} = 0}.

\displaystyle{  \begin{aligned}  A+B&=0 \\   A e^{i k L}+B e^{-i k L}&=0 \\  \end{aligned}}

So

\displaystyle{  \begin{aligned}  e^{i k L} - e^{-i k L}&=0 \\  \end{aligned}}

Solve[E^(I k L) - E^(-I k L) == 0, k] // Simplify

\displaystyle{  \left\{k\to -\frac{2 \pi  c_1}{L}\text{ if }c_1\in \mathbb{Z}, ~~~k\to -\frac{2 \pi  c_1+\pi }{L}\text{ if }c_1\in \mathbb{Z} \right\}}

\displaystyle{  =\left\{k\to \frac{n \pi }{L}\text{ if }n \in \mathbb{Z}\right\}}

.

phi[n_, x_] := Cn Sin[n Pi x/L]

norm[n_] = Cn /.
    Solve[
        Integrate[ phi[n,x]^2, {x,0,L}] == 1 /.
            Sin[m_Integer n Pi] -> 0, 
        Cn
    ] [[1]] // TeXForm

\displaystyle{  -\frac{\sqrt{2}}{\sqrt{L}}  }

It’s interesting to note in passing that the 1D box eigenfunctions are also classically the eigenfunctions of a taut string. However, whereas the quantum mechanical energies scale as n^2, the classical eigenfrequencies of the string’s normal modes are linear in n. This is a consequence of the classical wave equation being second order in time in contrast to the quantum wave equation being first order.

— Quantum Methods with Mathematica

— Me@2022-12-16 10:23:45 AM

.

.

2022.12.17 Saturday (c) All rights reserved by ACHK

Ex 1.2-1 Stationary States

Quantum Methods with Mathematica

.

Assume a wavefunction of the form psi[x, t] == f[t] psi[x] and perform a separation of variables on the wave equation.

Show that f[t] = E^(-I w t) where h w is the separation constant. Try the built-in function DSolve.

Equate h w to the Energy by evaluating the [expected] value of hamiltonian[V] in the state psi[x, t].

~~~

Remove["Global`*"]


hbar := \[HBar]

H[V_] @ psi_  := -hbar^2/(2m) D[psi,{x,2}] + V psi



psi[x_,t_] := f[t] psi[x]

I hbar D [psi[x,t],t] == H[V] @ psi[x, t]

I hbar D [psi[x,t],t] / psi[x,t] == H[V] @ psi[x,t] / psi[x,t]

\displaystyle{i \hbar  \psi (x) f'(t)=V f(t) \psi (x)-\frac{\hbar ^2 f(t) \psi ''(x)}{2 m}}

\displaystyle{\frac{i \hbar  f'(t)}{f(t)}=\frac{V f(t) \psi (x)-\frac{\hbar ^2 f(t) \psi ''(x)}{2 m}}{f(t) \psi (x)}}

E1 := I hbar D [psi[x,t],t] / psi[x,t] == H[V] @ psi[x,t] / psi[x,t]

Simplify[E1]

\displaystyle{\frac{1}{2} \hbar  \left(\frac{\hbar  \psi ''(x)}{m \psi (x)}+\frac{2 i f'(t)}{f(t)}\right)=V}

E2 := - 1/2 hbar hbar (D[D[psi[x],x],x]/(m psi[x])) == hbar omega

DSolve[E2, psi[x], x]


E3 := 1/2 hbar 2 i D[f[t],t] / f[t] == hbar omega

DSolve[E3, f[t], t]

\displaystyle{\left\{\left\{\psi (x)\to c_1 \cos \left(\frac{\sqrt{2} \sqrt{m} \sqrt{\omega } x}{\sqrt{\hbar }}\right)+c_2 \sin \left(\frac{\sqrt{2} \sqrt{m} \sqrt{\omega } x}{\sqrt{\hbar }}\right)\right\}\right\}}

\displaystyle{\left\{\left\{f(t)\to c_1 e^{\frac{\omega  t}{i}}\right\}\right\}}


k

psi[x_] := c E^(I k x)

psi[x]

f[t_] := E^(-I omega t)

f[t]

psi[x_,t_] := f[t] psi[x]

psi[x,t]

\displaystyle{  \left\{k,c e^{i k x},e^{-i \omega  t},c e^{i k x-i \omega  t}\right\}  }

E4 := Conjugate[psi[x,t]] H[0] @ psi[x,t]

E4

E5 := Simplify[E4]

E5

k := Sqrt[2 m omega / hbar]

Refine[E5, {Element[{c, omega, m, t, hbar, k, x}, Reals]}]

\displaystyle{  \frac{c k^2 \hbar ^2 c^* \exp \left(-i \left(-(\omega  t-k x)^*-k x+\omega  t\right)\right)}{2 m}  }

\displaystyle{  = c^2 \omega  \hbar  }

E6 := Conjugate[psi[x,t]] psi[x,t]

Simplify[E6]

\displaystyle{  c c^* \exp \left(-i \left(-(\omega  t-k x)^*-k x+\omega  t\right)\right)  }

\displaystyle{  = c^2  }

.

\displaystyle{\begin{aligned}            \langle E \rangle     &= \frac{\int_{-\infty}^{\infty} \psi^* H_{V=0} \psi dx}{\int_{-\infty}^{\infty} \psi^* \psi dx} \\ \\     &= \frac{c^2 \omega  \hbar \int_{-\infty}^{\infty} dx}{c^2 \int_{-\infty}^{\infty} dx} \\ \\    &= \omega  \hbar \\    \end{aligned}}

.

— Me@2022-11-26 07:17:29 PM

.

.

2022.11.28 Monday (c) All rights reserved by ACHK

Euler problem 8.3

Directory[]

mString := Import["n.txt"]

nString := StringDelete[mString, "\n" | "\r"]

nList := Map[FromDigits, Characters[nString]]

take13[lst_] := Times @@ Take[lst,13]

Fmax13n[lst_, n_] := If[Length[lst] < 13,
                        n,
                        With[{t13 = take13[lst]},
                            If[n > t13,
                                Fmax13n[Rest[lst], n],
                                Fmax13n[Rest[lst], t13]]]]

Fmax13n[nList, 0]

Wmax13n[lst_, n_] := Which[
                        Length[lst] < 13, n,
                        t13 = take13[lst];
                            n > t13, Wmax13n[Rest[lst], n],
                            True, Wmax13n[Rest[lst], t13]]

Wmax13n[nList, 0]

Fmax13n[nList, 0] - Wmax13n[nList, 0]

— colorized by palette fm

— Me@2022-11-24 05:51:56 PM

.

.

2022.11.24 Thursday (c) All rights reserved by ACHK

Problem 14.5d1.2.2

A First Course in String Theory

.

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 Mathematica (or its official free version Wolfram Engine) with the following commands:

TeXForm[
    HoldForm[
        (1/x)*Product[
                 (1+x^(r-1/2))^32/(1-x^r)^8,
                 {r, 1, Infinity}]]]

f[x_] := (1/x)*Product[
                 (1+x^(r-1/2))^32/(1-x^r)^8,
                 {r, 1, Infinity}]

Print[f[x]]

TeXForm[f[x]]

TeXForm[Series[f[x], {x,0,3}]]
\displaystyle{\frac{1}{x}\prod _{r=1}^{\infty } \frac{\left(1+x^{r-\frac{1}{2}}\right)^{32}}{\left(1-x^r\right)^8}}


                     1        32
    QPochhammer[-(-------), x]
                  Sqrt[x]
------------------------------------
        1    32                    8
(1 + -------)   x QPochhammer[x, x]
     Sqrt[x]


\displaystyle{\frac{\left(-\frac{1}{\sqrt{x}};x\right)_{\infty }^{32}}{\left(\frac{1}{\sqrt{x}}+1\right)^{32} x (x;x)_{\infty }^8}}


\displaystyle{\frac{1}{x}+\frac{32}{\sqrt{x}}+504+5248 \sqrt{x}+40996 x+258624 x^{3/2}+1384320 x^2+O\left(x^{5/2}\right)}

\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@2022-11-23 04:40:28 PM

.

.

2022.11.23 Wednesday (c) All rights reserved by ACHK