Code Monkey home page Code Monkey logo

theoretical-physics's Introduction

Theoretical Physics Reference

This is an opensource book, available online at:

https://theoretical-physics.com

All files in the repository are licensed under the MIT license. The source code of the repository is available at:

https://github.com/certik/theoretical-physics

Build

Install prerequisites:

sudo apt-get install python-sphinx texlive-fonts-recommended texlive-latex-extra texlive-fonts-extra dvipng

To build the book, do:

make web

This builds both html and pdf versions, that you can find in the _build directory.

Build Using Conda

Conda build:

mamba env create -f environment.yml
conda activate tprbook
make latex
tectonic _build/latex/theoretical-physics.tex

How to Push to Github

First fetch the gh-pages branch and then use this script:

./copy-docs

and optionally push the gh-pages branch to github:

git push github

theoretical-physics's People

Contributors

certik avatar jean avatar partev avatar rkbk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

theoretical-physics's Issues

add a weak form of Schr. eq

It's already there in some form, but it should be made clear, how the weak form of the schroed. eq. looks like

Add complex analysis section

Introduce arg, Im, Re (or maybe im, re). So, in particular, write things like:

arg(z) = atan2(im(z), re(z))

and not

arg(x+iy) = atan2(y, x)

because the latter makes things more complicated. It turns out everything can be written using arg, re and im.

Pick a branch cut, at negative x-axis for arg. Everything else follows from it. Few examples valid for all complex values of all variables:

exp(log(z)) = z

log(exp(z)) = z + 2*pi*i*floor( (pi-Im(z))/(2*pi) )

exp(z)^k = exp(k*z) * exp(2*pi*i*k*floor( (pi-Im(z))/(2*pi) ))

log(z1 * z2) = log(z1) + log(z2) + 2*pi*i*floor( (pi-arg(z1)-arg(z2))/(2*pi) )

exp(x+y) = exp(x)*exp(y)

z^(x+y) = z^x * z^y

(x*y)^a = x^a * y^b * exp(2*pi*i*a*floor( (pi-arg(x)-arg(y))/(2*pi) ))

(z^a)^b = z^(a*b) * exp(2*pi*i*b*floor( (pi-Im(a*log(z)))/(2*pi) ))

Then add some worked out examples:

0 = log(1) = log((-1)*(-1)) = log(-1) + log(-1) + 2*pi*i*floor( (pi-pi-pi)/(2*pi) ) = i*pi + i*pi + 2*pi*i*(-1) = 0

One can find more here:

http://functions.wolfram.com/ElementaryFunctions/Log/16/ShowAll.html

Usually one has to be extremely careful and think about all the branches etc. But the above approach provides a robust, simple, algorithmic way to work with complex expressions. That should be stressed.

Explain more the 1/2 in E_H[n]

One way is to use the functional derivatives, another way is:

Actually, the 1/2 accounts for double counting in the electron-electron integral, not present in the electron-nuclear integral since it is not a self energy.

Potential energy of a collection of charges q_i in the field of another collection of charges q'_j is

\sum_{i,j} q_i q'_j / |r_i-r'_j|

Whereas the *self* energy of the charges q_i is

\sum_{i,j>i} q_i q_j / |r_i-r_j| = 1/2 \sum_{i,j/=i} q_i q_j / |r_i-r_j|

where the j>i in the summation is required to avoid double counting pairs: e.g., includes q_1*q_2 term, omits q_2*q_1, etc.

And so in the continuous case, for the electron-electron self energy (Hartree energy) we have the 1/2:

