Posts

Poor man's Daletskii-Krein

Image
Consider a second-order, symmetric tensor $A$ whose components $\def\R{\mathbb{R}}{A^j}_i \in \R$. We know that such a tensor has an eigen decomposition \begin{equation} \label{eigendecomp} A = V \Lambda V^\top \end{equation} where $V$ is an orthonormal, second-order tensor and ${\Lambda^j}_i=\lambda^j \delta^j_i$ ($\lambda^i$ is the $i$th eigenvalue of $A$). One corollary of (\ref{eigendecomp}) is \begin{equation} \label{An} A^n = V \Lambda^n V^\top . \end{equation} A function $f:\R \to \R$ that is analytic at $x=0$ is equal to its Maclaurin series \begin{equation} \label{maclaurin} f(x) = \sum_{n=0}^\infty \frac{f^{(n)}(0)}{n!} x^n \end{equation} where $f^{(0)}(0)=f(0)$ and $f^{(n)}(0)=\eval{\dv[n]{f}{x}}_{x=0}$. If we define \begin{equation} \label{def-fA} f(A):= \sum_{n=0}^\infty \frac{f^{(n)}(0)}{n!} A^n \end{equation} then $f(A)$ is also a second-order, sy...

BIO 2025

Image
Fast food In the question we are given the number of houses $N$ and $N-1$ pairs that show the connections between houses. To read a file like 7 1 2 2 3 1 4 1 5 5 6 5 7 we can write the following simple program: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #include <iostream> // std::cout, std::endl, std::cerr #include <fstream> // std::ifstream int main () { std :: ifstream file ( "pairs.txt" ); if ( ! file ) { std :: cerr << "Error: Could not open the file!" << std :: endl ; return 1 ; } int N ; if ( ! ( file >> N )) { std :: cerr << "First line should have a single integer." << std :: endl ; return 1 ; } std :: vector < std :: vector < ...