-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.xml
More file actions
97 lines (50 loc) · 17.5 KB
/
Copy pathatom.xml
File metadata and controls
97 lines (50 loc) · 17.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>E = mc^2</title>
<subtitle>Life is physics !</subtitle>
<link href="http://blog.sunmingqi.com/atom.xml" rel="self"/>
<link href="http://blog.sunmingqi.com/"/>
<updated>2025-01-21T15:19:08.167Z</updated>
<id>http://blog.sunmingqi.com/</id>
<author>
<name>MingQi Sun</name>
</author>
<generator uri="https://hexo.io/">Hexo</generator>
<entry>
<title>Piano</title>
<link href="http://blog.sunmingqi.com/2025/01/21/Piano/"/>
<id>http://blog.sunmingqi.com/2025/01/21/Piano/</id>
<published>2025-01-21T13:25:50.000Z</published>
<updated>2025-01-21T15:19:08.167Z</updated>
<content type="html"><![CDATA[<p>Here’s my work on State Anthem of the Soviet Union:<br>still need practice.</p><div style="position: relative; width: 100%; height: 0; padding-bottom: 75%;"><iframe src="//player.bilibili.com/player.html?isOutside=true&aid=113865387938286&bvid=BV1QBwheNEJT&cid=27993114712&p=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"> </iframe></div>]]></content>
<summary type="html"><p>Here’s my work on State Anthem of the Soviet Union:<br>still need practice.</p>
<div style="position: relative; width: 100%; height: 0; p</summary>
<category term="Music" scheme="http://blog.sunmingqi.com/categories/Music/"/>
<category term="piano" scheme="http://blog.sunmingqi.com/tags/piano/"/>
</entry>
<entry>
<title>Some note on GR</title>
<link href="http://blog.sunmingqi.com/2025/01/06/GR/"/>
<id>http://blog.sunmingqi.com/2025/01/06/GR/</id>
<published>2025-01-05T17:38:49.000Z</published>
<updated>2025-01-05T18:04:19.509Z</updated>
<content type="html"><![CDATA[<p><strong><em>1. In Cartesian coordinates, the Lagrangian density for a scalar field is given by:</em></strong></p><script type="math/tex; mode=display">\mathcal{L}(\phi, \partial_{\mu} \phi)=-\frac{1}{2} \delta^{\mu \nu} \partial_{\mu} \phi \partial_{\nu} \phi-4 \pi G \chi{(1+\phi)}</script><p><strong><em>$\quad$where $\phi$ is a function of coordinates, and $\chi$ is the Newtonian constant.<br> $\quad$(a) Using the principle of stationary action , $\delta S=0$,derive the equation of motion for the scalar field from the action .<br>$\quad$(b) Based on the tilted gravity theory, if the scalar field represents the Newtonian potential, explain the physical meaning of $\chi$.</em></strong></p><p><strong><em>Answer:</em></strong><br>(a)$S(\phi)=\int_{\Omega} \mathcal{L}(\phi, \partial_{\mu} \phi) d V$<br>Use the principle : $\delta S = 0$,thus,</p><script type="math/tex; mode=display">\delta S =\int \delta \mathcal{L} \, dV = 0</script><p>Our goal is to make the form as :$\int[\quad]\delta \phi dV$,so it can easily think about this little math trick:<br>(notice that $\delta(\partial_{\mu}\phi) = \partial_{\mu}(\delta \phi)$)</p><script type="math/tex; mode=display">\begin{aligned}\delta \mathcal{L} &= \frac{\partial \mathcal{L}}{\partial \phi}\delta \mathcal{\phi}+\frac{\partial \mathcal{L}}{\partial (\partial_{\mu} \phi)}\delta \mathcal{(\partial_{\mu}\phi)}\\\ &=\frac{\partial \mathcal{L}}{\partial \phi}\delta \mathcal{\phi}+\frac{\partial \mathcal{L}}{\partial (\partial_{\mu} \phi)}\partial_{\mu}\mathcal{(\delta\phi)}\\\&=\frac{\partial \mathcal{L}}{\partial \phi}\delta \mathcal{\phi}+\partial_{\mu}\left(\frac{\partial \mathcal{L}}{\partial (\partial_{\mu} \phi)}\delta\phi\right)-\partial_{\mu}\left(\frac{\partial \mathcal{L}}{\partial (\partial_{\mu} \phi)}\right)\delta\phi\end{aligned}</script><p>We always require the boundary values to be zero,so :</p><script type="math/tex; mode=display">\int_{\Omega}\partial_{\mu}\left(\frac{\partial \mathcal{L}}{\partial (\partial_{\mu} \phi)}\delta\phi\right)dV \equiv 0</script><p>Here , the form of the principle of least action becomes:</p><script type="math/tex; mode=display">\delta S = \int_{\Omega} \left(\frac{\partial \mathcal{L}}{\partial \phi}-\partial_{\mu}\left(\frac{\partial \mathcal{L}}{\partial (\partial_{\mu} \phi)}\right)\right)\delta\phi dV</script><p>So we can derive the Euler-Lagrange equation as:</p><script type="math/tex; mode=display">\frac{\partial \mathcal{L}}{\partial \phi}-\partial_{\mu}\left(\frac{\partial \mathcal{L}}{\partial (\partial_{\mu} \phi)}\right)=0</script><p>Substituting the specific form of the Lagrangian density:</p><script type="math/tex; mode=display">\begin{aligned}& \begin{array}{l}\therefore\left\{\begin{array}{l}\frac{\partial \mathcal{L}}{\partial \phi}=-4 \pi G \chi \\\frac{\partial \mathcal{L}}{\partial(\partial_\mu \phi)}=-\partial^\mu \phi \end{array}\right.\end{array} \\\end{aligned}</script><p>Thus:</p><script type="math/tex; mode=display">-4\pi G \chi - \partial^\mu (-\partial_\mu \phi)= 0 \\\\rightarrow \nabla^2 \phi = 4\pi G \rho</script><p>(b) According to Newton’s law of gravity, $\nabla^2 \phi = 4\pi G \rho$, which implies $\chi = \rho$. </p><p>$\rho$ is the source of the gravitational potential. In this case, the influence of $\chi$ on any scalar field $\phi$ can be summarized as follows: </p><ol><li>$\chi$ serves as the source of the gravitational potential. </li><li>The distribution of $\chi$ directly impacts the distribution of $\phi$, with $\phi$ being interpretable as an excitation of $\chi$. </li></ol><p><strong><em>To be continued</em></strong></p>]]></content>
<summary type="html"><p><strong><em>1. In Cartesian coordinates, the Lagrangian density for a scalar field is given by:</em></strong></p>
<script type="math/tex</summary>
<category term="physics" scheme="http://blog.sunmingqi.com/categories/physics/"/>
<category term="general relativity" scheme="http://blog.sunmingqi.com/tags/general-relativity/"/>
<category term="math" scheme="http://blog.sunmingqi.com/tags/math/"/>
</entry>
<entry>
<title>The installation of glafic</title>
<link href="http://blog.sunmingqi.com/2024/12/20/hello-world/"/>
<id>http://blog.sunmingqi.com/2024/12/20/hello-world/</id>
<published>2024-12-20T14:14:30.611Z</published>
<updated>2024-12-20T14:14:30.611Z</updated>
<content type="html"><![CDATA[<h1 id="Installation-of-Glafic-Library"><a href="#Installation-of-Glafic-Library" class="headerlink" title="Installation of Glafic Library"></a>Installation of Glafic Library</h1><p>The Glafic library is written in C and cannot be directly installed using <code>pip install</code>. However, the author has provided Python bindings via C-to-Python translation. Installation requires a series of steps:</p><h2 id="Download-Glafic"><a href="#Download-Glafic" class="headerlink" title="Download Glafic"></a>Download Glafic</h2><ol><li>Download the zip file from <a href="https://github.com/oguri/glafic2">Glafic GitHub Repository</a>.</li><li>Extract the zip file to a specified directory (any location).</li><li>Open a terminal in the corresponding folder.</li></ol><h3 id="Install-Required-Header-Files-needed-by-Glafic-library"><a href="#Install-Required-Header-Files-needed-by-Glafic-library" class="headerlink" title="Install Required Header Files (needed by Glafic library)"></a>Install Required Header Files (needed by Glafic library)</h3><p>Open the terminal and install the necessary dependencies:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">sudo</span> apt-get update</span><br><span class="line"><span class="built_in">sudo</span> apt-get install libfftw3-dev</span><br><span class="line"><span class="built_in">sudo</span> apt-get install libcfitsio-dev</span><br><span class="line"><span class="built_in">sudo</span> apt-get install libgsl-dev</span><br></pre></td></tr></table></figure><h3 id="Locate-the-Installation-Paths-for-Libraries"><a href="#Locate-the-Installation-Paths-for-Libraries" class="headerlink" title="Locate the Installation Paths for Libraries"></a>Locate the Installation Paths for Libraries</h3><p>The default location is usually <code>/usr/lib</code>, but sometimes the libraries might be installed in different directories. For example, the libraries may be located in <code>/usr/lib/x86_64-linux-gnu</code>. To find the exact location, use the following commands:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">sudo</span> find / -name <span class="string">"libcfitsio.so"</span></span><br><span class="line"><span class="built_in">sudo</span> find / -name <span class="string">"libfftw3.so"</span></span><br><span class="line"><span class="built_in">sudo</span> find / -name <span class="string">"libgsl.so"</span></span><br></pre></td></tr></table></figure><p>The results may look like:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">(base) usr@usr-computer:~$ <span class="built_in">sudo</span> find / -name <span class="string">"libcfitsio.so"</span></span><br><span class="line">find: ‘/run/user/1000/doc’: Permission denied</span><br><span class="line">find: ‘/run/user/1000/gvfs’: Permission denied</span><br><span class="line">find: ‘/proc/1730/task/1730/net’: Invalid argument</span><br><span class="line">find: ‘/proc/1730/net’: Invalid argument</span><br><span class="line">/usr/lib/x86_64-linux-gnu/libcfitsio.so</span><br></pre></td></tr></table></figure><h3 id="Modify-Global-Environment"><a href="#Modify-Global-Environment" class="headerlink" title="Modify Global Environment"></a>Modify Global Environment</h3><p>Edit your global environment settings to add the library paths:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nano ~/.bashrc</span><br></pre></td></tr></table></figure><p>Add the following line at the end of the file:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">export</span> LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu:<span class="variable">$LD_LIBRARY_PATH</span></span><br></pre></td></tr></table></figure><p>Replace <code>/usr/local/lib/x86_64-linux-gnu</code> with the actual path where the libraries are installed.</p><p>To save and exit the <code>nano</code> editor:</p><ul><li>Press <code>Ctrl + O</code> to save.</li><li>Press <code>Enter</code> to confirm.</li><li>Press <code>Ctrl + X</code> to exit.</li></ul><p>Update the environment:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">source</span> ~/.bashrc</span><br></pre></td></tr></table></figure><h3 id="Modify-the-Makefile"><a href="#Modify-the-Makefile" class="headerlink" title="Modify the Makefile"></a>Modify the Makefile</h3><p>Edit the <code>Makefile</code> to ensure it uses the correct library paths:</p><figure class="highlight makefile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line">UNAME_S := <span class="variable">$(<span class="built_in">shell</span> uname -s)</span></span><br><span class="line">UNAME_M := <span class="variable">$(<span class="built_in">shell</span> uname -m)</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">ifeq</span> (<span class="variable">$(UNAME_S)</span>,Darwin)</span><br><span class="line"> <span class="keyword">ifeq</span> (<span class="variable">$(UNAME_M)</span>,x86_64)</span><br><span class="line"> CFLAGS2 = -lcurl</span><br><span class="line"> LIBPATH = /usr/local/lib</span><br><span class="line"> INCPATH = /usr/local/<span class="keyword">include</span></span><br><span class="line"> PY_LIBS = -lm -lcfitsio -lfftw3 -lgsl -lgslcblas</span><br><span class="line"> <span class="keyword">else</span></span><br><span class="line"> CFLAGS2 = -lcurl -lz</span><br><span class="line"> LIBPATH = /opt/homebrew/lib</span><br><span class="line"> INCPATH = /opt/homebrew/<span class="keyword">include</span></span><br><span class="line"> PY_LIBS = -lm -lcfitsio -lfftw3 -lgsl -lgslcblas</span><br><span class="line"> <span class="keyword">endif</span></span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"> <span class="keyword">ifeq</span> (<span class="variable">$(UNAME_S)</span>,Linux)</span><br><span class="line"> CFLAGS2 =</span><br><span class="line"> LIBPATH = /usr/lib/x86_64-linux-gnu <span class="comment"># Update this path</span></span><br><span class="line"> INCPATH = /usr/local/<span class="keyword">include</span></span><br><span class="line"> PY_LIBS = -lm -lcfitsio -lfftw3 -lgsl -lgslcblas <span class="comment"># Use dynamic linking (.so)</span></span><br><span class="line"> <span class="keyword">else</span></span><br><span class="line"> CFLAGS2 =</span><br><span class="line"> LIBPATH =</span><br><span class="line"> INCPATH =</span><br><span class="line"> PY_LIBS =</span><br><span class="line"> <span class="keyword">endif</span></span><br><span class="line"><span class="keyword">endif</span></span><br><span class="line"></span><br><span class="line">CC = gcc</span><br><span class="line">CFLAGS = -O2 -Wall -fPIC -I<span class="variable">$(INCPATH)</span></span><br><span class="line">LIBS = -lm -lcfitsio -lfftw3 -lgsl -lgslcblas <span class="comment"># Modify to use dynamic libraries (.so)</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Use .so files</span></span><br><span class="line">LIBS = -lm -L<span class="variable">$(LIBPATH)</span> -lcfitsio -lfftw3 -lgsl -lgslcblas <span class="comment"># Add -L$(LIBPATH) for the linker to find the library files</span></span><br></pre></td></tr></table></figure><h3 id="Install-Python-Libraries"><a href="#Install-Python-Libraries" class="headerlink" title="Install Python Libraries"></a>Install Python Libraries</h3><p>Navigate to the directory containing <code>setup.py</code> and run the following command:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip install .</span><br></pre></td></tr></table></figure><p>Now you should be able to import and use the Glafic library in Python:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> glafic</span><br></pre></td></tr></table></figure><hr><h3 id="Notes"><a href="#Notes" class="headerlink" title="Notes:"></a>Notes:</h3><ul><li>This guide assumes the user is working on a <strong>Linux</strong> system, likely Ubuntu.</li><li>The Python bindings are created via <code>setup.py</code>, and users need to ensure their system is set up to compile C code and link libraries.</li><li>Ensure you replace the paths with the correct installation locations, especially for the libraries, if they are in a custom directory.</li></ul>]]></content>
<summary type="html"><h1 id="Installation-of-Glafic-Library"><a href="#Installation-of-Glafic-Library" class="headerlink" title="Installation of Glafic Library"></summary>
<category term="astronomy software" scheme="http://blog.sunmingqi.com/categories/astronomy-software/"/>
<category term="code" scheme="http://blog.sunmingqi.com/tags/code/"/>
<category term="python" scheme="http://blog.sunmingqi.com/tags/python/"/>
</entry>
</feed>