E_H = 1/2 \int { rho(x) rho(x') / |x - x'| d^3x d^3x' } = 1/2 \int { rho(x) v_e(x) d^3x }

where v_e(x) = \int { rho(x') / |x - x'| d^3x' }

while for the electron-nuclear energy we have simply

E_en = \int { rho(x) rho_n(x') / |x - x'| d^3x d^3x' } =  \int { rho(x) v_n(x) d^3x }

where v_n(x) = \int { rho_n(x') / |x - x'| d^3x' } = \int { Z delta(x'-x_n)/ |x - x'| d^3x' }  = Z/|x - x_n|; x_n = nuclear position.

Use both. Possibly put this into the functional derivatives section.

add a section about elementary particles

With a simple explanation about each. Some info is here:

http://en.wikipedia.org/wiki/Elementary_particle

but such tables are hard to remember. I think a better approach is to list the particles that are included in the electroweak standard model*, and then particles that arise when we include quarks in it too. That should cover everything I think.

. * by listing their terms in the Lagrangian, as well as their spin (again from the Lagrangian) and so on. It should be clear where each particle comes from in the construction of the standard model

Derivation in section "Total energy" of DFT page is unclear

I've been reading the DFT page, and I'm trying to understand the section on the Total energy. A short bit into that section, it is written that "If one is not careful about the potential associated with the eigenvalues, i.e., confusing V_{in} with V_{out}". However, where is "V_in" and "V_out" defined? It is a bit unclear if the section is trying to explain what would happen if the equations given there are used to evaluated the total energy on each iteration of the KS solution. But why would the energy after an iteration be evaluated using the previous external potential ("V_in"?)? The message of the section is a bit unclear to me.

Furthermore, the section seems to imply that the last equation of the section "Total energy" is somehow not preferable to a direct usage of the total energy expression (first equation of "total energy" section), despite the fact that several review works/text books on DFT indicate that the last expression is used in several DFT codes to calculate the total energy.

Stat Mech Notes?

Thank you for this great repo. I noticed that there is no statistical mechanics. Is there a plan for it?

DFT: review U energies example

John:

DFT ground state does not necessarily have 7s higher in energy than 6d. In fact, my featom code finds the following ground state energies/occupations for LDA (using Fermi-Dirac occupation with 0.001 Ha smear):

 Lowest eigenvalues and occupations (index, n, L, value, occupation):
    1:   1   0   -3.6889954761E+03    2.0000000000E+00
    2:   2   0   -6.3940729181E+02    2.0000000000E+00
    3:   2   1   -6.1874016342E+02    6.0000000000E+00
    4:   3   0   -1.6073349570E+02    2.0000000000E+00
    5:   3   1 -1.5059481296E+02    6.0000000000E+00
    6:   3   2   -1.3159427535E+02    1.0000000000E+01
    7:   4   0   -4.0152111179E+01    2.0000000000E+00
    8:   4   1   -3.5477394577E+01    6.0000000000E+00
    9:   4   2   -2.6747107088E+01    1.0000000000E+01
   10:   4   3   -1.4649108156E+01    1.4000000000E+01
   11:   5   0   -8.4639842362E+00    2.0000000000E+00
   12:   5   1   -6.6619644703E+00    6.0000000000E+00
   13:   5   2   -3.5226864132E+00    1.0000000000E+01
   14:   6   0   -1.1171982594E+00    2.0000000000E+00
   15:   6   1   -6.4359982973E-01    6.0000000000E+00
   16:   7   0   -9.8198270806E-02    1.2795018030E+00
   17:   5   3   -9.6948094138E-02    4.7204981970E+00
   18:   6   2   -5.8382915481E-02    0.0000000000E+00
   19:   7   1   -3.9951649510E-02    0.0000000000E+00
   20:   8   0   -3.2986444516E-03    0.0000000000E+00
   21:   8   1    3.3607509599E-03    0.0000000000E+00
   22:   9   0    5.0395456503E-03    0.0000000000E+00
   23:   7   2    5.7895441443E-03    0.0000000000E+00
 Difference of lowest 2 eigenvalues:   3.0495881843E+03
 Occupation-weighted eigenvalue sum:  -1.5774758217E+04

6j symbol mistake in HF derivation

Reported by Liguang G. Jiao.

http://theoretical-physics.net/dev/src/quantum/hf.html#two-particle

In the final form of the two-electron potential matrix <l1,l2,L,M|
1/r_12 |l1',l2',L',M'>, I think there is no factor (2L+1).
This factor will be eliminated in constructing the six-J symbols.

I think the first two "=" are correct, but the third one
(the last "=" sign) is not. After summing up over M, there cannot be
any M left in the equation. So I think we are missing a summation over
M in the last equation there.

That way the 2L+1 factor disappears from the final formula for the two electron integral, as it should.

Check Gaunt coefficients and fix if needed

Reported by László Oroszlány and Laszlo Szunyogh.

There is a small mistake (or just rather an inconsistency) in the way you define the c-type Gaunt coefficients in the section about Legendre Polynomials. There is a factor 4_k+1 that should be 2_k+1 to make it consistent with the definition trough the wigner 3-j-s. you simplify by (2_k+1)/(4_k+1) at some point..

Modern theme and more options

Just a suggestion, ReadTheDocs theme and Pydata theme both look nice and have many advanced functions, such as dark mode, sticky TOC, and easily navigation. They are being used by many popular scientific projects like numpy, scipy, pandas, ...

If you guys like, I will create a PR then, with a "dark-mode" toggle button, sticky TOC, wider page, and quickly copy code-block function enabled.

Review notation in DFT notes

In particular John's comment:

You have phi for "potential energy" and V for "potential" instead of the other way around.

corrections to m_z and m_w

from math import pi, sin, cos, sqrt, log
eV = 1
KeV = 1e3
MeV = 1e6
GeV = 1e9
g = 0.631
theta_W = 28.67 * pi / 180
v = 246.218 * GeV
h_e = 2.935 * 1e-6 * eV
h_mu = 6.065 * 1e-4 * eV
h_tau = 1.021 * 1e-2 * eV
alpha = 1/137.035999


m_t = 180 * GeV
m_w = g*v/2
m_z = g*v/2/cos(theta_W)
s_w = sin(theta_W)   # Same as: s_w = sqrt(1-m_w**2/m_z**2)
# I think that s_0 and s_w is the same
#s_0 = sqrt(0.2307)
s_0 = s_w
print s_0**2

# from the graph:
#s_w = sqrt(0.226)
#s_star = sqrt(0.231)
#print s_star**2

m_h = 1000 * GeV
rhs = -3*alpha/(16*pi*(cos(theta_W)**2 - sin(theta_W)**2)) * m_t**2 / m_z**2
rhs += alpha * (1+9*sin(theta_W)**2)/(48*pi * (cos(theta_W)**2 - sin(theta_W)**2)) * log(m_h**2/m_w**2)
s_star = sqrt(s_0**2 + rhs)

rhs = -3*alpha/(16*pi*sin(theta_W)**2) * m_t**2 / m_z**2
rhs += alpha * 5./(24*pi) * log(m_h**2/m_w**2)
s_w = sqrt(s_star**2 + rhs)
print s_star**2
print s_w**2

This prints:

bash-3.2$ python a.py 
0.230173648241
0.228245381646
0.222897377383

Which agrees with P & S at least a little bit, page 772, Figure 21.14

Dirac notation update

Dirac notation is:

  1. convenient way to handle vectors in Hilbert vector spaces, as shown here:

http://theoretical-physics.net/dev/src/math/la.html

Mathematically there is no problem at all, we are just using the Riesz representation theorem.

http://en.wikipedia.org/wiki/Riesz_representation_theorem

  1. ways of dealing with different representations, e.g. f(x), f(x'), f(p) (fourier), and so on, as briefly described here:

http://theoretical-physics.net/dev/src/math/other.html#dirac-notation

however, it should be expanded and more examples added. It should be stressed, that |f> is a vector, that can be represented in any basis (|x>, |x'>, |p>, |n>, ...) and Dirac notation provides unified ways of dealing with it.

It is still independent of the scalar product, and so 1) and 2) should be unified somehow.

In particular \int |x><x| dx = 1 only holds if we use the L2 scalar product. For weighted L2 product, we'll get \int w(x) * |x><x| dx = 1, and so on. For H1, it gets more nasty.

We need to put there easy way to derive these formulas and show what follows from what.

Breaking math formulas into multiple lines (whether to repeat the sign), possibly automate it

I am currently following the Russian (and Czech, Polish, ...) tradition, that when a mathematical formula is broken into multiple lines, the last sign on the line (typically = or +) is repeated at the beginning of the next line. The problem with this convention is that many American readers think, that the sign left on the previous line is a typo.

Some references for this convention are e.g. here and here. In the second link, see the "Hyphenation in mathematics". In there, the convention by priority is to prefer breaking at a relational sign (<, >, =, , ...). If not possible, then at addition/subtraction sign (+, -, ±, ), and if not possible, then finally at a multiplication sign (i.e., at the position where multiplication is assumed since the explicit multiplication sign is usually skipped in mathematical expressions). Signs like *, ., /, (, [, etc. prevent formula breaking. There are some more tips there. As far as these rule go, I think the U.S. convention is similar if not identical.

The rule that is different is:

When the mathematical formula (embedded in text or as a separated block)
is broken into two parts and is continued on the next line, tradition requires
that we must repeat the last sign in the broken formula at the end of the first
part and at the beginning of the second part placed on the next line. When
a multiplication is broken, the explicit multiplication sign ‘×’ is inserted, and
this sign is repeated on the next line as well.

I just checked my English edition of Landau & Lifshitz, and indeed, they repeat the + sign at the end of the line and at the beginning of the next line (but they are not always consistent, sometimes they do not repeat +). They do not seem to repeat the = sign. However, Russian books all seem to strictly repeat the sign, including =, see e.g. this page at Google books (you might need to be logged in to see it).

I was actually even wondering, if the formula breaking cannot be made automatic, just like a paragraph breaking. The reason is that for narrow displays, some of the formulas do not fit the page. For wide displays, they would. Some formulas fit nicely in html, but do not fit nicely in the pdf version of the book.

I think the algorithm would be very simple, it would try to break at relational sign, if impossible, then at addition/subtraction. I would ignore the last multiplication rule, because it's implicit, so it would be hard to implement. Then the algorithm can easily repeat the last sign, or not, depending on user preferences.

Add a link to theoretical-physics.net

The sphinx docs should point to theoretical-physics.net somewhere, so that people who find some particular page in google can find their way to the main page.

Error message format and colors

I missed the all-important help line in the following error message:

error message

There are two "art direction" reasons for this:

  1. the color of the important line is a soft, purple, ignore-me. I suggest making it RED or YELLOW-ON-BLACK or something else more eye-catching (just NOT blue-on-black, or yellow-on-white, the two NEVER color combinations)
  2. Other error messages do not have anything in that position, so I got accustomed to never looking there. Suggest ALWAYS putting a help line, even if it's empty! Here is an example of the error messages I see all the time:
(lp) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm)─────────────────────────────────────────────────────────────────────────────────────────────────────────(brian@Golf37:s012)─┐
└─(11:39:11 on brian-lasr ✹ ✭)──> ~/CLionProjects/lpython/src/bin/lpython -I. issue2126.py                                                            1 ↵ ──(Sun,Jul09)─┘
semantic error: Type mismatch in comparison operator, the types must be compatible
  --> issue2126.py:18:12
   |
18 |     assert foo.dim == x.dim == y.dim == z.dim
   |            ^^^^^^^^^^^^^^^^    ^^^^^ type mismatch ('bool' and 'i32')


Note: if any of the above error or warning messages are not clear or are lacking
context please report it to us (we consider that a bug that must be fixed).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.