博客测试

测试博客的一些设置。

Latex

爱因斯坦质能关系$E=mc^2$

行间
$$ E=mc^2 $$

编号:

\begin{equation} E=mc^2 \tag{1}\label{em} \end{equation}

方程\eqref{em}即为爱因斯坦质能关系。

下面谈谈表格。这里测试一下分节点击阅读。

表格

时间 | 地点 | 人物 |
-----|------|----
3月5日 | 北京 | 姚明
3月7日 | 上海 | 韩寒

Tables | Are | Cool
----------|:-------------:|------:
col 1 is | left-aligned | $1600 col 2 is | centered | $12
col 3 is | right-aligned | $1

表格用HTML语言实现,代码:

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
<table border="1">
<tr>
<td>第一列</td>
<td>第二列</td>
<td>第三列</td>
</tr>
<tr>
<td>内容</td>
<td>内容</td>
<td>内容</td>
</tr>
<tr>
<td>内容</td>
<td>内容</td>
<td>内容</td>
</tr>
<tr>
<td>内容</td>
<td>内容</td>
<td>内容</td>
</tr>
<tr>
<td>内容</td>
<td>内容</td>
<td>内容</td>
</tr>
</table>

实现效果:

第一列 第二列 第三列
内容 内容 内容
内容 内容 内容
内容 内容 内容
内容 内容 内容

代码

1
print("Hello World");

下面是一段Matlab代码:

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
%
% Exponent decay
% 'Computational Physics' book by N Giordano and H Nakanishi
% Section 1.2 p2
% Solve the Equation dN/dt = -N/tau
% by Joyful Physics Blog
% ------------------------------------------------------------
<p>N_nuclei_initial = 100; %initial number of nuclei<br />
npoints = 101; % Discretize time into 100 intervals<br />
dt = 0.05; % set time step<br />
tau=1; % set time constant<br />
N_nuclei = zeros(npoints,1); % initializes N_nuclei, a vector of dimension npoints X 1,to being all zeros<br />
time = zeros(npoints,1); % this initializes the vector time to being all zeros<br />
N_nuclei(1) = N_nuclei_initial; % the initial condition, first entry in the vector N_nuclei is N_nuclei_initial<br />
time(1) = 0; %Initialise time<br />
for step=1:npoints-1 % loop over the timesteps and calculate the numerical solution<br />
N_nuclei(step+1) = N_nuclei(step) - (N_nuclei(step)/tau)<em>dt;<br />
time(step+1) = time(step) + dt;<br />
end<br />
% calculate analytical solution below<br />
t=0:0.05:5;<br />
N_analytical=N_nuclei_initial</em>exp(-t/tau);<br />
% Plot both numerical and analytical solution<br />
plot(time,N_nuclei,'ro',t,N_analytical,'b'); %plots the numerical solution in red and the analytical solution in blue<br />
xlabel('Time (s)')<br />
ylabel('Number of nuclei')<br />
text(2,80,'Time constant = 1s')<br />
text(2,70,'Time step = 0.05s')</p>

运行结果为:

show and hide

标签: latex, mathjax, 代码, 表格

已有 2 条评论

  1. 表格无法解析。

  2. 评论框试验Latex

    牛顿第二定律是$\vec{F}=m\vec{a}$

    行间公式
    $$\vec{F}=m\vec{a}$$

    另一种行间公式

    \begin{equation*} \vec{F}=m\vec{a} \end{equation*}

    带编号公式

    \begin{equation} \vec{F}=m\vec{a} \tag{1}\label{eq1} \end{equation}

    方程\eqref{eq1}即为牛顿第二定律。

添加新评论

captcha
请输入验证码