-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.xml
147 lines (147 loc) · 20.6 KB
/
search.xml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>Field Theory Calculation of Orthogonal Curve Coordinate System</title>
<url>/2022/04/09/field-theory-calculation/</url>
<content><![CDATA[<h1 id="正交曲线坐标系的场论计算">正交曲线坐标系的场论计算</h1>
<blockquote>
<p>参考:张筑生1990数学分析新讲1_北京大学</p>
</blockquote>
<h2 id="直角坐标系">直角坐标系</h2>
<p><span class="math display">\[\nabla=\vec{i}\frac{\partial}{\partial x}+\vec{j}\frac{\partial}{\partial y}+\vec{k}\frac{\partial}{\partial z}\]</span></p>
<h2 id="曲线坐标系">曲线坐标系</h2>
<p><span class="math display">\[\vec{r}=\vec{r}(x,y,z) \Rightarrow \vec{r}=\vec{r}(q_1,q_2,q_3)\]</span> <span class="math display">\[d\vec{r}=\frac{\partial\vec{r}}{\partial q_1}dq_1+\frac{\partial\vec{r}}{\partial q_2}dq_2+\frac{\partial\vec{r}}{\partial q_3}dq_3\]</span> 各坐标切向量 <span class="math display">\[\frac{\partial\vec{r}}{\partial q_1},\qquad \frac{\partial\vec{r}}{\partial q_2},\qquad \frac{\partial\vec{r}}{\partial q_3}\]</span> Lam<span class="math inline">\(\acute{\rm{e}}\)</span>系数 <span class="math display">\[h_i=\Big\|\frac{\partial\vec{r}}{\partial q_i}\Big\|=\sqrt{\Big(\frac{\partial x}{\partial q_i}\Big)^2+(\frac{\partial y}{\partial q_i}\Big)^2+(\frac{\partial z}{\partial q_i}\Big)^2},\qquad i=1,2,3\]</span> 正交曲线坐标系:柱坐标、球坐标,规范正交基底 <span class="math display">\[\vec{e}_i=\frac{1}{h_i}\frac{\partial\vec{r}}{\partial q_i},\qquad i=1,2,3\]</span> <span class="math display">\[\vec{e}_i\cdot\vec{e}_j=\delta_{ij}\]</span></p>
<h3 id="梯度">梯度</h3>
<p><span class="math display">\[d\vec{r}=h_1dq_1\vec{e}_1+h_2dq_2\vec{e}_2+h_3dq_3\vec{e}_3\]</span> <span class="math display">\[\nabla u=\lambda_1\vec{e}_1+\lambda_2\vec{e}_2+\lambda_3\vec{e}_3\]</span> <span class="math display">\[\nabla u\cdot d\vec{r}=\lambda_1h_1dq_1+\lambda_2h_2dq_2+\lambda_3h_3dq_3\]</span> <span class="math display">\[\nabla u\cdot d\vec{r}=du=\frac{\partial u}{\partial q_1}dq_1+\frac{\partial u}{\partial q_2}dq_2+\frac{\partial u}{\partial q_3}dq_3\]</span> <span class="math display">\[\Rightarrow\lambda_i=\frac{1}{h_i}\frac{\partial u}{\partial q_i},\qquad i=1,2,3\]</span> <span class="math display">\[\Rightarrow\nabla u=\frac{1}{h_1}\frac{\partial u}{\partial q_1}\vec{e}_1+\frac{1}{h_2}\frac{\partial u}{\partial q_2}\vec{e}_2+\frac{1}{h_3}\frac{\partial u}{\partial q_3}\vec{e}_3\]</span></p>
<h3 id="散度">散度</h3>
<p>由梯度公式有 <span class="math display">\[\nabla q_i=\frac{1}{h_i}\vec{e}_i,\qquad i=1,2,3\]</span> <span class="math display">\[\begin{aligned}
\nabla\cdot\Big(\frac{\vec{e}_1}{h_2h_3}\Big)&=\nabla\cdot\Big(\frac{\vec{e}_2}{h_2}\times\frac{\vec{e}_3}{h_3}\Big)=\nabla\cdot(\nabla q_2\times\nabla q_3)\\
&=(\nabla\times\nabla q_2)\cdot\nabla q_3-(\nabla\times\nabla q_3)\cdot\nabla q_2=0
\end{aligned}\]</span> <span class="math display">\[\Rightarrow\nabla\cdot\Big(\frac{\vec{e}_2}{h_3h_1}\Big)=0,\qquad\nabla\cdot\Big(\frac{\vec{e}_3}{h_1h_2}\Big)=0\]</span> <span class="math display">\[\vec{u}=u_1\vec{e}_1+u_2\vec{e}_2+u_3\vec{e}_3=u_1h_2h_3\Big(\frac{\vec{e}_1}{h_2h_3}\Big)+u_2h_3h_1\Big(\frac{\vec{e}_2}{h_3h_1}\Big)+u_3h_1h_2\Big(\frac{\vec{e}_3}{h_1h_2}\Big)\]</span> <span class="math display">\[\begin{aligned}
\nabla\cdot\vec{u}&=\nabla(u_1h_2h_3)\cdot\Big(\frac{\vec{e}_1}{h_2h_3}\Big)+\nabla(u_2h_1h_1)\cdot\Big(\frac{\vec{e}_2}{h_3h_1}\Big)+\nabla(u_3h_1h_2)\cdot\Big(\frac{\vec{e}_3}{h_1h_2}\Big)\\
&=\frac{1}{h_1h_2h_3}\Big[\frac{\partial}{\partial q_1}(u_1h_2h_3)+\frac{\partial}{\partial q_2}(u_2h_3h_1)+\frac{\partial}{\partial q_3}(u_3h_1h_2)\Big]
\end{aligned}\]</span></p>
<h3 id="旋度">旋度</h3>
<p><span class="math display">\[\nabla\times\Big(\frac{\vec{e}_i}{h_i}\Big)=\nabla\times\nabla q_i=0,\qquad i=1,2,3 \]</span> <span class="math display">\[\vec{u}=\sum_{i=1}^3u_i\vec{e}_i=\sum_{i=1}^3u_ih_i\Big(\frac{\vec{e}_i}{h_i}\Big) \]</span> <span class="math display">\[\nabla\times\vec{u}=\sum_{i=1}^3\nabla(u_ih_i)\times\Big(\frac{\vec{e}_i}{h_i}\Big)=\frac{1}{h_1h_2h_3}\begin{vmatrix}
h_1\vec{e}_1 &h_2\vec{e}_2 &h_3\vec{e}_3\\
\frac{\partial}{\partial q_1} &\frac{\partial}{\partial q_2} &\frac{\partial}{\partial q_3}\\
h_1u_1 &h_2u_2 &h_3u_3
\end{vmatrix} \]</span></p>
<h3 id="拉普拉斯算子">拉普拉斯算子</h3>
<p>直角坐标系 <span class="math display">\[\Delta=\frac{\partial^2}{\partial x^2}+\frac{\partial^2}{\partial y^2}+\frac{\partial^2}{\partial z^2},\qquad \Delta u=\nabla\cdot(\nabla u) \]</span> 正交曲线坐标系 <span class="math display">\[\begin{aligned}
\Delta u&=\frac{1}{h_1h_2h_3}\Big[\frac{\partial}{\partial q_1}\Big(\frac{h_2h_3}{h_1}\frac{\partial u}{\partial q_1}\Big)+\frac{\partial}{\partial q_2}\Big(\frac{h_3h_1}{h_2}\frac{\partial u}{\partial q_2}\Big)+\frac{\partial}{\partial q_3}\Big(\frac{h_1h_2}{h_3}\frac{\partial u}{\partial q_3}\Big)\Big] \\
&=\frac{1}{h_1h_2h_3}\sum_{i=1}^3\frac{\partial}{\partial q_i}\Big(\frac{h_1h_2h_3}{h_i^2}\frac{\partial u}{\partial q_i}\Big)
\end{aligned}\]</span></p>
<h3 id="柱坐标">柱坐标</h3>
<p><span class="math display">\[\vec{r}(x,y,z)\Rightarrow\vec{r}(r,\theta,z)\qquad\left\{\begin{aligned}
x&=r\cos\theta\\
y&=r\sin\theta\\
z&=z
\end{aligned}\right.\]</span> <span class="math display">\[h_1=1,\qquad h_2=r,\qquad h_3=1 \]</span> <span class="math display">\[\nabla u=\frac{\partial u}{\partial r}\vec{e}_r+\frac{1}{r}\frac{\partial u}{\partial\theta}\vec{e}_{\theta}+\frac{\partial u}{\partial z}\vec{e}_z \]</span> <span class="math display">\[\nabla\cdot\vec{u}=\frac{1}{r}\frac{\partial}{\partial r}(ru_1)+\frac{1}{r}\frac{\partial u_2}{\partial\theta}+\frac{\partial u_3}{\partial z} \]</span> <span class="math display">\[\nabla\times\vec{u}=\frac{1}{r}\begin{vmatrix}
\vec{e}_r &r\vec{e}_{\theta} &\vec{e}_z\\
\frac{\partial}{\partial r} &\frac{\partial}{\partial\theta} &\frac{\partial}{\partial z}\\
u_1 &ru_2 &u_3
\end{vmatrix} \]</span> <span class="math display">\[\Delta u=\frac{1}{r}\frac{\partial}{\partial r}\Big(r\frac{\partial u}{\partial r}\Big)+\frac{1}{r^2}\frac{\partial^2 u}{\partial\theta^2}+\frac{\partial^2 u}{\partial z^2} \]</span></p>
]]></content>
<tags>
<tag>tensor</tag>
<tag>fluid mechanism</tag>
</tags>
</entry>
<entry>
<title>VSCode -- Remote Development using SSH</title>
<url>/2022/04/12/SSH-connect/</url>
<content><![CDATA[<p>用ssh远程连接服务器运行代码,虽然vim编辑能力很强大,加上各种配置和插件用起来也不错,但总归比不上vscode。 vscode也可以用vim的方式编辑,高亮、智能补全、调试等功能更加强大,是非常完美的编辑器了。 所以希望通过远程连接插件,利用服务器性能的同时,实现便捷的本地vscode编辑。</p>
<p>参考链接</p>
<blockquote>
<p>https://code.visualstudio.com/docs/remote/ssh#<br />
https://docs.microsoft.com/zh-cn/windows-server/administration/openssh/openssh_install_firstuse<br />
https://www.cnblogs.com/yyds/p/6992125.html</p>
</blockquote>
<span id="more"></span>
<h1 id="ssh-connect">SSH connect</h1>
<h2 id="本地和远程服务器安装ssh-powershell">本地和远程服务器安装ssh (PowerShell)</h2>
<p>管理员身份运行powershell <figure class="highlight powershell"><table><tr><td class="code"><pre><span class="line"><span class="built_in">Get-WindowsCapability</span> <span class="literal">-Online</span> | <span class="built_in">Where-Object</span> Name <span class="operator">-like</span> <span class="string">'OpenSSH*'</span></span><br></pre></td></tr></table></figure> 若均未安装 <figure class="highlight powershell"><table><tr><td class="code"><pre><span class="line">Name : OpenSSH.Client~~~~<span class="number">0.0</span>.<span class="number">1.0</span></span><br><span class="line">State : NotPresent</span><br><span class="line"></span><br><span class="line">Name : OpenSSH.Server~~~~<span class="number">0.0</span>.<span class="number">1.0</span></span><br><span class="line">State : NotPresent</span><br></pre></td></tr></table></figure> 根据需要安装 <figure class="highlight powershell"><table><tr><td class="code"><pre><span class="line"><span class="comment"># Install the OpenSSH Client</span></span><br><span class="line"><span class="built_in">Add-WindowsCapability</span> <span class="literal">-Online</span> <span class="literal">-Name</span> OpenSSH.Client~~~~<span class="number">0.0</span>.<span class="number">1.0</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Install the OpenSSH Server</span></span><br><span class="line"><span class="built_in">Add-WindowsCapability</span> <span class="literal">-Online</span> <span class="literal">-Name</span> OpenSSH.Server~~~~<span class="number">0.0</span>.<span class="number">1.0</span></span><br></pre></td></tr></table></figure> 两者都会返回以下输出 <figure class="highlight powershell"><table><tr><td class="code"><pre><span class="line">Path :</span><br><span class="line">Online : True</span><br><span class="line">RestartNeeded : False</span><br></pre></td></tr></table></figure></p>
<h2 id="ssh-密钥登录">ssh 密钥登录</h2>
<h3 id="在服务器生成公私密钥">在服务器生成公私密钥</h3>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">$ cd ~/.ssh</span><br><span class="line">$ ssh-keygen -t rsa -b 4096</span><br><span class="line">Generating public/private rsa key pair.</span><br><span class="line">Enter file in which to save the key (/home/[username]/.ssh/id_rsa): [keyname]</span><br><span class="line">Enter passphrase (empty for no passphrase): [passphrase or directly enter]</span><br><span class="line">Enter same passphrase again:</span><br><span class="line">Your identification has been saved in test</span><br><span class="line">Your public key has been saved in test.pub</span><br><span class="line">The key fingerprint is:</span><br><span class="line">SHA256:[xxxxxx]</span><br><span class="line">The key's randomart image is:</span><br><span class="line">+---[RSA 4096]----+</span><br><span class="line">| ....+o ..O|</span><br><span class="line">| . +o... +o|</span><br><span class="line">| . =.. .=|</span><br><span class="line">| . + o oo... .o|</span><br><span class="line">| o + *S * o |</span><br><span class="line">| E * * o + . |</span><br><span class="line">| . . O . . o.. |</span><br><span class="line">| o o . ....|</span><br><span class="line">| . oo*|</span><br><span class="line">+----[SHA256]-----+</span><br><span class="line"></span><br><span class="line">$ ls</span><br><span class="line">[keyname] [keyname].pub</span><br></pre></td></tr></table></figure>
<ul>
<li>注:
<ul>
<li>公私钥应在服务器生成,这样不同的本地机都能用</li>
<li>服务器应该同时有公钥和私钥,否则登录时可能报错</li>
</ul>
<code>load pubkey [path]: invalid format</code></li>
</ul>
<h3 id="在服务器安装公钥">在服务器安装公钥</h3>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">$ cd ~/.ssh</span><br><span class="line">$ cat [keyname].pub >> authorized_keys</span><br><span class="line">$ chmod 600 authorized_keys # 保证文件权限正确</span><br><span class="line">$ chmod 700 ~/.ssh</span><br></pre></td></tr></table></figure>
<p>编辑<code>/etc/ssh/sshd_config</code> <figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">PubkeyAuthentication yes # 通常默认已经是此设置</span><br></pre></td></tr></table></figure></p>
<h3 id="下载私钥到本地连接ssh">下载私钥到本地,连接ssh</h3>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">$ ssh -i [keyname] [hostname]@[ip] -p [port] # ssh密钥连接</span><br><span class="line"># 若是初次连接</span><br><span class="line">The authenticity of host '[[host]]:[port] ([[host]]:[port])' can't be established.</span><br><span class="line">ECDSA key fingerprint is SHA256:[xxxx].</span><br><span class="line">Are you sure you want to continue connecting (yes/no/[fingerprint])? yes</span><br><span class="line">Warning: Permanently added '[[host]]:[port]' (ECDSA) to the list of known hosts.</span><br><span class="line">[hostname]@[server name]:~$</span><br></pre></td></tr></table></figure>
<h1 id="vscode-设置">VSCode 设置</h1>
<ul>
<li>安装插件 <code>Remote - SSH</code></li>
<li><code>F1</code> => <code>Remote - SSH: Open SSH Configuration File...</code> => select file and edit <figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">Host alias</span><br><span class="line"> HostName [ip]</span><br><span class="line"> User [username]</span><br><span class="line"> Port [port]</span><br><span class="line"> IdentityFile [path of keyname]</span><br></pre></td></tr></table></figure></li>
<li><code>F1</code> => <code>Remote - SSH: Connect to Host...</code> => select platform
<ul>
<li>注:若报错<code>ssh: Could not resolve hostname [hostname]: A non-recoverable error occurred during a database lookup.</code>, vscode插件的<code>config</code>文件有问题</li>
</ul></li>
<li>在远程ssh端安装需要的vscode插件</li>
</ul>
<h1 id="其他工具">其他工具</h1>
<p>推荐<code>MobaXterm</code>,连接稳定方便,支持各种终端,文件传输方便</p>
]]></content>
<tags>
<tag>code</tag>
<tag>linux</tag>
</tags>
</entry>
<entry>
<title>Latex Tips</title>
<url>/2022/04/13/latex-tips/</url>
<content><![CDATA[<p>整理一些好用的latex排版技巧 <span id="more"></span></p>
<h1 id="排版python代码">排版python代码</h1>
<p>参考链接</p>
<blockquote>
<p>https://www.zhihu.com/question/65508676/answer/232267619</p>
</blockquote>
<figure class="highlight tex"><table><tr><td class="code"><pre><span class="line"><span class="keyword">\usepackage</span>{listings, xcolor}</span><br><span class="line"><span class="keyword">\lstdefinestyle</span>{lfonts}{</span><br><span class="line"> basicstyle = <span class="keyword">\footnotesize</span><span class="keyword">\ttfamily</span>,</span><br><span class="line"> stringstyle = <span class="keyword">\color</span>{purple},</span><br><span class="line"> keywordstyle = <span class="keyword">\color</span>{blue!60!black}<span class="keyword">\bfseries</span>,</span><br><span class="line"> commentstyle = <span class="keyword">\color</span>{olive}<span class="keyword">\scshape</span>,</span><br><span class="line">}</span><br><span class="line"><span class="keyword">\lstdefinestyle</span>{lnumbers}{</span><br><span class="line"> numbers = left,</span><br><span class="line"> numberstyle = <span class="keyword">\tiny</span>,</span><br><span class="line"> numbersep = 1em,</span><br><span class="line"> firstnumber = 1,</span><br><span class="line"> stepnumber = 1,</span><br><span class="line">}</span><br><span class="line"><span class="keyword">\lstdefinestyle</span>{llayout}{</span><br><span class="line"> breaklines = true,</span><br><span class="line"> tabsize = 2,</span><br><span class="line"> columns = flexible,</span><br><span class="line">}</span><br><span class="line"><span class="keyword">\lstdefinestyle</span>{lgeometry}{</span><br><span class="line"> xleftmargin = 20pt,</span><br><span class="line"> xrightmargin = 0pt,</span><br><span class="line"> frame = tb,</span><br><span class="line"> framesep = <span class="keyword">\fboxsep</span>,</span><br><span class="line"> framexleftmargin = 20pt,</span><br><span class="line">}</span><br><span class="line"><span class="keyword">\lstdefinestyle</span>{lgeneral}{</span><br><span class="line"> style = lfonts,</span><br><span class="line"> style = lnumbers,</span><br><span class="line"> style = llayout,</span><br><span class="line"> style = lgeometry,</span><br><span class="line">}</span><br><span class="line"><span class="keyword">\lstdefinestyle</span>{python}{</span><br><span class="line"> language = {Python},</span><br><span class="line"> style = lgeneral,</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="keyword">\begin</span>{document}</span><br><span class="line"><span class="keyword">\begin</span>{lstlisting}[style = python]</span><br><span class="line">for x in range(10):</span><br><span class="line"> pass</span><br><span class="line"><span class="keyword">\end</span>{lstlisting}</span><br><span class="line"><span class="keyword">\end</span>{document}</span><br></pre></td></tr></table></figure>
<h1 id="表格过宽的处理办法">表格过宽的处理办法</h1>
<figure class="highlight tex"><table><tr><td class="code"><pre><span class="line"><span class="keyword">\documentclass</span>{article}</span><br><span class="line"><span class="keyword">\usepackage</span>{graphicx}</span><br><span class="line"><span class="keyword">\begin</span>{document}</span><br><span class="line"><span class="keyword">\begin</span>{table}[!htb]</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\caption</span>{Imagine that this is a table.}</span><br><span class="line"> <span class="keyword">\label</span>{tab:resized}</span><br><span class="line"> <span class="keyword">\resizebox</span>{<span class="keyword">\linewidth</span>}{!}{</span><br><span class="line"> <span class="comment">% table content</span></span><br><span class="line"> }</span><br><span class="line"><span class="keyword">\end</span>{table}</span><br></pre></td></tr></table></figure>
]]></content>
<tags>
<tag>code</tag>
<tag>latex</tag>
</tags>
</entry>
<entry>
<title>Linux Commands</title>
<url>/2022/04/13/linux-commands/</url>
<content><![CDATA[<p>整理了一些用到的比较好用的linux命令 <span id="more"></span></p>
<h1 id="后台运行">后台运行</h1>
<h2 id="后台运行保存运行日志">后台运行,保存运行日志</h2>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">$ nohup [your command] </dev/null >logfile 2>&1 &</span><br></pre></td></tr></table></figure>
<ul>
<li><code>nohup</code> 挂起命令<code>[your command]</code>在后台运行,不会被<code>ctrl C</code>终止</li>
<li><code><dev/null</code> 标准输入设为空</li>
<li><code>>logfile</code> 标准输出重定向到文件<code>logfile</code></li>
<li><code>2>&1</code> 标准错误输出重定向到标准输出,会一起保存在<code>logfile</code></li>
</ul>
<h2 id="查看日志">查看日志</h2>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">$ tail -f logfile</span><br></pre></td></tr></table></figure>
<h2 id="查看和终止后台进程">查看和终止后台进程</h2>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">$ ps -aux | grep [search content]</span><br><span class="line">$ kill -9 [process id]</span><br></pre></td></tr></table></figure>
<h1 id="查看文件夹内文件信息">查看文件夹内文件信息</h1>
<ul>
<li>当前目录下文件数量(不包括子目录中的文件) <figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">$ ls -l | grep "_" | wc -l</span><br></pre></td></tr></table></figure></li>
<li>当前目录下以<code>aabb</code>开头的文件数量(不包括子目录中的文件) <figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">$ ls -l aabb* | grep "_" | wc -l</span><br></pre></td></tr></table></figure></li>
<li>当前目录下文件数量(包括子目录中的文件) <figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">$ ls -lR | grep "_" | wc -l</span><br></pre></td></tr></table></figure></li>
<li>当前目录下文件夹数量(不包括子目录中的文件夹) <figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">$ ls -l | grep "d" | wc -l</span><br></pre></td></tr></table></figure></li>
</ul>
]]></content>
<tags>
<tag>code</tag>
<tag>linux</tag>
</tags>
</entry>
</search>