Skip to content

Instantly share code, notes, and snippets.

@mgttt
Last active July 7, 2023 15:29
Show Gist options
  • Save mgttt/85985a1a9573918f59baf106a39e2d5f to your computer and use it in GitHub Desktop.
Save mgttt/85985a1a9573918f59baf106a39e2d5f to your computer and use it in GitHub Desktop.
interesting maths with python
approximation function for natural logarithm
# ln=(x,a=2**32)=>a*x**(1/a)-a
#ln=lambda x,a=1<<32:a*x**(1/a)-a
ln=lambda x,a=1<<32:a*(x**(1/a)-1)

>>> numpy.log(400) - ln(400)
-6.776018235399306e-08

经典(牛顿引力) $F = G \frac{m_1 m_2}{r^2}$

广义相对论 $G_{\mu\nu} = \frac{8 \pi G}{c^4} T_{\mu\nu}$ $G_{\mu\nu}$ 爱因斯坦张量 $T_{\mu\nu}$ 能量-动量张量 G 是牛顿的引力常数 c 是光速


$$T = \begin{pmatrix} T_{00} & T_{01} & T_{02} & T_{03} \\\ T_{10} & T_{11} & T_{12} & T_{13} \\\ T_{20} & T_{21} & T_{22} & T_{23} \\\ T_{30} & T_{31} & T_{32} & T_{33} \end{pmatrix}$$
T = \begin{pmatrix}
T_{00} & T_{01} & T_{02} & T_{03} \\
T_{10} & T_{11} & T_{12} & T_{13} \\
T_{20} & T_{21} & T_{22} & T_{23} \\
T_{30} & T_{31} & T_{32} & T_{33}
\end{pmatrix}

$$ \begin{aligned} & \phi(x,y) = \phi \left(\sum_{i=1}^n x_ie_i, \sum_{j=1}^n y_je_j \right) = \sum_{i=1}^n \sum_{j=1}^n x_i y_j \phi(e_i, e_j) = \\ & (x_1, \ldots, x_n) \left( \begin{array}{ccc} \phi(e_1, e_1) & \cdots & \phi(e_1, e_n) \\ \vdots & \ddots & \vdots \\ \phi(e_n, e_1) & \cdots & \phi(e_n, e_n) \end{array} \right) \left( \begin{array}{c} y_1 \\ \vdots \\ y_n \end{array} \right) \end{aligned} $$

$$
\begin{aligned}
  & \phi(x,y) = \phi \left(\sum_{i=1}^n x_ie_i, \sum_{j=1}^n y_je_j \right)
  = \sum_{i=1}^n \sum_{j=1}^n x_i y_j \phi(e_i, e_j) = \\
  & (x_1, \ldots, x_n) \left( \begin{array}{ccc}
      \phi(e_1, e_1) & \cdots & \phi(e_1, e_n) \\
      \vdots & \ddots & \vdots \\
      \phi(e_n, e_1) & \cdots & \phi(e_n, e_n)
    \end{array} \right)
  \left( \begin{array}{c}
      y_1 \\
      \vdots \\
      y_n
    \end{array} \right)
\end{aligned}
$$
@mgttt
Copy link
Author

mgttt commented Jul 7, 2023

Laplace Transform 拉普拉斯变换 F(s) = \mathcal{L}{f(t)} = \int_{0}^{\infty} f(t) e^{-st} dt
$$F(s) = \mathcal{L}{f(t)} = \int_{0}^{\infty} f(t) e^{-st} dt$$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment