<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Endomorphism]]></title><description><![CDATA[Machine Learning, Homelab, Mathematics and more...]]></description><link>https://endomorphis.me/</link><image><url>https://endomorphis.me/favicon.png</url><title>Endomorphism</title><link>https://endomorphis.me/</link></image><generator>Ghost 5.62</generator><lastBuildDate>Fri, 06 Nov 2026 13:24:39 GMT</lastBuildDate><atom:link href="https://endomorphis.me/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Spectral method to solve parabolic equation]]></title><description><![CDATA[<h1 id="introduction-and-problem-definition">Introduction and problem definition</h1><p>The objective of this article is to present the application of the spectral method to solve parabolic partial differential equations (PDE). The theoretical resolution will be done jointly with a practical study of a typical problem.</p><p>Let $a\frac{\partial^2 u}{\partial x^2} + b\</p>]]></description><link>https://endomorphis.me/spectral-method-to-solve-parabolic-equation/</link><guid isPermaLink="false">656f32f5ab66ae0190e951c6</guid><category><![CDATA[Mathematics]]></category><dc:creator><![CDATA[Alexandre Quemy]]></dc:creator><pubDate>Wed, 06 Dec 2023 19:16:30 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1524008795083-a52d3ca1c419?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDE1fHxoZWF0JTIwZXF1YXRpb258ZW58MHx8fHwxNzAxNzg3NDM2fDA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<h1 id="introduction-and-problem-definition">Introduction and problem definition</h1><img src="https://images.unsplash.com/photo-1524008795083-a52d3ca1c419?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDE1fHxoZWF0JTIwZXF1YXRpb258ZW58MHx8fHwxNzAxNzg3NDM2fDA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="Spectral method to solve parabolic equation"><p>The objective of this article is to present the application of the spectral method to solve parabolic partial differential equations (PDE). The theoretical resolution will be done jointly with a practical study of a typical problem.</p><p>Let $a\frac{\partial^2 u}{\partial x^2} + b\frac{\partial^2 u}{\partial xy} + c\frac{\partial^2 u}{\partial y^2} + d\frac{\partial u}{\partial x} + e\frac{\partial u}{\partial y} + fu = g$ a second oder linear partial differential equations with $a,b,c,d,e,f$ constants. Such equation is said to be parabolic when $b^2-4ac=0$ and elliptic, respectively hyperbolic, when $b^2-4ac&lt;0$, respectively $b^2-4ac&gt;0$.</p><p>The <a href="https://en.wikipedia.org/wiki/Boundary_value_problem?ref=endomorphis.me">boundary value problem</a> that we will study is<br>$$ (P)\begin{cases} \frac{\partial u}{\partial t} - \Delta u = f(x,y,t)\in L^2(\Omega ), \Omega= ]0,1[\times]0,1[\times ]0,T[\cr u(x,0,t)=\frac{x^2}{2}\cr u(x,1,t)=\frac{-(x-1)^2}{2}e^{-t}\cr \frac{\partial u}{\partial n}(0,y,t) = -ye^{-t}\cr \frac{\partial u}{\partial n}(1,y,t) = 1-y\cr u(x,y,0) = \sin(2\pi y)-x^2y+xy-\frac{y}{2}+\frac{x^2}{2} \end{cases} $$ <br>The problem models the heat diffusion over time in a squared homogeneous material, heated via a given heat source $f$ of finite energy. The boundary conditions are of Dirichlet type on vertical sides and Neumann on the horizontal sides.</p><p>Finally, the initial condition gives us information on the initial heat distribution on the domain.</p><p>The solution is broken down into four steps:</p><ol><li>Homogenizing the problem, i.e. transforming the initial formulation such that the boundary conditions are equal to $0$,</li><li>Solving the Spectral problem associated to the Laplacian operator, i.e. finding its eigenvalues and eigenfunctions,</li><li>Rewriting the homogenized problem into the spectral basis</li><li>Solving the Ordinary Differential Equation that appeared with the previous step.</li></ol><h2 id="homogenization-via-ruled-surface">Homogenization via Ruled Surface</h2><p>The boundary conditions are not homogeneous such that we first need to transform the original problem $(P)$ into an homogeneous one. For that, we define $w(x,y,t) = \phi(x,y) + u(x,y,t)$. By looking at the boundary conditions, we can deduce that we are looking for a ruled surface &#xA0;$\phi(x,y)$ such that $(P)$ is homogeneous.</p><h3 id="the-ruled-surface">The Ruled Surface</h3><p> We are looking $\phi(x,y) = g_1(x) + yg_2(y)$. </p><p> Using the initial condition on the boundaries, we obtain:<br>$$\begin{cases}w(x,0,t) = \phi(x,0) + u(x,0,t) = 0 \Rightarrow \boxed{g_1(x) = -\frac{x^2}{2}}\\ w(x,1,t) = \phi(x,1) + u(x,1,t) = 0 \Rightarrow \boxed{g_2(x) = (x^2 - x + \frac{1}{2})e^{-t}}\end{cases}$$ <br>Therefore, the function $\phi$ that we are looking for is as follows: <br>$$\boxed{\phi(x,y) = -\frac{x^2}{2} + y(x^2 - x + \frac{1}{2})e^{-t}}$$ <br></p><h3 id="writing-the-homogeneous-problem">Writing the homogeneous problem</h3><p>We have $w(x,y,t) = \phi(x,y) + u(x,y,t)$, such that, by linearity of the Laplacian operator, we obtain $- \Delta u(x,y,t) = \Delta \phi(x,y) - \Delta w(x,y,t)$. <br>Similarly, $\frac{\delta u}{\delta t}(x,y,t) = \frac{\delta w}{\delta t}(x,y,t) - \frac{\delta \phi}{\delta t}(x,y,t)$ <br>Therefore, $\frac{\delta w}{\delta t}(x,y,t) - \Delta w(x,y,t) = f(x,y,t) + \Delta \phi(x,y,t) - \frac{\delta \phi}{\delta t}(x,y,t)$. <br>By definition of $\phi$, we have: <br>$$\frac{\delta u}{\delta t}(x,y,t) - \Delta \phi = 1-y(1+e^{-t}(x^2-x+\frac{3}{2}))$$ <br>which allows to write the following equivalence: <br>$$(P) \Leftrightarrow (P_h)\begin{cases} \frac{\partial w}{\partial t} - \Delta w = f(x,y,t) + 1-y(1+e^{-t}(x^2-x+\frac{3}{2})), f\in L^2(\Omega ), \Omega= &#xA0;]0,1[\times]0,1[\times ]0,T[\cr w(x,0,t)=0\cr w(x,1,t)=0\cr \frac{\partial w}{\partial n}(0,y,t) = 0\cr \frac{\partial w}{\partial n}(1,y,t) = 0\cr w(x,y,0) = \sin(2\pi y)-x^2y+xy-\frac{y}{2}+\frac{x^2}{2} \end{cases}$$</p><h2 id="solving-the-spectral-problem-associated-to-ph">Solving the spectral problem associated to $(P_h)$</h2><p>At first, we will focus only on the spatial part of the problem. The Laplacian being a compact linear operator, we are looking for its eignvalues and eigenfunctions, $\lambda_k$ and $w_k$, &#xA0;solutions to the equation:<br>$$-\Delta w = \lambda w~~(PS)$$ <br>This solution exists everywhere in $L^2(\Omega)$ thanks to the following spectral decomposition theorem:</p><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x27A1;&#xFE0F;</div><div class="kg-callout-text"><strong>Theorem:</strong><br><br>Let $V$ and $H$ be two real Hilbert spaces of finite dimension. We assume that $V \subset H$ with compact injection, i.e. the inclusion operator is continuous and compact; and that $V$ is dense in $H$. Let $a(.,.)$ be a bilinear symetric continuous form and $V$-elliptic. Then, the eigenvalues of $\forall v\in V,~~~ a(u,v) = \lambda&lt;u,v&gt;_H$ creates an increasing real-valued sequence $(\lambda_k)_{k \geq 1}$ that goes to infinity, and there exist an Hilbert basis of associated eigenvalues defined by:<br>$$u_k \in V, {\text{ et }} a(u_k,v) = \lambda_k&lt;u_k,v_k&gt;_H, ~~~ \forall v \in V$$<br><br>Furthermore, $(\frac{u_k}{\sqrt{\lambda_k}})_{k \geq 1}$ is also an Hilbert basis of the space $V$ with the inner product $a(.,.)$ (and not its canonical inner product).</div></div><p></p><p>The proof of this theorem is quite long and uses the theorem of spectral decomposition of a compact operator in a Hilbert space. This is also the reason why we need the compactness of the inclusion operator and its continuity. Details can be found in <a href="#ref_1">[1]</a>. </p><p>To take into account the Dirichlet conditions on an edge, we choose $V=H_0^1(\Omega)$ and $H=L^2(\Omega)$. A variational approach applied to $-\Delta w = \lambda w$, naturally leads to finding $a(u,v) = \int_{\Omega} \nabla u . \nabla v dx = \lambda \int_{\Omega} uv dx= \lambda &lt;u,v&gt;_{L^2(\Omega)}$. According to Rellich&apos;s theorem, $H_0^1(\Omega)$ is indeed compactly included in $L^2(\Omega)$. As the space of test functions $\cal{D}(\Omega)$ is dense in both spaces, we deduce that $H_0^1(\Omega)$ is dense in $L^2(\Omega)$ and we can apply the spectral theorem above, demonstrating the existence of a solution to the eigenvalue problem.</p><p>To return to the original problem, a Green formula suffices, taking into account the boundary conditions and using the trace theorem to conclude. We can more simply go through a weak form via the distributions, having already verified the compact and continuous injection:</p><p>$$\begin{matrix}~ &#xA0;\int_{\Omega} \nabla u . \nabla v dx = \lambda \int_{\Omega} uv dx\cr \Leftrightarrow &lt; \nabla u , \nabla v &gt; = \lambda &lt; u, v&gt;\cr \Leftrightarrow -&lt; \Delta u , v &gt; = \lambda &lt; u, v&gt;\end{matrix}$$ </p><p>Hence $-\Delta u = \lambda u$ in the sense of distributions. From the density of $\cal D$ in $H_0^1$ and $L^2$ and by compact canonical injection, we deduce the equivalence in the sense of $L^2$.</p><p>Now that we have been convinced of the existence of the solutions of $(PS)$, we need to explain these solutions. To do this, we will consider a separation of variables by setting: $w(x,t)=X(x)Y(y)$.</p><p>From the conditions at the edge we can deduce that: <br>$$\begin{cases}w(x,0) = 0 = X(x)Y(0) \Rightarrow \boxed{Y(0)=0}\\ w(x,1) = 0 = X(x)Y(1)\Rightarrow \boxed{Y(1)=0}\end{cases}$$ <br>$$\frac{\delta w}{\delta x}(0,y) = X_(x)Y(y) \Rightarrow \boxed{\begin{cases} X&apos;(0)=0\\X&apos;(1)=0\end{cases}}$$ <br>Therefore:<br>$$\begin{matrix}~ (PS) &amp; \Leftrightarrow &amp; -X&quot;(x)Y(y) - X(x)Y&quot;(y) = \lambda X(x)Y(y) \cr &amp; \Leftrightarrow &amp;-\frac{X&quot;(x)}{X(x)} - \frac{Y&quot;(y)}{Y(y)} = \lambda \cr &amp;\Rightarrow &amp; \begin{cases} - \frac{X&quot;(x)}{X(x)}=\alpha~~~(*)\cr - \frac{Y&quot;(y)}{Y(y)}=\beta~~~(**)\cr \alpha+\beta = \lambda \end{cases} \end{matrix}$$ <br>The solution poses no issue since $(*)$ and $(**)$ are second order linear differential equations with constant coefficients. A simple analysis of the characteristic equation gives us the form of the solution and the conditions on $X&apos;$ and $Y$ deduced from the conditions at the edge of the homogeneous problem make it possible to eliminate solutions which are identically zero and therefore not interesting nor from a mathematical point of view and even less from a physical point of view.</p><h3 id="solving">Solving $(*)$ </h3><p>$$- \frac{X&quot;(x)}{X(x)}=\alpha \Rightarrow -X&quot;(x) - \alpha X(x) = 0$$ <br>From the characteristic equation we find: <br>$$ \Delta = -4\alpha$$ <br>We then distinguish 3 cases:</p><h4 id="alpha-0">$\alpha &gt; 0$ </h4><p>Thus $\Delta &lt; 0$ and $X$ is of the form $X(x) = A_x \cos(\sqrt \alpha x) + B_x \sin(\sqrt \alpha x)$. <br>We deduce that $X&apos;(x) = -\sqrt \alpha A_x \sin(\sqrt \alpha x) + \sqrt \alpha B_x \cos(\sqrt \alpha x)$. <br>From the boundary conditions we deduce that: <br>$$\begin{cases}X&apos;(0) = \sqrt \alpha B_x = 0 \Rightarrow B_x = 0\\ X&apos;(1) = -\sqrt \alpha A_x \sin(\sqrt \alpha) = 0 \Rightarrow \sin(\sqrt \alpha) = 0\end{cases}$$ <br>We deduce that $\alpha_k = k^2\pi^2, \forall k&gt;0$ and therefore $ X_k(x) = A_x\cos(k\pi x), \forall k&gt;0$.</p><h4 id="alpha-0-1">$\alpha = 0$</h4><p>So $\Delta = 0$ and $X$ is of the form $X(x) = A_xx + B_x$. We deduce that $X&apos;(x) = -\sqrt \alpha A_x \sin(\sqrt \alpha x) + \sqrt \alpha B_x \cos(\sqrt \alpha x)$.<br>From the boundary conditions we deduce that:<br>$$X&apos;(0) = A_x = 0$$<br>So $X(x) = B_x$, constant solution.</p><h4 id="alpha-0-2">$\alpha &lt; 0$</h4><p>So $\Delta &lt; 0$ and $X$ is of the form $X(x) = A_xe^{-\sqrt(-\alpha)x} + B_xe^{\sqrt(-\alpha)x}$. <br>From the boundary conditions we deduce that $A_x = B_x = 0$. So $X \equiv 0$, which is not interesting.</p><h3 id="final-formulation">Final formulation</h3><p><br>Finally, we can group the two writings into one, in the following form:<br>$$X_k(x) = C_x\cos(k\pi x), \forall k \geq 0$$<br>With :<br>$$C_x = \begin{cases} B_x &amp; \text{ if } k=0 \cr A_x &amp; \text{ if } k&gt;0 \end{cases}$$<br></p><h3 id="solving-1">Solving $(**)$</h3><p>In the same way we solve the equation $(**)$. From the characteristic equation we find:<br>$$\Delta = -4\beta$$<br>We then distinguish 3 cases:</p><h4 id="case-beta-0">Case $\beta &gt; 0$</h4><p>Thus $\Delta &lt; 0$ and $Y$ is of the form . From the boundary conditions we deduce that:<br>$$\begin{cases}Y(0) = 0 \Rightarrow A_y = 0\\ Y(1) = 0 \Rightarrow \sin(\sqrt \beta) = 0\end{cases}$$<br>We deduce that $\beta_k = k^2\pi^2, \forall k&gt;0$ and therefore $Y_k(y) = A_y\sin(k\pi y), \forall k&gt;0$.</p><h4 id="case-beta-0-1">Case $\beta = 0$</h4><p>So $\Delta = 0$ and $Y$ is of the form $Y(y) = A_yy + B_y$.<br>From the boundary conditions we deduce that:<br>$$\begin{cases}Y(0) = B = 0\ Y(1) = A = 0\end{cases}$$<br>So $Y \equiv 0$, which is not interesting.</p><h4 id="formulation-finale">Formulation Finale</h4><p>The solution to $(**)$ is therefore written:<br>$$Y_k(y) = B_y\sin(k\pi y), \forall k &gt; 0$$</p><h2 id="rewriting-the-problem-in-the-spectral-basis">Rewriting the problem in the Spectral basis</h2><p>By solving $(*)$ and $(**)$ we deduce that the eigenvalues and eigenvectors of the Laplacian operator are: <br>$$\begin{cases} w_{k,l}(x,y) = C\sin(l\pi y)\cos(k\pi x)\\ \lambda _k = \pi^2(l^2 + k^2) \end{cases}, \forall k \geq 0$$ <br>According to the Riesz-Fredholm theorem cited above, there exists a Hilbertian basis (orthonormal by definition) of eigenfunctions of $L^2(\Omega)$ belonging to $H^1_0(\Omega)$ and a sequence increasing positive eigenvalues which tend towards infinity.</p><h3 id="normalization-of-basis-vectors">Normalization of basis vectors</h3><p>Before rewriting the problem in the basis of eigenfunctions thus found, let us determine the constant $C$ such that the basis is orthonormal in $L^2(\omega)$.<br>Let&apos;s solve:<br>$$\begin{matrix} ~ \vert \vert w_{l,k}\vert \vert_{L^2(\Omega)} = 1 &amp; \Leftrightarrow &amp; \int_0^1 \int_0^1 C^2\sin^2(l \pi y) \cos^2(k \pi x) dxdy \cr &amp; \Leftrightarrow &amp; C^2 \underset{\frac{1}{2}}{\underbrace{\int_0^1 \sin^2(l \pi y) dy}} \underset{\frac{1}{2}}{\underbrace{\int_0^1 \cos^2(k \pi x) dx}}\cr &amp; \Leftrightarrow &amp; \begin{cases} C = \sqrt 2 &amp; \text{ if } k=0 \cr C = 2 &amp; \text{ otherwise } \end{cases} \end{matrix}$$</p><h3 id="rewriting-the-problem-in-the-spectral-basis-1">Rewriting the problem in the spectral basis</h3><p>We can write our solution in the orthonormal basis found:<br>$$ w(x,y) = \sum_{l,k}\xi_{l,k}(t)w_{l,k}(x,y)~~ ~ (S)$$<br>According to the problem statement, $f\in L^2(\omega)$, which implies that it can also be expressed in the found basis:<br>$$f(x,y) = \sum_{l,k}f_{l,k}(t)w_{l,k}(x,y)$$<br>With $f_{l,k}(t) = &lt;f(x,y,t), w_{l,k}(x,y)&gt;_{L^2(\omega)}$<em>, i.e. the projection of $f$ on the vectors of the Hilbertian basis </em>${w}_{l,k}$.<br>We can therefore rewrite the initial problem in $w$ as follows:<br>$$\begin{matrix} ~ &amp; \frac{\partial w}{\partial t} - \Delta w = f(x,y,t) + 1-y(1+e^{-t}(x^2-x+\frac{3}{2})) &amp; \cr \Leftrightarrow &amp; \frac{\partial }{\partial t}\sum_{l,k}\xi_{l,k}(t)w_{l,k}(x,y) - \Delta \sum_{l,k}\xi_{l,k}(t)w_{l,k}(x,y) &amp; \cr &amp; = \sum_{l,k}f_{l,k}(t)w_{l,k}(x,y) + 1-y(1+e^{-t}(x^2-x+\frac{3}{2})) \end{matrix}$$<br>As normal, for a completely explicit resolution, it would be necessary to project $1-y(1+e^{-t}(x^2-x+\frac{3}{2})$ on the basis of ${L^2(\omega)}$ found, but this is of little interest.<br>We will simply put $\overset{\sim }{f}(x,y) = f(x,y) + 1-y(1+e^{-t}(x^2-x+\frac{3}{2})$. This allows us to rewrite the problem as follows:<br>$$\frac{\partial }{\partial t}\sum_{l,k}\xi_{l,k}(t)w_{l,k}(x,y) - \Delta \sum_{l,k}\xi_{l,k}(t)w_{l,k}(x,y) = \sum_{l,k}\overset{\sim }{f}_{l,k}(t)w_{l,k}(x,y)$$<br>We use the linearity of the differentiation operators to bring the Laplacian and the time derivative into the sum and we use the relation $\Delta w = -\lambda w$ to factor like this:<br>$$\sum_{l,k}[\xi&apos;_{l,k}(t) - \lambda_{l,k} \xi_{l,k}(t)]w_{l,k}(x,y) = \sum_{l,k}\overset{\sim }{f}_{l,k}(t)w_{l,k}(x,y)$$ <br>Which amounts to solving an ordinary differential equation:<br>$$\xi&apos;_{l,k}(t) - \lambda_{l,k} \xi_{l,k}(t) = \overset{\sim }{f}_{l,k}(t)$$ </p><h2 id="solving-the-ordinary-differential-equation">Solving the ordinary differential equation</h2><p>The resolution of the ODE is done very simply, using the initial conditions to obtain the $\xi_0$ and the explicit expression of the $\overset{\sim }{f}_{l,k}(t) $ to $0$.</p><p>The technique that works every time is obviously variation of the constant. I leave it to the reader to make these calculations in order to obtain the $\xi_{l,k}(t)$.</p><h2 id="final-solution">Final solution</h2><p>Once the EDO is resolved, the job is complete. If an explicit expression is really desired, simply replace the $w_{l,k}$ with the $\xi_{l,k}$, which explicitly depends on the $\overset{\sim }{f}_{l ,k}$ in the expression of $(S)$.</p><p>We could possibly work a little more to give, in a more general framework, the link between the $\xi_{l,k}$, the $\overset{\sim }{f}_{l,k}$ and the own values. Likewise, if the source term $f$ is given explicitly, we must calculate its projection on our basis in order to obtain a completely explicit solution. </p><hr><h3 id="references">References</h3><!--kg-card-begin: html--><p id="ref_1">[1]: Analyse Num&#xE9;rique et Optimisation, G. Allaire, Chapter 7.</p><!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[Distributions, Laplace Transform and Initial Value Problem]]></title><description><![CDATA[<p>&#x200C;</p><h1 id="introduction">Introduction</h1><p>In this article, we are interested in solving <a href="https://en.wikipedia.org/wiki/Initial_value_problem?ref=endomorphis.me">Initial Value Problem (IVP)</a> using a special isomorphism between the algebraic fractions in $\delta&apos;$ and the usual algebraic fractions. For that, we will use the space of distributions with compact and positive support and observe that the convolution of</p>]]></description><link>https://endomorphis.me/distributions-laplace-transform-and-initial-value-problem/</link><guid isPermaLink="false">6522e073ab66ae0190e95125</guid><category><![CDATA[Mathematics]]></category><dc:creator><![CDATA[Alexandre Quemy]]></dc:creator><pubDate>Sun, 08 Oct 2023 17:50:02 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1453733190371-0a9bedd82893?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDN8fGRpZmZlcmVudGlhbCUyMGVxdWF0aW9ufGVufDB8fHx8MTY5Njc4NzMxMnww&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1453733190371-0a9bedd82893?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDN8fGRpZmZlcmVudGlhbCUyMGVxdWF0aW9ufGVufDB8fHx8MTY5Njc4NzMxMnww&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="Distributions, Laplace Transform and Initial Value Problem"><p>&#x200C;</p><h1 id="introduction">Introduction</h1><p>In this article, we are interested in solving <a href="https://en.wikipedia.org/wiki/Initial_value_problem?ref=endomorphis.me">Initial Value Problem (IVP)</a> using a special isomorphism between the algebraic fractions in $\delta&apos;$ and the usual algebraic fractions. For that, we will use the space of distributions with compact and positive support and observe that the convolution of two distributions behaves like the multiplication over a field.</p><p>Usually, this approach to solve an IVP simply presents Laplace transforms as a tool, without much explanation about where it comes from and why it works. I took a different approach with the point of view of distributions which is the natural space to perform convolution. In my opinion, it leads to naturally observe the similar structure between this particular subspace of distributions and the polynomials. On top of that, the concrete example presented at the end of the article, which is solving a non-homogeneous ordinary differential system with constant coefficients, would not even require the mention of Laplace transform, nor to compute explicitly the transformation, but using only a symbolic table deduced directly from a simple convolution equation and observing the effect of convolving with the derivatives of the Dirac distribution.</p><p>This article starts by presenting the space of distributions and in particular the regular distributions, as well as the convolution operator.</p><h1 id="space-of-distributions">Space of Distributions</h1><p>We denote by $\mathcal D$ the set of test functions. A test function $\phi \in \mathcal D$ is a function from $\phi: \mathbb{R}^n \mapsto \mathbb{R}$. The set of test functions is associated with an extremely strong notion of convergence:</p><p>$$ \phi_n \underset{\mathcal D}{\to} \phi &#xA0;\Leftrightarrow &#xA0;\begin{cases} \exists[a,b], ~ \forall n, ~~ &#xA0;\phi_n = 0~~\text{outside of } [a,b]\ \phi = 0~~\text{outside of } [a,b] \ \forall k, ~~ \phi_n^{(k)} \underset{u}{\to} \phi^{k} \end{cases} $$</p><p>In other words, the tests functions have a compact support and are $C^{+\infty}$.</p><p>The space of distribution is the topological dual of $\mathcal D$, denoted $\mathcal{D}^*$, i.e., a distribution $T$ is a continuous linear map on $\mathcal D$. In other words,</p><p>$$T \colon \begin{aligned} \mathcal{D} &amp;\to \mathbb{C}\\\\ \phi &amp; \to &lt;T,\phi&gt; \end{aligned}$$</p><p>with the following properties:</p><ul><li>$&lt;T, a\phi + b\varphi&gt; = a&lt;T, \phi&gt; + b&lt;T,\varphi&gt;$</li><li>Si $\phi_n \to \phi$ alors $&lt;T, \phi_n&gt; \to &lt;T, \phi&gt;$</li></ul><p>We say that $T_n \overset{\mathcal{D}&apos;}{\to} T$ if and only if $\forall \phi \in \mathcal{D}, ~~ &lt;T_n, \phi&gt; \to &lt;T,\phi&gt;$.</p><h2 id="regular-distributions">Regular Distributions</h2><p>We denote by &#xA0;$L^1_{\text{loc}}$ &#xA0;the set of measurable and locally integrable functions, i.e. $\forall a &lt; b \in \mathbb{R},~~ \int_a^b \vert f(x) \vert dx &lt; \infty$.</p><p>It is relatively easy to see that if $f \in L^1_{\text{loc}}$ et $\phi \in \mathcal D$ then the product $f\phi$ is integrable. Then, any function $f \in L^1_{\text{loc}}$ uniquely defines a distribution, denoted $f$ by abuse of notation:</p><p>$$f \colon \phi \in \mathcal{D} \to &lt;f,\phi&gt; \overset{def}{=} \int_{-\infty}^{+\infty} f(x)\phi(x)dx$$</p><p>Therefore, we can identify $L^1_{\text{loc}}$ as a subset of the space of distributions $\mathcal{D}&apos;$. This subset defines <em>regular</em> distributions. A distribution that is not regular is singular.</p><h2 id="convolution-the-multiplication-of-distributions">Convolution, the <em>multiplication</em> of distributions</h2><p>Given $f$ and $g$, two measurable functions, then the $f$ and $g$ can be convolved if and only if for almost all $x$</p><p>$$h(x) = \int \vert f(u)g(x-u)\vert du &lt; +\infty$$</p><p>Then, we define convolution between two functions by:</p><p>$$f \star g(x) = \int f(u)g(x-u) du, \text{almost everywhere}$$</p><p>Convolution obviously has the commutativity property. It has regularization property on $f$. For instance, if we take $g(x) = \frac 1 {2h} 1_{[-h,h]}(x)$, $f \star g$ represents the moving average of $f$.</p><p>We can generalize the convolution operator for the space of distributions. We say that $S$ and $T$ are convolvable if and only if $\forall \phi \in \mathcal D$, the expression $&lt;S_x, &lt;T_y, \phi(x+y)&gt;&gt;$ is well-defined.</p><p>At first sight, convolution of distributions looks like composition of functions. Obviously, one might wonder when this expression is well-defined. Unfortunately, we would have to introduce the space of <a href="https://en.wikipedia.org/wiki/Distribution_(mathematics)?ref=endomorphis.me">Schwartz distributions</a>, which is outside the scope of this article. Therefore, we will only invoke $D_+&apos;$, the space of distributions with positive and compact support, i.e a subset of $[0,+\infty[$.</p><p>The good news is that the convolution is well-defined for any function of $D_+&apos;$. In particular, the Dirac distribution is the neutral element for $\star$. Indeed,</p><p>$$&lt;\delta \star T, \phi&gt; = &lt;\delta_x, &lt;T_y, \phi(x+y)&gt;&gt; = &lt;T_y, \phi(0+y)&gt; = &lt;T,\phi&gt;$$</p><p>Finally, let us consider the effect of the derivative of the Dirac by the convolution operator:</p><p>$$&lt;T\star \delta&apos;, \phi&gt; = &lt;T_x,&lt;\delta&apos;_y, \phi(x+y)&gt;&gt; = &lt;T_x, -&lt;\delta_y, \phi&apos;(x+y)&gt;&gt; = &lt;T&apos;, \phi&gt; $$</p><p>That is to say $T\star \delta&apos; = T&apos;$ and $T \star \delta^{(k)} = T^{(k)}$.</p><p>The convolution of a distribution $T$ by the $k$-th derivative of the Dirac distribution is the $k$-th derivative of the distribution!</p><h1 id="laplace-transform-and-the-algebra-over-d">Laplace Transform and the algebra over $D_+&apos;$</h1><p>$(D_+&apos;, +, \times, \star)$ is an associative, commutative and unitary algebra. Precisely, it is a Banach $\star$-algebra usually denoted $L^1(G)$. $\times$ denotes the scalar multiplication. We denote by $T^{\star n}$ the $n$ times composition of the convolution of $T$ by itself. For any locally integrable function $f$, $Hf$ belongs to $D_+&apos;$ where $H$ is the <a href="https://en.wikipedia.org/wiki/Heaviside_step_function?ref=endomorphis.me">Heaviside distribution</a><sup><a>[1]</a></sup>.</p><p>Notice that $\delta&apos;&apos; = \delta&apos; \star \delta&apos; = {(\delta&apos;)}^{\star^2}$ and that a polynomial of $\delta&apos;$ is defined by $P(\delta&apos;) = \delta^{(n)} + a_{n-1}\delta^{(n-1)}+\ldots+a_0\delta$. Therefore, if $T\in D_+&apos;$ then $P(\delta&apos;)\star T = T^{(n)}+ a_{n-1}T^{(n-1)}+\ldots+a_0T$.</p><p>We can create an isomorphism $\mathcal L$ between algebraic fractions in $\delta&apos;$ and the usual algebraic fractions such that:</p><p>$$\begin{array}{c &#xA0;c &#xA0;c} \star &amp; \leftrightarrow &amp; \times\\ \delta &amp; \leftrightarrow &amp; 1\\ c\delta &amp; \leftrightarrow &amp; c \\ \delta&apos; &amp; \leftrightarrow &amp; p \\ \delta^{(n)} &amp; \leftrightarrow &amp; p^n\\ P(\delta&apos;) &amp; \leftrightarrow &amp; P(p) \end{array}$$</p><p>In particular, $\mathcal L$ needs to satisfy the following conditions: $\mathcal L{ f \star g} = F(s)G(s)$ and $\mathcal L^{-1}{ f g} = (f \star g)(t)$ where $F = Hf$ and $G = Hg$.</p><p>This transformation is known as Laplace transform and can be explicited by:</p><p>$$\forall f\in L^1_{\text{loc}}, ~ \mathcal L[f](\lambda) = \int_0^{+\infty} f(t)e^{-\lambda t}dt$$</p><p>However, we do not need to compute any transformation analytically, and we can just work with the property of our newly defined algebra.</p><p>It is easy to show that $P(\delta&apos;)^{\star -1} \leftrightarrow \frac 1 {P(p)}$. Hence, $Q(\delta&apos;)\star P(\delta&apos;)^{\star -1} \leftrightarrow \frac {Q(p)} {P(p)}$.</p><p>Another remarkable relation is given by $He^{\lambda t} = (\delta&apos;-\lambda \delta)^{\star -1} \leftrightarrow \frac 1 {p - \lambda}$</p><p>If the product of two distribution is not defined in general, the product of a distribution by a $C^{\infty}$ function is not a problem. <a>&#x21A9;&#xFE0E;</a></p><div class="kg-card kg-callout-card kg-callout-card-purple"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text"><strong>Proof:</strong><br>We have $\delta = \delta&apos; \star H$. Multiplying each side by $e^{\lambda t}$ leads to:<br>$\delta&apos; \star He^{\lambda t} = \lambda e^{\lambda t} H + \delta e^{\lambda t}$but $\delta e^{\lambda t} = 1$ and therefore $\delta&apos; \star He^{\lambda t} - \lambda He^{\lambda t} = 1$<br><br>And therefore, $He^{\lambda t} = (\delta&apos;-\lambda \delta)^{\star -1}$ which can be directly transformed into $\frac 1 {p - \lambda}$.</div></div><!--kg-card-begin: markdown--><h2 id="some-examples-of-correspondance">Some examples of correspondance</h2>
<p>From the previous relation, we can deduce the following one:</p>
<p>$H\frac {t^{n-1}}{(n-1)!} e^{\lambda t} \leftrightarrow \frac 1 {(p - \lambda)^n}$</p>
<p>In particular $\lambda = 0$ : $H\frac {t^{n-1}}{(n-1)!} \leftrightarrow \frac 1 {p^n}$</p>
<p>Obviously, with the exponential decomposition, we can obtain the relations with all trigonometric functions:</p>
<ul>
<li>$H \frac {sin (\omega t)}{\omega } \leftrightarrow \frac 1 {p^2 + \omega^2}$</li>
<li>$H cos (\omega t) \leftrightarrow \frac p {p^2 + \omega^2}$</li>
<li>$H \frac {sh (\omega t)}{\omega } \leftrightarrow \frac 1 {p^2 - \omega^2}$</li>
<li>$H ch (\omega t) \leftrightarrow \frac p {p^2 - \omega^2}$</li>
</ul>
<p>A list of Laplace transform for some usual functions can be found <a href="https://en.wikipedia.org/wiki/List_of_Laplace_transforms?ref=endomorphis.me">here</a>.</p>
<h1 id="application-to-the-initial-value-problem-ivp">Application to the Initial Value Problem (IVP)</h1>
<p>Consider the following system of ordinary differential equations:</p>
<p>$$\left\{\begin{aligned}<br>
x&apos;+y&apos; = f\\<br>
x+y&apos;&apos;=g<br>
\end{aligned}\right.$$</p>
<p>with $f$ and $g$ in $L^1_{\text{loc}}$, given, and the initial values $x(0)$, $y(0)$ and $y&apos;(0)$ also given.</p>
<p>This system is non-homogeneous because of $f$ and $g$, coupled because the dependent variables appear in more than one equation, and linear.</p>
<p>To solve this, the first step is to transform our system in $D_+&apos;$ by defining $X = Hx$, $Y=Hy$, $F=Hf$ et $G=Hg$ , d&#xE9;finie par $0$ sur $\mathbb{R}^{-}$ et $1$ sur $\mathbb{R}^{+}$.</p>
<p>To completely rewrite the system, we need to obtain $X&apos;$ as well as $Y&apos;$ and $Y&apos;&apos;$. By applying the derivative of Heaviside, we obtain $X&apos;=Hx&apos;+x(0)\delta$ and $Y&apos;=Hy&apos;+y(0)\delta$.<br>
Doing the same for $Y&apos;$ leads to $Y&apos;&apos;=Hy&apos;&apos;+y&apos;(0)\delta + y(0)\delta&apos;$.</p>
<p>Thus, our system is equivalent to the following in $D_+&apos;$:</p>
<p>$$\left\{\begin{aligned}<br>
X&apos;+Y&apos;&amp; = F + (x(0)+y(0))\delta\\<br>
X+Y&apos;&apos;&amp; = G + y(0)\delta&apos;+y&apos;(0)\delta<br>
\end{aligned}\right.$$</p>
<p>The second step is to apply Laplace transform to obtain a pure algebraic system:</p>
<p>$$\left\{\begin{aligned}<br>
pX + pY &amp; = F + x(0)+y(0)\\<br>
X+p^2Y &amp; = G + y(0)p+y&apos;(0)<br>
\end{aligned}\right.$$</p>
<p>Which is equivalent to:</p>
<p>$$\begin{aligned}<br>
\begin{pmatrix}<br>
p &amp; p\\<br>
1 &amp; p^2<br>
\end{pmatrix}  &amp; \begin{pmatrix}<br>
X \\<br>
Y<br>
\end{pmatrix} &amp; = &amp; \begin{pmatrix}<br>
F + x(0)+y(0) \\<br>
G + y(0)p+y&apos;(0)<br>
\end{pmatrix}<br>
\end{aligned}$$</p>
<p>In other words, our initial system is equivalent to a the linear system $AZ = B$.</p>
<p>The determinant of $A(p)$ is $det(A(p)) = p(p^2-1)$ such that we can calculate the inverse of $A$ and solve this sytem very easily.</p>
<p>$$A(p)^{-1} = \frac 1 {p(p^2-1)} \begin{pmatrix}<br>
p^2 &amp; -p\\<br>
-1 &amp; p<br>
\end{pmatrix}$$</p>
<p>Therefore,</p>
<p>$$\begin{aligned}<br>
\begin{pmatrix}<br>
X \\<br>
Y<br>
\end{pmatrix} &amp; = &amp; \frac 1 {p(p^2-1)} \begin{pmatrix}<br>
p^2 &amp; -p\\<br>
-1 &amp; p<br>
\end{pmatrix} &amp;<br>
\begin{pmatrix}<br>
F + x(0)+y(0) \\<br>
G + y(0)p+y&apos;(0)<br>
\end{pmatrix}<br>
\end{aligned}$$</p>
<p>To obtain $X$ and $Y$, it is enough to apply the inverse of Laplace transform.<br>
For $x$:<br>
$X = (x(0)+y(0))\frac p {p(p^2-1)} - y(0)\frac p {p^2 -1} - y&apos;(0)\frac 1 {p^2 -1} + F \frac p {p^2 -1} - G \frac 1 {p^2 -1}$</p>
<p>For $t&gt;0$, we have $x(t) = x(0)ch(t) - y&apos;(0)sh(t)+\int_0^tf(s)ch(t-s)-g(s)sh(t-s)ds$.</p>
<p>Using a partial fracton decomposition, we obtain $y(t) = -x(0)(ch(t) -1)+y&apos;(0)sh(t)+\int_0^tg(s)sh(t-s)-f(s)(ch(t-s)-1)ds$.</p>
<p>A basic verification consists in taking $t=0$ to observe that the initial conditions hold.</p>
<p>To summarize, the method consists in rewriting the problem in $D_+&apos;$, then expressing the system in a symbolic form, which is implicitely applying Laplace transform. The new problem is basically a linear system that can easily be solved for $p$. Once the solution is obtained, the solution to the original problem can be found thanks to the inverse transform.</p>
<h1 id="conclusion">Conclusion</h1>
<p>In this article, I tried to show another point of view on Laplace transform, and in particular, how it is possible to leverage the convolution algebra to avoid to have to explicitely compute Laplace transforms (or to refer to tables).<br>
The isomorphism between the algebraic fractions in $\delta&apos;$ and the usual algebraic fractions is absolutely remarkable and beautiful because it allows to solve analytically complex non-homogeneous, coupled and linear systems of ordinary differential equation without manipulating a single integral, but with basic algebra only.</p>
<p>Notice that the method holds for systems without constant coefficient, but requires to solve more complex convolution equations to determine the correspondance. In some cases, it might be easier to refer to tables of Laplace transform. But it is obviously less beautiful!</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[On controlling the propagation of numerical errors]]></title><description><![CDATA[<!--kg-card-begin: markdown--><h1 id="introduction">Introduction</h1>
<p>Numerical computations are always tainted by errors. A typical example is when scientists simulate a physical system by a numerical method for which a mathematical study gives a bound on the error depending on some parameters. For example, with the <a href="https://en.wikipedia.org/wiki/Euler_method?ref=endomorphis.me">Euler method</a>, the error compared to the real solution</p>]]></description><link>https://endomorphis.me/on-controlling-the-propagation-of-numerical-errors/</link><guid isPermaLink="false">651173acab66ae0190e94f83</guid><category><![CDATA[Mathematics]]></category><dc:creator><![CDATA[Alexandre Quemy]]></dc:creator><pubDate>Mon, 25 Sep 2023 16:44:38 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1653361860636-36f2fb89eab9?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDJ8fG51bWVyaWNhbCUyMGNvbXB1dGF0aW9ufGVufDB8fHx8MTY5NTY2MDI1M3ww&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h1 id="introduction">Introduction</h1>
<img src="https://images.unsplash.com/photo-1653361860636-36f2fb89eab9?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDJ8fG51bWVyaWNhbCUyMGNvbXB1dGF0aW9ufGVufDB8fHx8MTY5NTY2MDI1M3ww&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="On controlling the propagation of numerical errors"><p>Numerical computations are always tainted by errors. A typical example is when scientists simulate a physical system by a numerical method for which a mathematical study gives a bound on the error depending on some parameters. For example, with the <a href="https://en.wikipedia.org/wiki/Euler_method?ref=endomorphis.me">Euler method</a>, the error compared to the real solution decreases with the time step. If we did the numerical computation by hand, a time step that goes towards $0$ would allow us to find the exact solution. Obviously, it is impossible, even for a machine, to have a time step of $0$, but one might think that reducing it as much as our time budget or computing power allows is a good thing. <em>Absolutely not!</em></p>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://endomorphis.me/content/images/2023/09/image-42.png" class="kg-image" alt="On controlling the propagation of numerical errors" loading="lazy" width="275" height="150"><figcaption>1/3 cannot be represented exactly by a calculator.</figcaption></figure><p>Indeed, a second category of errors, not connected to the method but much more general, is the <a href="https://en.wikipedia.org/wiki/Floating-point_arithmetic?ref=endomorphis.me">representation &#xA0;error </a>. The problem is far more trivial, almost crude in the simplicity of its statement: it is impossible to represent an infinite quantity in memory space of finite size.</p><p>This leads us to consider the fact that, whatever the representation we chose, i.e., the way of translating a real number for the hardware, there will always exist numbers for which the representation will not be possible. An army of engineers and researchers worked to find and formalize a practical and intelligent representation, as a compromise between precision and ease of handling. This standardization process resulted in the <a href="https://en.wikipedia.org/wiki/IEEE_754?ref=endomorphis.me">IEEE-754 standard</a> followed by most of the world&apos;s computer hardware.</p><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x26A0;&#xFE0F;</div><div class="kg-callout-text"><strong>Warning:</strong><br>While a general reminder on the real numbers representation is provided, it is advised to have some notions about the representation of floating point numbers and basic notions of probabilities, in particular, on the construction of confidence intervals, in order to approach the theoretical part.</div></div><p>A question that naturally arises is: can I numerically control the errors which are induced by the representation error and then propagated during the calculation? This is what we will try to answer positively thanks to the <strong>CESTAC</strong> method, which stands for STochastic Control and Estimation of Rounding of Calculations (fr.: Contr&#xF4;le et Estimation STochastique des Arrondis de Calculs).</p><!--kg-card-begin: markdown--><p><mark>An implementation of the method described in this article can be found in the following repository:</mark><br>
<center><br>
<a href="https://github.com/aquemy/CESTAC?ref=endomorphis.me"><img src="https://gh-card.dev/repos/aquemy/CESTAC.svg" alt="On controlling the propagation of numerical errors" loading="lazy"></a><br>
</center></p>
<!--kg-card-end: markdown--><h1 id="some-floating-point-arithmetic-reminders">Some floating point arithmetic reminders</h1><!--kg-card-begin: markdown--><p>Let us first see how to represent a real number in <a href="https://en.wikipedia.org/wiki/Scientific_notation?ref=endomorphis.me">scientific notation</a> and in a any <a href="https://en.wikipedia.org/wiki/Radix?ref=endomorphis.me">base</a></p>
<p>We denote by $b$ the base of the arithmetic in which we will work, with generally $b=2$ or $b = 16$ for modern computation units. Then, any number $x \in \mathbb {R}$ can be written by:</p>
<p>$$x = \pm mb^E$$</p>
<p>With $\frac{1}{b} \leq m &lt; 1$ and $m$ the <a href="https://en.wikipedia.org/wiki/Significand?ref=endomorphis.me">significand</a>, possibly having an <strong>infinite</strong> number of digits after the comma, and $e$ an <a href="https://en.wikipedia.org/wiki/Exponent?ref=endomorphis.me">exponant</a> which is an integer expressed in base $b$.</p>
<p>We can rewrite the significand in base $b$ such that $\sum_{i}^n m_ib^{-i}, 0 \leq m_i &lt; b$ with $n \in \mathbb{N} \cup +\infty$.</p>
<!--kg-card-end: markdown--><div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-text"><strong>Example:</strong><br>We consider $x = 0,1_{10}$ that we would like to express using this representation. It is enough to write $x = 0,1 \times 10^0$. Now, if we want to express $x$ using a base $2$, things are more complicated because the significand does not have a finite number of digits! Indeed, by successive divisions, we find that $0,1_{10} = 0,000110011001100..._2$!</div></div><p>As we mentioned in the introduction, since a computer has only a finite amount of memory, it is impossible for it to store an infinite amount of information. Worse, whatever the base $b$ chosen, there exists an infinite number of numbers whose represensation include a significand having an infinite number of digits. In other words, it is impossible to perfectly represent the set of reals with a computer. Real numbers are generally approximated by numbers called floating point numbers.</p><p>Let us give a succinct proof. </p><div class="kg-card kg-callout-card kg-callout-card-purple"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text"><strong>Proof:</strong><br>By definition, a normal number is a number such that any finite sequence of <em>bits</em> occurs an infinite number of times in the significand of this number, and the probability of occurrence of the sequences is uniform. It is said to be normal in any base if whatever the base it is normal. Thanks to <a href="https://en.wikipedia.org/wiki/Borel%E2%80%93Cantelli_lemma?ref=endomorphis.me">Borel-Cantelli lemma</a> we prove that the set of non-normal numbers in any base has a null measure. Therefore, whatever the base, the probability that a number drawn at random on $\mathbb{R}$ is normal, is 1. $\square$</div></div><p>This is how for a machine, a real number $x$ is represented by a floating number $X$ which can itself be written as follows:</p><p>$$X = \pm Mb^E$$</p><p>With $\frac{1}{b} \leq M &lt; 1$ and $M$ the significand encoded on a <strong>finite</strong> number of digits $n$ and $E$ the exponent, also encoded on a <strong>finite</strong> number of digits. We can therefore write $M$ in base $b$ by: $\sum_{i=1}^n M_ib^{-i}, 0 \leq M_i &lt; b$, where this time the number of elements to be summed is always finite.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://endomorphis.me/content/images/2023/09/image-43.png" class="kg-image" alt="On controlling the propagation of numerical errors" loading="lazy" width="662" height="54" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-43.png 600w, https://endomorphis.me/content/images/2023/09/image-43.png 662w"><figcaption>Double precision encoding of a real number in the IEEE-754 standard: 52 significand bits, 11 exponent bits, 1 sign bit.</figcaption></figure><p>As these are only reminders, I am not going into all the intricacies of the IEEE-754 standard, and these explanations are sufficient to continue the article.</p><p>We consider the assignment operation ($:=$): $\mathbb {R} \to \mathcal {F}$, where $\mathcal{F}$ is the set of floating point numbers. That is to say the operation which associates to a real number its machine representation.</p><p>To concretely illustrate the banality of the thing via C++:</p><pre><code class="language-cpp">double x = 0.1;
</code></pre><p>For a given real $x$, there exists a float $X^+$ and a float $X^-$ such that $X^- \leq x \leq X^+$ and such that there is no float $Y$ and $Z$ such that $X^- &lt; Y &lt; x &lt; Z &lt; X^+$. In other words, $X ^ +$ and $X ^-$ are the floats immediately greater than and less than $x$.</p><p>If $x$ is representable in an exact way, then we have equality between the three terms and the assignment operation $X: = x$ is unambiguously defined.</p><p>If this is not the case, as in the above example with $0.1$ in base 2, we must choose a representative between $X^+$ and $X^-$. At first sight, none of them are more legitimate to represent $x$.</p><p>This is where the IEEE-754 standard comes in to offer four rounding modes to remove ambiguity about the assignment operation. Here is a brief description:</p><ul><li>Rounding towards $+ \infty$ (or by excess): we return $X ^ +$ except if $x = X ^ -$.</li><li>Rounding to $- \infty$ (or by default): we return $X ^ -$ unless $x = X ^ +$.</li><li>Round to $0$: returns $X ^ -$ for positives and $X ^ +$ for negatives.</li><li>Rounding to nearest: returns the machine number closest to $x$.</li></ul><p>An essential property of the IEEE-754 standard is that it guarantees that the result of a floating point operation is equal to the result of the corresponding real operation to which the rounding mode is applied rightafter. In other words, if we choose a rounding mode $\text{Arr}$, $a$ and $b$ two real numbers whose floating point representations are $A$ and $B$, $+$ a real operation, and $\oplus$ its machine counterpart, then, the standard guarantees us that $A \oplus B = Arr(a + b)$.</p><!--kg-card-begin: markdown--><p><mark>This property, known as <strong>correct rounding</strong>, is essential because it makes it possible to prove on a numerical algorithm or to obtain proven bounds for numerical results.</mark></p>
<!--kg-card-end: markdown--><p>Finally, we can define the relative assignment error by the following formula: $\alpha = \frac {X - x}{X}$. It is precisely this initial error of representation which propagates during the computation.</p><h1 id="the-different-problems-caused-by-numerical-computation">The different problems caused by numerical computation</h1><p>s mentioned earlier, any algorithm that performs floating point computations gives an error-ridden result. When an algorithm is finite (where finite is understood as a finite number of steps to find the solution to a problem), then the numerical error is the result of the propagation of rounding or truncation errors during floating point operations.</p><p>In the case of iterative algorithms, for example Newton&apos;s method, it is also necessary to stop the algorithm after a certain number of iterations, optimal if possible, which is a problem considering that:</p><ul><li>if the algorithm is stopped too early, the solution obtained will not be a good approximation of the real solution. It is the <a href="https://en.wikipedia.org/wiki/Rate_of_convergence?ref=endomorphis.me">rate of convergence</a> which informs us about this, that is to say the mathematics behind a specific method;</li><li>if the algorithm is stopped too late, additional steps will not bring more precision to the solution obtained, and worse, the propagation of errors can degrade the solution, until, for pathological cases, returning a result which has no meaning.</li></ul><p>What is important here is that given an iterative numerical method, the objectives of the mathematician and the engineer are in a way opposed: the former would like to continue to iterate as much as possible (that is, as long as the time constraints allows it) because he knows that this leads to a better solution in theory, while the engineer tells us that we must stop at some point.</p><p>In reality, there are at least four interesting and central issues:</p><ol><li>For the mathematician: given some hardware and a system of representation, how can I obtain a better approximation of the solution to my problem?<br><strong>Answer:</strong> find algorithms with higher convergence rate or methods to speed up convergence! In this regard, one might cite the method of <a href="https://en.wikipedia.org/wiki/Aitken%27s_delta-squared_process?ref=endomorphis.me">Aitken&apos;s Delta-2</a> or the <a href="https://en.wikipedia.org/wiki/Peter_Wynn_(mathematician)?ref=endomorphis.me#cite_note-15">$\epsilon$-algorithme</a>.</li><li>For the engineer: for a given algorithm AND some hardware with a system of representation, how can we get a better solution approximation?<br><strong>Answer:</strong> reorganize the operations within the algorithm to limit the error propagation while not changing the convergence rate! A generic technique of reorganizing the terms of a sum is called <a href="https://en.wikipedia.org/wiki/Kahan_summation_algorithm?ref=endomorphis.me">Kahan&apos;s summation algorithm</a>.</li><li>For everyone: for a given algorithm and its implementation, how can we get the best out of it?<br><strong>Answers:</strong> Choose the most suited representation of real numbers (<a href="https://fr.wikipedia.org/wiki/Calcul_formel?ref=endomorphis.me">symbolic system</a>, <a href="https://en.wikipedia.org/wiki/Decimal32_floating-point_format?ref=endomorphis.me"><code>decimal32</code></a>, etc. which generally requires better hardware performance) or increase the encoding size of reals (from <a href="https://en.wikipedia.org/wiki/Single-precision_floating-point_format?ref=endomorphis.me">simple</a> to <a href="https://en.wikipedia.org/wiki/Double-precision_floating-point_format?ref=endomorphis.me">double precision</a> or <a href="https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format?ref=endomorphis.me">quadruple precision</a>, etc. which only consists in increasing the number of bits to encode the significand and the exponent to represent real numbers, which again requires better hardware performance).</li><li>For the numericist: how to determine the optimal number of iterations to be performed by an algorithm, whatever the input data? How far is my numeric solution from its real equivalent?<br><strong>Answer:</strong> Find methods to estimate the numerical precision of a result, which involves estimating the propagation of rounding errors!</li></ol><p>CESTAC method attempts to solve the last problem and will be presented in the following section. However, as we will see below, we cannot do it without some knowledge about the other problems.</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x2753;</div><div class="kg-callout-text"><strong>Question:</strong> <br>Are you not exaggerating the computation errors a little and is it not ultimately just some considerations for researchers with long grey beards? Are mistakes so common and so important? From what I&apos;ve read, the IEEE-754 standard allows precision to the order of $10^{-15}$ in double precision so my results are at least as good right?</div></div><p><strong>No</strong>, <strong>yes</strong>, and <strong>no</strong>. Let us take an extremely simple pathological case: $x_n = ax_ {n-1} - b$, which is an extremely simple computation. Here is also a C++ implementation with a particular initialization:</p><!--kg-card-begin: html--><pre class="line-numbers language-cpp"><code>
#include <iostream>
#include <iomanip>
#include <limits>

int main() {
     using namespace std;

     double    b=4095.1;
     double    a=b+1;
     double    x=1;

     for (int i = 0; i &lt; 100; ++i) {
          x = (a*x) - b;
          cout &lt;&lt; &quot;iter &quot; &lt;&lt; i &lt;&lt; &quot; - &quot; &lt;&lt; setprecision(numeric_limits<double>::max_digits10) &lt;&lt; x &lt;&lt; &apos;\n&apos;;
     }
     return 0;
}
</double></limits></iomanip></iostream></code></pre><!--kg-card-end: html--><p>Which gives for output (directly available <a href="http://ideone.com/ekKPml?ref=endomorphis.me">here</a>):</p><pre><code class="language-console">iter 0 - 1.0000000000004547
iter 1 - 1.0000000018630999
iter 2 - 1.0000076314440776
iter 3 - 1.0312591580864137
iter 4 - 129.04063743775941
iter 5 - 524468.25500880636
iter 6 - 2148270324.2415719
iter 7 - 8799530071030.8047
...
iter 88 - 3.519444240677161e+305
iter 89 - inf
</code></pre><p>While the expected mathematical result is $1$, constant for each iteration, we observe that after a few iterations on the machine there is a fast divergence towards infinity. After only 4 iterations, the number of significant digits between the exact actual result and its floating bias is 0!</p><h1 id="stochastic-control-and-estimation-of-rounding">Stochastic control and estimation of rounding</h1><h2 id="cestac-core-and-error-propagation">CESTAC core and error propagation</h2><p>The <a href="https://en.wikipedia.org/wiki/Algebra_over_a_field?ref=endomorphis.me">algebra</a> $\mathcal{F}$ over the field of floating point numbers is not <a href="https://en.wikipedia.org/wiki/Associative_property?ref=endomorphis.me">associative</a> nor distributive. In other words, the order in which we perform our arithmetic operations has an impact on the result.</p><!--kg-card-begin: markdown--><p><mark>The correct rounding property ensures the commutativity<a href="https://i.imgur.com/E2HbSVF.jpg?ref=endomorphis.me">.</a></mark></p>
<!--kg-card-end: markdown--><p>From now on, consider $f$, a procedure acting on $\mathbb {R}$, and its image $F$, a procedure acting on $\mathcal{F}$. Because of the non-associativity, the image of $f$ is actually not unique and there are several procedures which mathematically transcribe $f$ exactly. And obviously, these procedures, due to the roundings, will not return the same float.</p><div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-text"><strong>Example:</strong><br>Let the following function be $f(x) = x^2 + x +1$. The most naive function on $\mathcal{F}$ would be $F_1(X) = (X^2 + X) + 1$ but we could also have $F_2(X) = X^2 + (X + 1)$ or even $F_3 (X) = X (X + 1) + 1$. It is obvious that on $\mathbb{R}$ all these procedures are exactly the same because they return exactly the same result thanks to the properties of associativity and distributivity.</div></div><div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-text"><strong>Numerical example:</strong><br>Consider floating-point numbers with 6 digits of precision. Consider $x = 1.23456 \times 10^{-3}$, $y = 1.00000 \times 10^{0}$ and $z = -y$. If we perform the calculation $(x + y) + z$, we find $1.23000 \times 10^{- 3}$, however, the calculation $x + (y + z)$ will give $1.23456 \times 10^{-3}$. We can therefore see that the order of operations matters.</div></div><p>As in practice, the algorithms are a succession of small computation steps, as illustrated above on the evaluation of a polynomial, the computation will propagate the errors operation after operation. In optimistic scenarios, the errors compensate each other or are too small and the result is remarkably close to what the precision of the representation allows (however, it is impossible to exceed 16 significant digits in double precision, by definition!), but in the worst case scenario, the result can be totally irrelevant.</p><div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-text"><strong>Example: </strong>Propagation of the addition error.<br>Let us consider $x$ and $y$ two reals and their machine representations $X$ and $Y$, respectively tainted with an error $\epsilon_x$ and $\epsilon_y$.<br><br>What happens when we add them?<br><br>$$X + Y = x + \epsilon_x + y + \epsilon_y = (x+y) + \epsilon_x + \epsilon_y$$<br><br>The errors are added to each other and add to the exact result $x + y$. If we add a third float to this result, we will get a new error term, etc. The result obtained will be even further from the exact result as the sum of the errors will not be negligible compared to the exact terms (here $x$ and $y$).</div></div><p>In summary, from a procedure $f$ over the field of real numbers, there are several procedures $(F_i)_{0 \leq i &lt;K}$ that we can obtain by permuting the elementary operations and, which theoretically offer in the worst case $K$ different results. On top of that, there is a perturbation of the result by the chosen rounding mode which further exacerbates the worst case <sup><a>[1]</a></sup>.</p><p>The main idea behind CESTAC is to take advantage of the great variability of the results that can be obtained by a sequence of numerical computations. For this, we use some <strong>perturbations</strong> on the result of an operation and some <strong>permutations</strong> of the operands, in order to estimate the number of <strong><a href="https://en.wikipedia.org/wiki/Significant_figures?ref=endomorphis.me">significant figures</a></strong> of a numerical result. By propagating the numerical errors in different random ways, we will be able to distinguish the variable part - the part stained with errors, or not representative -, from the fixed part - the exact part -.</p><h2 id="finding-the-number-of-significant-digits">Finding the number of significant digits</h2><p>If we have a procedure $F$ that we run $N$ times with a <strong>random</strong> perturbation and permutation each time, we get a <a href="https://en.wikipedia.org/wiki/Sample_(statistics)?ref=endomorphis.me">sample</a> $R = (R_0, R_1, ..., R_ {N-1})$ of results. We can therefore consider $F$ as a <a href="https://en.wikipedia.org/wiki/Random_variable?ref=endomorphis.me">random variable</a> with values in $\mathcal{F}$, with an <a href="https://en.wikipedia.org/wiki/Expected_value?ref=endomorphis.me">expected value</a> $\mu$ and a <a href="https://en.wikipedia.org/wiki/Standard_deviation?ref=endomorphis.me">standard deviation</a> $\sigma$. The expectated value $\mu$ can be interpreted as the expected result of the algorithm, i.e. the floating point number that encodes our real solution $r$. The error compared to this expectation, that is to say $\alpha = |r - \mu|$ is the loss of precision that one is entitled to expect from performing numerical computations in floating point. The problem is that $\mu$ is not known, and therefore, we have to estimate it.</p><p>In this context, with the hypothesis that the elements of $R$ come from a <a href="https://en.wikipedia.org/wiki/Normal_distribution?ref=endomorphis.me">Gaussian distribution</a> (which is verified in practice), the best <a href="https://en.wikipedia.org/wiki/Estimator?ref=endomorphis.me">estimator</a> of $\mu$ is the mean of the sample $R$:<br>$$\bar R = \frac 1 N \sum^N_i R_i $$</p><p>Similarly, the best estimator of $\sigma^2$ is given by:<br>$$S^2 = \frac 1 {N-1} \sum^N_i (R_i - R)^2 $$</p><p>A classic use of the <a href="https://en.wikipedia.org/wiki/Central_limit_theorem?ref=endomorphis.me">central limit theorem</a> allows us to build a <a href="https://en.wikipedia.org/wiki/Confidence_interval?ref=endomorphis.me">confidence interval</a> for the exact value $r$ for a threshold $p$:</p><p>$$\mathbb{P},(r \in [\bar R - t_{N-1}(p) \frac{S}{\sqrt{N}}; \bar R + t_{N-1}(p) \frac{S}{\sqrt{N}}]) = 1 - p$$</p><p>Where $t_{N-1} (p)$ is the value of the <a href="https://en.wikipedia.org/wiki/Cumulative_distribution_function?ref=endomorphis.me">cumulative distribution function</a> of <a href="https://en.wikipedia.org/wiki/Student%27s_t-distribution?ref=endomorphis.me">Student</a> for $(N-1)$ degrees of freedom and a threshold of $p$.</p><p>From this interval, it is possible to calculate the number of significant digits $C$ of our estimator $\bar R$:</p><p>$$C_{\bar R} = \log_{10}(\frac {|\bar R|} {S}) - K(N, p)$$</p><p>where $K$ depends only on $N$ and $p$, and such it that tends towards $0$ with $N$ increasing. The value of $p$ is fixed in practice at $0.05$, which makes it possible to obtain a confidence interval of $95%$. Here is now the value of $K$ obtained as a function of $N$, for $p = 0.05$:</p><!--kg-card-begin: html--><table>
<thead>
<tr>
<th>N</th>
<th>K</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>1.25</td>
</tr>
<tr>
<td>3</td>
<td>0.396</td>
</tr>
</tbody>
</table><!--kg-card-end: html--><p>This may seem surprising but using a sample of size $N = 3$ results in $K$ being less than $1$, i.e., on average, there is no significant digit loss for the sample $R$. In fact, increasing this number is useless because the length of the interval evolving in $\frac 1 N$, to obtain an additional significant figure, it would be necessary to multiply $N$ by 100 (because of the $\log_{10}$)!</p><h2 id="constructing-the-sample-r">Constructing the sample $R$</h2><p>Now that we have the theory, we need to know how to construct a sample of results $R$ that is as representative as possible of the multitude of results obtainable from our procedure $F$.</p><p>For that, we have a <strong>perturbation</strong> function, <code>pert</code>, which for a particular float $X$, returns a disturbed float $X&apos;$ such that $X&apos;$ is $X$ for which we modified the last bit of its significand in a random and uniform way. In other words, we add to the last bit of significand $-1$, $0$ or $1$ with a probability of $\frac 1 3$.</p><p>This perturbation consists in choosing randomly among $X^+$ and $X^-$, which we mentioned in the first part, in order to simulate the propagation of rounding errors.</p><p>We use <code>pert</code> whenever an assignment is made, whether it is an initial assignment as a floating variable declaration, or the result of multiple computations.</p><p>We also have a <strong>permutation</strong> operator, <code>perm</code>, which for each assignment operator will randomly modify the term on the right by performing one of the permutations authorized by associativity and distributivity. In other words, it is a question of choosing between $F_1$, $F_2$ or $F_3$ in the example above.</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x2139;&#xFE0F;</div><div class="kg-callout-text"><strong>Remark:</strong><br>In fact, in theory, we could go further by permuting all the independent operations between them, that is to say, by purely and simply reorganizing the algorithm as much as possible.</div></div><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x26A0;&#xFE0F;</div><div class="kg-callout-text"><strong>Attention</strong>:<br>In real life, we are aware of the various pitfalls posed by the stability of numerical computations and how to overcome them, in particular by correctly organizing our calculations (for example, adding numbers in ascending order limits the propagation of errors), or by using error compensation mechanisms (for example <a href="https://en.wikipedia.org/wiki/Kahan_summation_algorithm?ref=endomorphis.me">Kahan summation algorithm</a>). This is also the objective of problem 2. mentioned above. In fact, from the moment we consciously optimize the order of operations, the use of <em>perm</em> becomes unnecessary because it leads to a wrongly widened confidence interval, and therefore an overestimation of the errors (in addition to a significant additional computational cost).</div></div><p>Thus, we will <strong>not</strong> consider permutations in the following.</p><p>From there, there are two ways to use <code>pert</code> to create a sample $R$ and estimate the number of significant digits of a numeric result.</p><h3 id="asynchronous-version">Asynchronous version</h3><p>The asynchronous version consists in performing our perturbations at each assignment, and building our sample $R$ as the result of $N$ calls to the procedure $F$. In other words, the $N$ calls are independent, hence the name asynchronous. Once the sample is at our disposal, we compute the number of significant digits <em>a posteriori</em>.</p><p>Illustration of the asynchronous method with an iterative sequence defined by $X_n = F(X_ {n-1})$ and for initial term $X_0$ with $N = 3$:</p><p>$$<br>\begin{matrix}<br>&amp; \nearrow X^0_1 = \text{pert}(F(X_0)) &amp; \to X^0_2 = \text{pert}(F(X^0_1)) &amp; \to \dots \to &amp; X^0_n = \text{pert}(F(X^0_{n-1})) &amp; \searrow &amp; \\\<br>X_0 &amp; \to X^1_1 = \text{pert}(F(X_0)) &amp;\to X^1_2 = \text{pert}(F(X^1_1)) &amp; \to \dots \to &amp; X^1_n = \text{pert}(F(X^1_{n-1})) &amp; \to &amp; C((X_n^i)) \\\<br>&amp; \searrow X^2_1 = \text{pert}(F(X_0)) &amp; \to X^2_2 = \text{pert}(F(X^2_1)) &amp; \to \dots \to &amp; X^2_n = \text{pert}(F(X^2_{n-1})) &amp; \nearrow &amp; \\\<br>\end{matrix}<br>$$</p><p>Apparently logical, this method comes up against two major problems.</p><ul><li>As the propagation of the errors is not necessarily being done in the same way, it is possible that the executions of the procedure converge towards different real numbers, in which case the sample is inconsistent. This may be the case if the problem to be solved admits of several solutions for example.</li><li>From one execution to another, as there are certainly conditional branches, two results can come from a series of different branches because of rounding errors. Therefore it is not relevant to compare these results.</li></ul><p>For these two reasons, the asynchronous version is generally inapplicable.</p><h3 id="synchronous-version">Synchronous version</h3><p>Conversely, the synchronous version consists in modifying the sample at each assignment operation and using the empirical average as value for the conditional branches. In practice, we can also systematically use $X_i$ for a given $i$, which avoids having to calculate the average each time. It is possible to give an estimate of the number of significant digits at any time because the sample is available at all times during the execution. In fact, this answers the two problems of the asynchronous version:</p><ul><li>At each step, the result is consistent with itself, it cannot be different solutions since there is never only one value which is used for the conditional structures.</li><li>The series of branches will necessarily be unique by construction, which makes the final result consistent.</li></ul><p>Illustration of the synchronous method on the same example as before:</p><p>$$<br>\begin{matrix}<br>&amp; \nearrow X^0_1 = \text{pert}(F(X_0)) &amp; \searrow &amp; &amp; \nearrow X^0_2 = \text{pert}(F({X^1_1})) \searrow &amp; &amp; \nearrow &amp; X^0_n = \text{pert}(F(X^1_{n-1})) &amp; \searrow &amp; \\\<br>X_0 &amp; \to X^1_1 = \text{pert}(F(X_0))&amp; \to &amp; \bar{X_1} &amp;\to X^1_2 = \text{pert}(F(X^1_1)) \to &amp; \dots &amp;\to &amp; X^1_n = \text{pert}(F(X^1_{n-1})) &amp; \to &amp; C((X^i_n))\\\<br>&amp; \searrow X^2_1 = \text{pert}(F(X_0))&amp; \nearrow &amp; &amp; \searrow X^2_2 = \text{pert}(F(X^2_1)) \nearrow &amp; &amp; \searrow &amp; X^2_n = \text{pert}(F(X^2_{n-1})) &amp; \nearrow &amp;\\\<br>\end{matrix}<br>$$</p><p>Notice the synchronization points after each step, hence the method name.</p><h1 id="cestac-on-an-iterative-algorithm">CESTAC on an iterative algorithm</h1><p>Now that we know how to determine the number of significant digits of a numerical result, we will focus on the optimal stopping problem. The exact solution to our problem is noted $x^\star$<em>.</em> We have an iterative algorithm, which gives at iteration $k$, the approximate solution $x_k$, and we know that this algorithm converges after a number of steps potentially infinite, that is to say that $x_k \to x^\star$.</p><p>Finally, we have an implementation of our algorithm which at each iteration provides an approximate solution $X_k$ tainted by numerical errors.</p><p>A classic stop criterion for iterative algorithms at a given precision is the test $|| x_k - x_ {k-1}|| &lt;\epsilon$, where $\epsilon$ controls the precision. A variant is given by $|| x_k - x_ {k-1} || &lt;|| x_k || \epsilon$. This test is extremely robust in usual arithmetic having infinite precision since it makes it possible to detect when an iteration no longer brings any significant gain in precision. Conversely, in floating point arithmetic, since all $X_k$ are tainted with errors, the subtraction of very close terms leads to small values &#x200B;&#x200B;which may not be significant at all.</p><p>The worst possible scenario is the following: $\epsilon$ is chosen too small, and the computational errors that have accumulated are too large compared to $\epsilon$, so the algorithm will never converge, its solution will degrade to either converge towards an inconsistent value, or to diverge outright!</p><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x27A1;&#xFE0F;</div><div class="kg-callout-text"><strong>Definition </strong>(machine zero): <br>A value $X \in \mathcal{F}$, the result of a numerical calculation, with a number $C$ of significant digits, is a **machine zero** if $X = 0$ and $C&gt; 1$ where $X$ is arbitrary but $C = 0$. We denote a machine zero $\bar 0$.</div></div><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x26A0;&#xFE0F;</div><div class="kg-callout-text"><strong>Warning:</strong><br>The notion of <strong>machine zero</strong> should not be confused with the notion of <a href="https://en.wikipedia.org/wiki/Machine_epsilon?ref=endomorphis.me">epsilon machine</a> nor with <a href="https://en.wikipedia.org/wiki/IEEE_754-1985?ref=endomorphis.me#Zero">zero</a> as represented in the IEE754 standard.</div></div><p>As CESTAC purpose is to determine the number of significant digits of a result, we can therefore use it to find the machine zeros and modify our stop test accordingly, which becomes the following one at the iteration $k$:</p><ol><li>If $C(X_k) = 0$ and $X_k \neq 0$, then the result is tainted with an error greater than its own value and there is no point in continuing: we stop the algorithm.</li><li>If $|| X_n - X_{n-1} || = \bar 0$, we stop the algorithm since the difference between two iterations only represents computation errors.</li><li>If the number of iterations exceeds a certain limit $K$, the sequence is considered as non-convergent and the algorithm is stopped.</li></ol><h1 id="going-further-discussions-on-the-validity-of-cestac">Going further: discussions on the validity of CESTAC</h1><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x2139;&#xFE0F;</div><div class="kg-callout-text"><strong>Remark:</strong><br>This section is intended to discuss in a more advanced way the validity hypothesis and can therefore be put aside for a first reading, especially as it can turn out to be a little more technical.</div></div><p>There are several hypotheses which have been formulated in order to arrive at the formula for the number of significant digits and which lead to the following question: can we reasonably use a Student&apos;s test in order to obtain the confidence interval? This is equivalent to wonder whether the estimator $\bar X$ used is biased or not.</p><h2 id="the-estimator-bias">The estimator bias</h2><p>Without making a proper demonstration (we refer the reader to the studies by the creators of the CESTAC method), we give the broad outlines justifying that the mean estimator is unbiased.</p><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x27A1;&#xFE0F;</div><div class="kg-callout-text"><strong>Theorem:</strong><br>A result $X$ of a perturbated procedure $F$ can be written:<br><br>$$X = x + \sum_{i = 1}^n d_i 2^{-t}(\alpha_i - h_i) + O(2^{-2t})$$<br><br>Where $x$ is the exact result, $n$ the total number of assignments and arithmetic operations performed by $F$, $d_i$ quantities depending only on the data and the procedure $F$, $(\alpha_i)_i$ the rounding or truncation errors and $(h_i)_i$ the perturbations performed.</div></div><p>he bias of the estimator $\bar X$ is the quantity $E[\bar X] - x$. Assuming that the $(\alpha_i)_i$ follow a uniform distribution over the &#x201C;proper&#x201D; interval (that depends on whether we are in truncation or rounding mode), it is enough to correctly choose the $(h_i)_i$ to re-center the $(\alpha_i)_i$ and thus obtain the following result, <strong>neglecting higher-order terms</strong>:</p><p>$$X&apos; = x + \sum_{i = 1}^n d_i 2^{-t}(z_i)$$</p><p>Where the $z_i$ are identically distributed and centered variables, so that $E(X&apos;) = x$, i.e. the estimator is unbiased.</p><p>The hypothesis of the distribution of $\alpha_i$ is validated when there are enough operations in the procedure $F$, in other words that $n$ is large enough. In fact, very precisely, the bias is not zero but we can show that it is of the order of a few $\sigma$ which skews the final estimate by less than one significant figure.</p><h2 id="validity-of-the-student-test">Validity of the Student test</h2><p>As we have seen, the hypothesis about the distribution of $\alpha_i$ is satisfied in theory and in practice. But on the other hand, to conclude that the estimator is unbiased, we made an additional assumption: the higher order terms are negligible.</p><p>However, while it is easy to see that addition or subtraction does not create an error of second order, this is not the case for multiplication or division, since by considering $X_1 = x_1 + \epsilon_1$ and $X_2 = x_2 + \epsilon_2$, these operators are written:</p><p>$$X_1X_2 = x_1x_2 + x_1 \epsilon_2 + x_2 \epsilon_1 + \epsilon_1 \epsilon_2 $$</p><p>$$\frac{X_1}{X_2} = \frac{x_1}{x_2} + \frac{\epsilon_2}{x_1} - \frac{x_1 \epsilon_2}{x_2^2} + O(\frac{\epsilon_2}{x_2})$$</p><p>The problem for multiplication is that if the respective errors $\epsilon$ for the two operands are preponderant over the exact values &#x200B;&#x200B;$x$, then the second order term becomes preponderant. For the division, the higher order terms become preponderant if $\epsilon_2$ is preponderant w.r.t. $x_2$.</p><p>Consequently, there are two complementary ways to ensure the hypothesis behind CESTAC are valid:</p><ul><li>Increase the precision of the representation, i.e., encode each real on more bits, which will reduce the $\epsilon$. In other words, the answer to <strong>problem 3</strong>.</li><li>Limit the propagation of calculation errors as much as possible, i.e., apply the recipes in response to <strong>problem 2</strong>.</li></ul><p>One possible systematic approach is to include dynamic control over the outcome of multiplication or division operations, at a significant cost.</p><h1 id="conclusion-cestac-but-for-what-and-for-who">Conclusion: CESTAC, but for what and for who?</h1><p>We have seen the different problems that appear when we perform floating point computations and we have given a robust technique to control the propagation of errors induced by these computations. After having presented the foundations of the method and the modalities of use, we applied CESTAC to the optimal stopping problem of an iterative algorithm. Finally, a last part was devoted to the discussion on the validity of the method and a sketch of proof.</p><p>The only question that has not been addressed, and which will serve as a conclusion, is: when to use CESTAC? It is obvious that the method presents a significant cost in terms of computation time. Therefore, it must be justified by a gain at least as important. The need for evaluation and error control is crucial, for example, for critical systems such as airplanes. For this reason, the method is widely used in the field of aeronautics, to control both simulations but also directly computations within on-board systems.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://endomorphis.me/content/images/2023/09/image-44.png" class="kg-image" alt="On controlling the propagation of numerical errors" loading="lazy" width="577" height="367"><figcaption>The type of critical simulation that might require CESTAC.</figcaption></figure><h1 id="bibliography">Bibliography</h1><ul><li><a href="http://www.editionstechnip.com/fr/catalogue-detail/144/ingenierie-du-controle-de-la-precision-des-calculs-sur-ordinateur.html?ref=endomorphis.me">Ing&#xE9;nierie du contr&#xF4;le de la pr&#xE9;cision des calculs sur ordinateur</a>, Mich&#xE8;le Pichat et Jean Vignes.</li><li><a href="http://www-pequan.lip6.fr/~jmc/polycopies/poly_vln.pdf?ref=endomorphis.me">Validit&#xE9; du logiciel num&#xE9;rique</a>, Jean-Marie Chesnaux, support de cours dispens&#xE9; &#xE0; l&apos;UPMC.</li><li><a href="http://www.techniques-ingenieur.fr/base-documentaire/sciences-fondamentales-th8/methodes-numeriques-42105210/validation-des-resultats-des-logiciels-scientifiques-af1471/approche-stochastique-de-l-analyse-des-erreurs-d-arrondi-methode-cestac-af1471niv10002.html?ref=endomorphis.me">Approche stochastique de l&apos;analyse des erreurs d&apos;arrondi : m&#xE9;thode CESTAC</a>, Jean Vignes et Ren&#xE9; Alt.</li><li><a href="http://eu.wiley.com/WileyCDA/WileyTitle/productCd-0470035544.html?ref=endomorphis.me">Handbook of Granular Computing</a>, Witold Pedrycz, Andrzej Skowron et Vladik Kreinovich.</li></ul><hr><p>I stress that this is the worst case scenario, which is far from being the common practical scenario. However, standard deterministic studies reason mainly about the worst case scenario, which leads to an overestimation of the computation errors, sometimes rendering these methods obsolete. On the contrary, CESTAC makes it possible not to fall into this trap due to the very construction of the method. <a>&#x21A9;&#xFE0E;</a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Installing Ubuntu 22.04 LTS with RAID 1 and LVM]]></title><description><![CDATA[<p>If you have been reading my <a href="https://endomorphis.me/first-look-at-the-tuxedo-infinitybook-pro-16-gen-8/">article on the Tuxedo InfinityBook Pro 16 - Gen 8</a> then you know that I received a laptop with no SSD and therefore, no OS pre-installed. With <strong>2x TB Crucial P3 Plus PCIe 4.0</strong> my goal is to install Ubuntu 22.04 LTS</p>]]></description><link>https://endomorphis.me/installing-ubuntu-23-raid-1-and-lvm/</link><guid isPermaLink="false">650324d32093111b77ba8231</guid><category><![CDATA[Homelab]]></category><dc:creator><![CDATA[Alexandre Quemy]]></dc:creator><pubDate>Sun, 17 Sep 2023 18:17:05 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1549605659-32d82da3a059?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDIzfHxyYWlkJTIwbGludXh8ZW58MHx8fHwxNjk0ODUzOTE1fDA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1549605659-32d82da3a059?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDIzfHxyYWlkJTIwbGludXh8ZW58MHx8fHwxNjk0ODUzOTE1fDA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="Installing Ubuntu 22.04 LTS with RAID 1 and LVM"><p>If you have been reading my <a href="https://endomorphis.me/first-look-at-the-tuxedo-infinitybook-pro-16-gen-8/">article on the Tuxedo InfinityBook Pro 16 - Gen 8</a> then you know that I received a laptop with no SSD and therefore, no OS pre-installed. With <strong>2x TB Crucial P3 Plus PCIe 4.0</strong> my goal is to install Ubuntu 22.04 LTS on LVM on a RAID 1 array. However, as you can imagine, this is not as easy as simply using the graphical installer and that is the reason why I write this guide.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://endomorphis.me/first-look-at-the-tuxedo-infinitybook-pro-16-gen-8/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">A first look at the Tuxedo InfinityBook Pro 16 - Gen8</div><div class="kg-bookmark-description">I was looking at a replacement for my MSI Stealth GS65 that served me well the last 5 years, when I heard, via The Linux Experiment, of Tuxedo, a German company based in Augsburg. They focuse on Linux laptops and in particular, they offer laptops with the Intel Management Engine</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://endomorphis.me/content/images/size/w256h256/format/png/2023/09/logo-no-background.svg" alt="Installing Ubuntu 22.04 LTS with RAID 1 and LVM"><span class="kg-bookmark-author">Endomorphism</span><span class="kg-bookmark-publisher">Alexandre Quemy</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://endomorphis.me/content/images/2023/09/tuxedo.jpg" alt="Installing Ubuntu 22.04 LTS with RAID 1 and LVM"></div></a></figure><p>I will assume that you already have a bootable Ubuntu Live with the latest LTS version. Once booted, you should be left with a choice <code>Install Ubuntu</code> or <code>Try Ubuntu</code></p><ul><li>Select <code>Try Ubuntu</code>.</li><li>Start a terminal by pressing <code>Ctrl-Alt-T</code>. </li></ul><p>First, you should identify the name of your disk using <code>lsblk</code>:</p><pre><code class="language-terminal">AME                    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
...
nvme1n1                 259:0    0   3.6T  0 disk                       
nvme0n1                 259:3    0   3.6T  0 disk  
...</code></pre><p>In my case, the disks are <code>nvme0n1</code> and <code>nvme1n1</code> . You should adjust the commands according to the name of your disks.</p><h3 id="create-partitions-on-the-physical-disks">Create partitions on the physical disks</h3><p>Remove any previous partition schema using the following <strong>destructive</strong> operation:</p><pre><code>sudo sgdisk --zap-all /dev/nvme0n1
sudo sgdisk --zap-all /dev/nvme1n1</code></pre><p>Create two partitions on each drive; one for EFI (type <code>ef00</code>) and one for the RAID device (type <code>fd00</code>).</p><pre><code>sudo sgdisk -n 1:0:+512M -t 1:ef00 -c 1:&quot;EFI System&quot; /dev/nvme0n1
sudo sgdisk -n 2:0:0 -t 2:fd00 -c 2:&quot;Linux RAID&quot; /dev/nvme0n1
sudo sgdisk -n 1:0:+512M -t 1:ef00 -c 1:&quot;EFI System&quot; /dev/nvme1n1
sudo sgdisk -n 2:0:0 -t 2:fd00 -c 2:&quot;Linux RAID&quot; /dev/nvme1n1</code></pre><p>Create a FAT32 system for the EFI partition on the first drive.</p><h3 id="create-the-raid-device">Create the RAID device</h3><p>Ensure that you have internet connection, either wired, or by configuring a wireless connection which can be done using the graphical interface.</p><p>Then install <code>mdadm</code> :</p><pre><code>  sudo apt update -y
  sudo apt install mdadm -y</code></pre><p>Create the RAID array using the<strong> second partition</strong> of each disk:</p><pre><code> sudo mdadm --create /dev/md0 --bitmap=internal --level=1 --raid-disks=2 /dev/nvme0n1p2 /dev/nvme1n1p2</code></pre><p>You can safely ignore the warning about the metadata.</p><h3 id="partition-the-raid-device">Partition the RAID device</h3><p>We now have a RAID device created ( <code>/dev/md0</code> ) that we can partition using <code>sgdisk</code> . Create a single partition with type <code>LVM</code> (code <code>E6D6D379-F507-44C2-A23C-238F2A3DF928</code>):</p><pre><code>  sudo sgdisk --zap-all /dev/md0
  sudo sgdisk -n 1:0:0 -t 1:E6D6D379-F507-44C2-A23C-238F2A3DF928 -c 1:&quot;Linux LVM&quot; /dev/md0</code></pre><h3 id="create-the-lvm-devices">Create the LVM devices</h3><p>Create a physical volume on the first and unique partition of the RAID device:</p><pre><code>sudo pvcreate /dev/md0p1
</code></pre><p>Create a volume group on the physical volume:</p><pre><code>sudo vgcreate vg0 /dev/md0p1</code></pre><p>Create logical volumes (partitions) on the new volume group. For my purpose, I will create an extremely simple layout with a single volume that takes the whole RAID device partition that itself takes the whole disk using <code>100%FREE</code>. </p><pre><code>sudo lvcreate -Z y -L 100%FREE --name root vg0</code></pre><p>If you want multiple logical volumes, for instance, to separate the <code>root</code> from the <code>home</code>, you will have to use something like this:</p><pre><code>sudo lvcreate -Z y -L 100GB --name root vg0
sudo lvcreate -Z y -L 100%FREE --name home vg0</code></pre><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x2705;</div><div class="kg-callout-text">We are now ready to install Ubuntu!</div></div><h3 id="install-ubuntu-2204">Install Ubuntu 22.04</h3><p>Double-click on the <code>Install Ubuntu 22.04 LTS</code> icon on the desktop.</p><p>Follow the instruction according to your needs until the storage configuration step. <br><br>On the <code>Installation type</code> page, select <code>Something else</code>. This will present you with a list of partitions called <code>/dev/mapper/vg0-root</code>, etc.</p><p>Double-click on each partition starting with <code>/dev/mapper/vg0-</code>. Select <code>Use as:</code> <code>Ext4</code>, check the <code>Format the partition</code> box, and choose the appropriate mount point (<code>/</code> for <code>vg0-root</code>, <code>/home</code> for <code>vg0-home</code>, etc.).</p><p>Select the first disk <code>/dev/nvme0n1</code> for the boot loader.</p><p>Press <code>Install Now</code> and continue the installation.</p><p>When the installation is finished, select <code>Continue Testing</code>.</p><div class="kg-card kg-callout-card kg-callout-card-red"><div class="kg-callout-emoji">&#x2757;</div><div class="kg-callout-text">At this stage, do not reboot! The <code>mdadm</code> software to manage the RAID array is present only on the live session. Therefore, if you reboot, the OS will not be able to detect and assemble the array!</div></div><p>If every is correct, by typing <code>lsblk</code> in a terminal, you should see something like:</p><pre><code>NAME               MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
...
nvme1n1                 259:0    0   3.6T  0 disk  
&#x251C;&#x2500;nvme1n1p1             259:1    0   512M  0 part  
&#x2514;&#x2500;nvme1n1p2             259:2    0   3.6T  0 part  
  &#x2514;&#x2500;md0                   9:0    0   3.6T  0 raid1 
    &#x2514;&#x2500;md0p1             259:6    0   3.6T  0 part  
      &#x2514;&#x2500;vg0-workstation 253:0    0   3.6T  0 lvm   /target
                                                   
nvme0n1                 259:3    0   3.6T  0 disk  
&#x251C;&#x2500;nvme0n1p1             259:4    0   512M  0 part
&#x2514;&#x2500;nvme0n1p2             259:5    0   3.6T  0 part  
  &#x2514;&#x2500;md0                   9:0    0   3.6T  0 raid1 
    &#x2514;&#x2500;md0p1             259:6    0   3.6T  0 part  
      &#x2514;&#x2500;vg0-workstation 253:0    0   3.6T  0 lvm   /target
</code></pre><h3 id="installing-mdadm-on-the-system">Installing <code>mdadm</code> on the system</h3><p>To install <code>mdadm</code> , we need to <code>chroot</code> into the system. To do so, we need to mount the partitions and bind the devices.</p><p>The root partition is mount on <code>/target</code>. If you have more than &#xA0;one logical volume, you should mount them. For instance, assuming a separate partition for <code>home</code>:</p><pre><code>sudo mount /dev/mapper/vg0-home /target/home</code></pre><p>Then you can bind some devices</p><pre><code>cd /target
sudo mount --bind /dev dev 
sudo mount --bind /proc proc
sudo mount --bind /sys sys</code></pre><p>Finally, <code>chroot</code> into the system:</p><pre><code class="language-chroot">sudo chroot .</code></pre><p>Help the system to resolve the repositories&apos; DNS:</p><pre><code>echo &quot;nameserver 1.1.1.1&quot; &gt;&gt; /etc/resolv.conf </code></pre><p>We can now install <code>mdadm</code>:</p><pre><code>apt install mdadm -y</code></pre><h3 id="configuring-the-raid-on-the-target-system">Configuring the RAID on the target system</h3><p>We need to check if the array has properly been discovered. Check the file <code>/etc/mdadm/mdadm.conf</code>. It should contain a line near the end similar to</p><pre><code>ARRAY /dev/md0 metadata=1.2 name=ubuntu:0 UUID=e1a1650d:138d43bd:d53e1e18:29aa74ea</code></pre><p>If the line is present, then simply delete <code>name=ubuntu:0</code>.<br>If the line is not present, then you can generate it using the following:</p><pre><code>sudo mdadm -Db /dev/md0</code></pre><p>Check that the output looks like the line above and if so, output it to the end of <code>/etc/mdadm/mdadm.conf</code>:</p><pre><code>sudo mdadm -Db /dev/md0 &gt;&gt; /etc/mdadm/mdadm.conf</code></pre><p>Then, we need to edit the file and remove the <code>name=ubuntu:0</code>.<br>Update the module list the kernel should load at boot.</p><pre><code>echo raid1 &gt;&gt; /etc/modules
</code></pre><p>Update the boot ramdisk:</p><pre><code>update-initramfs -u
</code></pre><p>Finally, exit from <code>chroot</code>:</p><pre><code>exit</code></pre><p>And that&apos;s it! We now have a fresh new installation of Ubuntu with RAID 1 and LVM.<br>While the RAID array is protecting the main partition from a disk failure, the EFI boot partition is not protected via RAID as it resides only on the first partition of the first disk.</p><p>Instead of relying on RAID, we will clone the partition and insert clone into the boot chain. Be certain to copy the first partition of the first disk to the first partition of the secon disk:</p><pre><code>sudo dd if=/dev/nvme0n1p1 of=/dev/nvme1n1p1 bs=4096</code></pre><p>You can check the result with</p><pre><code>sudo blkid /dev/nvme[01]n1p1
</code></pre><p>which should return something like</p><pre><code>/dev/nvme0n1p1: UUID=&quot;F41E-A163&quot; BLOCK_SIZE=&quot;512&quot; TYPE=&quot;vfat&quot; PARTLABEL=&quot;EFI System&quot; PARTUUID=&quot;a10fa1d6-0079-4370-9152-1761b2282c07&quot;
/dev/nvme1n1p1: UUID=&quot;F41E-A163&quot; BLOCK_SIZE=&quot;512&quot; TYPE=&quot;vfat&quot; PARTLABEL=&quot;EFI System&quot; PARTUUID=&quot;ac3839c7-cf53-47c4-a376-905646e0a193&quot;</code></pre><p>Then, to insert the second EFI partition into the boot chain, identify the location of the EFI file with </p><pre><code>sudo efibootmgr -v</code></pre><p>The path is located after the <code>File</code> in the output:</p><pre><code>oot0000* ubuntu        HD(1,GPT,a10fa1d6-0079-4370-9152-1761b2282c07,0x800,0x100000)/File(\EFI\ubuntu\shimx64.efi)</code></pre><p>Insert the EFI file into the first partition of the second disk. Note that the <code>-d</code> (for disk) expect a disk and not directly a partition. The partition is specified using the flag <code>-p</code>:</p><pre><code>sudo efibootmgr -c -d /dev/nvme0n1 -p 1 -L &quot;ubuntu2&quot; -l &apos;\EFI\ubuntu\shimx64.efi&apos;</code></pre><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x2705;</div><div class="kg-callout-text">The system is now ready to use and can be rebooted!&#xA0;</div></div><p>In case the first disk fails, the data it protected by the RAID array, and the system will still boot from the EFI partition of the healthy disk. The RAID array would be in degraded mode.</p><p>In my case, after a reboot, here is the output of <code>lsblk</code>:</p><pre><code>aquemy@ws:~$ lsblk
NAME                    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
nvme0n1                 259:0    0   3.6T  0 disk  
&#x251C;&#x2500;nvme0n1p1             259:2    0   512M  0 part  
&#x2514;&#x2500;nvme0n1p2             259:3    0   3.6T  0 part  
  &#x2514;&#x2500;md0                   9:0    0   3.6T  0 raid1 
    &#x2514;&#x2500;md0p1             259:6    0   3.6T  0 part  
      &#x2514;&#x2500;vg0-workstation 253:0    0   3.6T  0 lvm   /
nvme1n1                 259:1    0   3.6T  0 disk  
&#x251C;&#x2500;nvme1n1p1             259:4    0   512M  0 part  /boot/efi
&#x2514;&#x2500;nvme1n1p2             259:5    0   3.6T  0 part  
  &#x2514;&#x2500;md0                   9:0    0   3.6T  0 raid1 
    &#x2514;&#x2500;md0p1             259:6    0   3.6T  0 part  
      &#x2514;&#x2500;vg0-workstation 253:0    0   3.6T  0 lvm  /
</code></pre><p>The status of the RAID device:</p><pre><code>aquemy@ws:~$ sudo mdadm --detail /dev/md0
/dev/md0:
           Version : 1.2
     Creation Time : Wed Sep 13 17:10:02 2023
        Raid Level : raid1
        Array Size : 3906361152 (3.64 TiB 4.00 TB)
     Used Dev Size : 3906361152 (3.64 TiB 4.00 TB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Sat Sep 16 16:45:40 2023
             State : active 
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : bitmap

              Name : ubuntu:0
              UUID : e1a1650d:138d43bd:d53e1e18:29aa74ea
            Events : 31227

    Number   Major   Minor   RaidDevice State
       0     259        3        0      active sync   /dev/nvme0n1p2
       1     259        5        1      active sync   /dev/nvme1n1p2
</code></pre><p>The status of the LVM physical volume:</p><pre><code>aquemy@ws:~$ sudo pvdisplay 
  --- Physical volume ---
  PV Name               /dev/md0p1
  VG Name               vg0
  PV Size               &lt;3.64 TiB / not usable &lt;4.80 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              953700
  Free PE               0
  Allocated PE          953700
  PV UUID               8ocB3w-R3Dp-76Yr-PE2H-mfC2-D4Wf-cmAG8S
</code></pre><p>And finally, the status of the logical volume:</p><pre><code>aquemy@ws:~$ sudo lvdisplay 
  --- Logical volume ---
  LV Path                /dev/vg0/workstation
  LV Name                workstation
  VG Name                vg0
  LV UUID                kq9vhC-OqZA-QaTv-JkBe-OU1i-PJsA-Sukflj
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2023-09-13 17:22:46 +0200
  LV Status              available
  # open                 1
  LV Size                &lt;3.64 TiB
  Current LE             953700
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0</code></pre>]]></content:encoded></item><item><title><![CDATA[A first look at the Tuxedo InfinityBook Pro 16 - Gen8]]></title><description><![CDATA[<p>I was looking at a replacement for my <strong>MSI Stealth GS65 </strong>that served me well the last 5 years, when I heard, via <a href="https://www.youtube.com/@TheLinuxEXP?ref=endomorphis.me">The Linux Experiment</a>, of <strong>Tuxedo</strong>, a German company based in Augsburg. They focuse on Linux laptops and in particular, they offer laptops with the <a href="https://en.wikipedia.org/wiki/Intel_Management_Engine?ref=endomorphis.me">Intel Management Engine</a></p>]]></description><link>https://endomorphis.me/first-look-at-the-tuxedo-infinitybook-pro-16-gen-8/</link><guid isPermaLink="false">650329a42093111b77ba8238</guid><category><![CDATA[Homelab]]></category><dc:creator><![CDATA[Alexandre Quemy]]></dc:creator><pubDate>Sun, 17 Sep 2023 16:15:00 GMT</pubDate><media:content url="https://endomorphis.me/content/images/2023/09/tuxedo.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://endomorphis.me/content/images/2023/09/tuxedo.jpg" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8"><p>I was looking at a replacement for my <strong>MSI Stealth GS65 </strong>that served me well the last 5 years, when I heard, via <a href="https://www.youtube.com/@TheLinuxEXP?ref=endomorphis.me">The Linux Experiment</a>, of <strong>Tuxedo</strong>, a German company based in Augsburg. They focuse on Linux laptops and in particular, they offer laptops with the <a href="https://en.wikipedia.org/wiki/Intel_Management_Engine?ref=endomorphis.me">Intel Management Engine</a> deactivated! If you are as paranoid as I am, this might sound very tempting. And tempting it was since I finally decided to order the new version of their flagship, namely the <strong>InfinityBook Pro 16 - Gen8</strong>.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.tuxedocomputers.com/en/TUXEDO-InfinityBook-Pro-16-Gen8.tuxedo?ref=endomorphis.me"><div class="kg-bookmark-content"><div class="kg-bookmark-title">InfinityBook Pro 16 - Gen8 - TUXEDO InfinityBook Pro 16 - Gen8 - TUXEDO Computers</div><div class="kg-bookmark-description">TUXEDO InfinityBook Pro 16 - Gen8 - 16-inch 16:10 Omnia display + Intel Core i7-13700H + optional: NVIDIA GeForce RTX 4070 + 80 Wh battery + magnesium chassis + max 64GB RAM + Thunderbolt 4</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.tuxedocomputers.com/store_files/3/themes/tuxedo/apple-touch-icon.png" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8"><span class="kg-bookmark-author">TUXEDO Computers</span><span class="kg-bookmark-publisher">TUXEDO Computers, Germany</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.tuxedocomputers.com/store_files/3/themes/tuxedo/img/tuxedo-logo-klein.svg" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8"></div></a></figure><p>They offer up to a GeForce RTX 4070 in an magnesium casing for a total weight of 1.6kg. The elegant design reminds me of a crossover between a MacBook and a Dell XPS. It is possible to personalize the keyboard layout or the logo on the machine. Beyond the hardware, they offer to pre-configure the OS and eventually a virtual machine. They offer full encryption and propose several distributions, including their own, based on Ubuntu LTS called TuxedoOS.</p><p>As I still need to have a discrete NVidia GPU for work, I went for a GeForce RTX 4060. However, the goal with this laptop is to have enough autonomy to travel with it in a non-stationary setup, yet enough power to work properly. None of the other model would achieve this compromise as far as I understand.</p><p>Here is the full configuration that I ordered:</p><ul><li>NVIDIA GeForce RTX 4060 8GB | Silver casing</li><li>Intel Core i7-13700H</li><li>64 GB (2x 32GB) DDR5 4800MHz Samsung</li><li><strong>without</strong> M.2 SSD</li><li><strong>without</strong> Wifi &amp; Bluetooth</li></ul><p>The reason why I chose without any SSD is because I was able to grab <strong>2x TB Crucial P3 Plus PCIe 4.0</strong> with a significant discount. However, it has to be noted that the price indicated on their website correspond roughly to retailer price which is a good point for the consumer.</p><p>I also decided to order without any Wifi &amp; Bluetooth module because they do not offer Wifi 6E. Therefore, I preferred to ordered such Wifi card separately.</p><p>The downside is that I will not be able to provide a feedback on the services related to the OS installation but I will definitely be providing a feedback on the build and upgrade since I will have to open right way!</p><p>First, the service: I placed the order on a Sunday, on Monday the order was approved and on Friday the laptop was sent. Meanwhile, the order status was updated throughout the different stages of the production. No need to say that for a custom laptop build on order this is <strong>extremely</strong> fast! Note however that as I did not requested the installation of any OS, this might speed-up the order.</p><p>There is nothing special to say about the packaging: it is robust and does the job. Delivered without a scratch.<br></p><h3 id="the-chassis-and-connectivity">The chassis and connectivity</h3><p>There is usually the Tuxedo logo on the top. For mine, I decided to go without any logo. The chassis feels sturdy. The weight is balanced and it is possible to open the laptop with one finger which is a good point of accessibility.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://endomorphis.me/content/images/2023/09/image-32.png" class="kg-image" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8" loading="lazy" width="2000" height="1396" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-32.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-32.png 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/image-32.png 1600w, https://endomorphis.me/content/images/size/w2400/2023/09/image-32.png 2400w" sizes="(min-width: 720px) 720px"><figcaption>Top view: no logo whatsoever, plain magnesium.</figcaption></figure><p>The only noticeable flex on the chassis is on the edge, between the screen and the bottom part. There is roughly half a millimeter such that a pressure on the screen part, right in the middle, will see it bent toward the bottom part. Nothing to worry about, but it is slightly more pronounced than on my MSI for instance.</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-35.png" class="kg-image" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8" loading="lazy" width="2000" height="826" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-35.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-35.png 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/image-35.png 1600w, https://endomorphis.me/content/images/size/w2400/2023/09/image-35.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>The left side is equipped with </p><ul><li>a Kensington Slot,</li><li>a USB-C 3.2 Gen2 that is connected to the NVidia and supports DisplayPort 1.4a and is compatible with G-SYNC. However, it does not support PowerDelivery DC-in such that it is not possible charge the laptop via this port. It supports DC-out up to 15W which is not really fast for modern smartphones, so it is mostly interesting for USB devices that can be powered via USB.</li><li>a USB-A 3.2 Gen1,</li><li>a SD card reader,</li><li>a 2-in-1 audio jack (headphone + mic)</li></ul><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-34.png" class="kg-image" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8" loading="lazy" width="2000" height="747" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-34.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-34.png 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/image-34.png 1600w, https://endomorphis.me/content/images/size/w2400/2023/09/image-34.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>The right side is equipped with </p><ul><li>a Thunderbolt 4 that is connected to the integrated GPU and supports DisplayPort 1.4a and both way PowerDelivery: DC-in up to 100W as per TB4 norm and DC-out up to 15W.</li><li>a USB-A 3.2 Gen1</li><li>a HDMI 2.0b that is connected to the integrated GPU and supports HDCP 2.2.</li><li>a Power plug (DC-In)</li></ul><p>The fact that the TB4 and HDMI ports are connected to the iGPU instead of the dGPU is for me <strong>absolutely optimal</strong> and how it should be on any laptop. Indeed, my laptop is connected to a docking station with two additional screens over Thunderbolt. If the TB4 port was connected to the discrete GPU, it means that I would not be able to disable the discrete GPU while I am docked. However, I don&apos;t use the discrete GPU most of the time, only if I want to play or have to run an experiment to run on GPU. Therefore, having the discrete GPU running all the time would be a complete waste of energy, on top of inducing unnecessary heat. On the contrary, with the current wiring, even if I am docked and connected only to the integrated GPU, I am able to switch on the NVidia whenever I need it. Perfect! </p><p>The bottom part has a large mesh surface for the airflow. Although it is not visible during the usage, I find the screws particularly visible and ugly. Or maybe ugly because very visible? </p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-29.png" class="kg-image" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8" loading="lazy" width="2000" height="1398" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-29.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-29.png 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/image-29.png 1600w, https://endomorphis.me/content/images/size/w2400/2023/09/image-29.png 2400w" sizes="(min-width: 720px) 720px"></figure><p></p><h3 id="keyboard-and-trackpad">Keyboard and trackpad</h3><p>The keyboard is a full sized keyboard with a numpad! I think it is the first time I see a numpad on a laptop. In my case, having a numpad has no utility and makes it looks crowded. It also forces to adjust my right hand position. On the other hand, having the numpad adds some space between <code>del/ins</code> key and the power button which might be a blessing if, like me, you are prone to fat fingers.</p><p>Regarding the keyboard itself, it feels amazing and I immediately adjusted to the keycaps and activation force. I am no expert on keyboards so my words have little interest here, but it is rare that I can adapt that fast to a new keyboard. If I had to compain, I would say that the third function on some of the keys (e.g <code>~</code> or <code>!</code> or <code>@</code>) is printed so small that at first I thought it was a defect on the keycap itself.</p><p>The trackpad is really large and reactive. It feels good although, as for the numpad, I rarely use it and don&apos;t have a serious point of comparison.</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-38.png" class="kg-image" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8" loading="lazy" width="1497" height="1023" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-38.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-38.png 1000w, https://endomorphis.me/content/images/2023/09/image-38.png 1497w" sizes="(min-width: 720px) 720px"></figure><p>The biggest asset of this part of the chassis in my opinion is the <strong>extremely </strong>comfortable texture of the material around the keyboard. It is not slippery and soft as glass but rather a sort of velvet feeling that gives the proper grip while typing and prevent finger prints and sweat. Truly amazing.</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-36.png" class="kg-image" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8" loading="lazy" width="2000" height="1143" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-36.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-36.png 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/image-36.png 1600w, https://endomorphis.me/content/images/size/w2400/2023/09/image-36.png 2400w" sizes="(min-width: 720px) 720px"></figure><p></p><h3 id="opening-and-upgrading">Opening and upgrading</h3><p>Opening the laptop is extremely easy: removing the 9 screws is enough for the lid to come easily without force. One small annoyance is the fact that there are two different screw lengths and as a result, one needs to remember carefully where are the longer ones to avoid any bad surprise when screwing them back. When screws cannot be the same length, the screws and corresponding threaded holes should have a color code somehow.</p><p>After removing the lid, we have a direct access to the motherboard and all components that are replaceable. This is a good thing, in particular in comparison to my MSI Stealth GS65 on which the motherboard is flipped! The build is extremely tight and clean. Note that the two connectors for the antenna have their endings protected in a small plastic tube and are then taped together.</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-28.png" class="kg-image" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8" loading="lazy" width="2000" height="1349" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-28.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-28.png 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/image-28.png 1600w, https://endomorphis.me/content/images/size/w2400/2023/09/image-28.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>The two M.2 slots are positioned on the opposite sides. The left one is positioned vertically and crosses the horizontal plan of the battery. If it was possible to find another position on the motherboard, it would probably free enough space to increase the battery capacity from &#xA0;<strong><strong>80Wh</strong> </strong>to something closer to the <strong>99Wh </strong>limit allowed in an airplane.</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-41.png" class="kg-image" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8" loading="lazy" width="1459" height="1017" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-41.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-41.png 1000w, https://endomorphis.me/content/images/2023/09/image-41.png 1459w" sizes="(min-width: 720px) 720px"></figure><h3 id="weight-and-mobility">Weight and mobility</h3><p>Once everything has been installed, the<strong> Tuxedo InfinityBook Pro 16 - Gen8</strong> weights, as promised, <strong>1.6kg </strong>and <strong>2.1kg</strong> with the entire stock power supply. Note that the power supply is rated <strong>180W </strong>and is compact given the hardware in this laptop.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://endomorphis.me/content/images/2023/09/image-30.png" class="kg-image" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8" loading="lazy" width="2000" height="1125" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-30.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-30.png 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/image-30.png 1600w, https://endomorphis.me/content/images/size/w2400/2023/09/image-30.png 2400w" sizes="(min-width: 720px) 720px"><figcaption>The laptop alone is 1.6kg.</figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://endomorphis.me/content/images/2023/09/image-31.png" class="kg-image" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8" loading="lazy" width="2000" height="1125" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-31.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-31.png 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/image-31.png 1600w, https://endomorphis.me/content/images/size/w2400/2023/09/image-31.png 2400w" sizes="(min-width: 720px) 720px"><figcaption>With the stock power supply unit and cable it reaches 2.1kg.</figcaption></figure><p>To improve the portability even more, I bought a <a href="https://www.anker.com/products/a2148?variant=41974285172886&amp;ref=endomorphis.me">Anker 737 GaNPrime 120W</a> with 140W cable. It is quite pricey, but on the other hand, the weight of the charger with the cable is half of the stock one, i.e. 150g for a total of <strong>1.85kg</strong>. Because a single port can output only 100W, keep in mind that it is not possible to fully use the NVidia GPU or at least, <a href="https://www.tuxedocomputers.com/en/Charging-via-USB-C-power-supply-Power-Delivery-DC-In.tuxedo?ref=endomorphis.me">Tuxedo advises to disable it</a>. </p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-33.png" class="kg-image" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8" loading="lazy" width="2000" height="1125" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-33.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-33.png 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/image-33.png 1600w, https://endomorphis.me/content/images/size/w2400/2023/09/image-33.png 2400w" sizes="(min-width: 720px) 720px"></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://endomorphis.me/content/images/2023/09/image-40.png" class="kg-image" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8" loading="lazy" width="910" height="704" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-40.png 600w, https://endomorphis.me/content/images/2023/09/image-40.png 910w" sizes="(min-width: 720px) 720px"><figcaption>The stock charger is small and relatively light (500g with the cable).</figcaption></figure><h3 id="a-word-on-the-uefi-and-software">A word on the UEFI and software</h3><p>The laptop shipped with a custom BIOS/UEFI with few interesting features:</p><ol><li>The possibility to deactivate Intel ME,</li><li>Wake-on-Lan support</li><li>The possibility to select a performance versus silence profile</li><li>SecureBoot support</li></ol><p>I am not able to give any feedback on TuxedoOS, a distro based on Ubuntu LTS as I installed myself a Ubuntu LTS. However, I&apos;ve been able to install Tuxedo Control Center using their repository and the <code>.deb</code> package. TCC is a neat tool to monitor the hardware and manage the power profile, among other. Even on a vanilla Ubuntu, all the hardware components were properly recognized and manageable with the TCC. I would definitely recommend anyone using a Tuxedo laptop to use the Tuxedo Control Center.</p><p>More on the Tuxedo Control Center here:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.tuxedocomputers.com/en/TUXEDO-Control-Center.tuxedo?ref=endomorphis.me"><div class="kg-bookmark-content"><div class="kg-bookmark-title">TUXEDO Control Center - TUXEDO Computers</div><div class="kg-bookmark-description">TUXEDO Control Center: [txt=product-info-scrolleffects] Your notebook. Your control. Ihr Browser kann dieses Video nicht wiedergeben. TUXEDO Control Center Dashboard All data at a glance Performance profiles for all use cases Create profiles freely&#x2026;</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.tuxedocomputers.com/store_files/3/themes/tuxedo/apple-touch-icon.png" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8"><span class="kg-bookmark-author">TUXEDO Computers</span><span class="kg-bookmark-publisher">TUXEDO Computers, Germany</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.tuxedocomputers.com/store_files/1/images/product_images/extra/tcc_herobanner.jpg" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8"></div></a></figure><p>If you are interested in installing Ubuntu with a RAID 1 and LVM, you might want to have a look at this article:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://endomorphis.me/installing-ubuntu-23-raid-1-and-lvm/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Installing Ubuntu 22.04 LTS with RAID 1 and LVM</div><div class="kg-bookmark-description">If you have been reading my article on the Tuxedo InfinityBook Pro 16 - Gen 8 then you know that I received a laptop with no SSD and therefore, no OS pre-installed. With 2x TB Crucial P3 Plus PCIe 4.0 my goal is to install Ubuntu 22.04 LTS</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://endomorphis.me/content/images/size/w256h256/format/png/2023/09/logo-no-background.svg" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8"><span class="kg-bookmark-author">Endomorphism</span><span class="kg-bookmark-publisher">Alexandre Quemy</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://images.unsplash.com/photo-1549605659-32d82da3a059?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDIzfHxyYWlkJTIwbGludXh8ZW58MHx8fHwxNjk0ODUzOTE1fDA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="A first look at the Tuxedo InfinityBook Pro 16 - Gen8"></div></a></figure><h3 id="conclusion">Conclusion</h3><p>The <strong>Tuxedo InfinityBook Pro 16 - Gen8</strong> is probably the best linux laptop available on the market at the moment I write these lines if you are looking for a good compromise between portability and performances. It has an impressive hardware and the build quality is really high. The customization options are also welcomed if it is something that you are looking for.</p><p>From my point of view, the price point is correct, especially given the size of the company and the quality of the laptop. </p><p>My only complaint would be the battery. I would have prefered a larger battery as the norm allows for <strong>99Wh </strong>in airplanes, but I understand that it is rather hard to fit everything is such a small chassis.</p>]]></content:encoded></item><item><title><![CDATA[A low power homelab server build]]></title><description><![CDATA[<p>For my personal usage, I&apos;ve been looking for a main homelab server with a low power consumption (almost) without any compromise. By main, one should understand where most of the services run, as opposed to a storage dedicated server.</p><p>The build presented in this article is in production</p>]]></description><link>https://endomorphis.me/a-low-power-homelab-server-build/</link><guid isPermaLink="false">64ff08352093111b77ba7fbc</guid><category><![CDATA[Homelab]]></category><dc:creator><![CDATA[Alexandre Quemy]]></dc:creator><pubDate>Sat, 16 Sep 2023 02:02:05 GMT</pubDate><media:content url="https://endomorphis.me/content/images/2023/09/en_129023-vignette-for-a-blog-post-about-building-a_resized.png" medium="image"/><content:encoded><![CDATA[<img src="https://endomorphis.me/content/images/2023/09/en_129023-vignette-for-a-blog-post-about-building-a_resized.png" alt="A low power homelab server build"><p>For my personal usage, I&apos;ve been looking for a main homelab server with a low power consumption (almost) without any compromise. By main, one should understand where most of the services run, as opposed to a storage dedicated server.</p><p>The build presented in this article is in production for around 6 months now and has been drawing an <strong>average 33W</strong> in a 24/7 setup, which, given the specs and the usage, is pretty satisfying. Note that this figure is obtained without any particular tweak (yet) to lower the power consumption and therefore, I am sure it is possible to reach a sub 30W easily, and probably near 20W average.</p><h2 id="requirements">Requirements</h2><p>First, here are my requirements:</p><ol><li>At least one <strong>SFP+</strong> for a <strong>10GbE</strong> connection,</li><li>A rackmount case, preferably <strong>2U</strong>,</li><li>As <strong>silent</strong> as possible because it will be located in my office,</li><li>As <strong>low power</strong> as possible.</li></ol><p>The difficulty with building a low power server is that the information about the idle power consumption or the PSU&apos;s power efficiency are rarely available. In addition, the effective consumption of each component may vary depending on the build, i.e. the other components.</p><p>To select the components, I used the following database with low power builds. The power draw of these builds are measured at the wall and therefore gives a good idea of the entire system draw rather than individual components.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://docs.google.com/spreadsheets/d/1LHvT2fRp7I6Hf18LcSzsNnjp10VI-odvwZpQZKv_NCI/edit?ref=endomorphis.me#gid=0"><div class="kg-bookmark-content"><div class="kg-bookmark-title">-Die sparsamsten Systeme (&lt;30W Idle)-</div><div class="kg-bookmark-description">All Idle Watt,Last Watt,C-State,CPU,Mainboard,Netzteil,GPU,Messger&#xE4;t,HDD / SSD,RAM,Betriebssystem,Maus, Tastatur, Monitor,L&#xFC;fter,User1,5,63,C8,Intel Core i5-9500T,HP 859C&#x200B;,HP 90W PPP012C-S,iGPU,ina219&#x200B;,Kingston A2000 500GB NVME&#x200B;,1 x 8GB F4-2666C19-8GRS DDR4&#x200B;,Fedora 33&#x200B;,Dell Maus, HP Keyboard, D&#x2026;</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://ssl.gstatic.com/docs/spreadsheets/favicon3.ico" alt="A low power homelab server build"><span class="kg-bookmark-author">Google Docs</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://lh3.googleusercontent.com/docs/AOD9vFoOgclj89a8jLYAInpUrLXW52MLdhD546H_mZ9fcLOM2xX81KuNML96LMj5SiWV0E5Qpd0cCs5KcXKACuL6iGbQMH_QJS9Ck9c4YYmXOxJI=w1200-h630-p" alt="A low power homelab server build"></div></a></figure><h2 id="components">Components</h2><p>The CPU I selected is the <strong><a href="https://www.intel.com/content/www/us/en/products/sku/201894/intel-core-i310105-processor-6m-cache-up-to-4-40-ghz/specifications.html?ref=endomorphis.me">Intel Core i3-10105</a> </strong>because the benchmark for its non-graphic version provides an average power consumption of <strong>8.60W </strong>which represents a good comprise performance/power. The database above even reports a build at <strong>5.4W</strong> in C8 state!</p><div class="kg-card kg-callout-card kg-callout-card-red"><div class="kg-callout-emoji">&#x2757;</div><div class="kg-callout-text">Be certain to buy the <strong>i3-10105</strong> and not the <strong>i3-10105F</strong> variant that does not have integrated GPU. If in theory it is possible to deal with a CPU without integrated graphics and have a slightly lower power consumption, in practice is it annoying and the gain is neglectable from my experience.</div></div><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.hwcooling.net/wp-content/uploads/2023/03/intel-core-i5-13400f-b0-g29.html?ref=endomorphis.me"><div class="kg-bookmark-content"><div class="kg-bookmark-title">CPU avg. power consumption [W] in idle &#x2013; lower is better</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.hwcooling.net/favicon.ico" alt="A low power homelab server build"></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.hwcooling.net/grafy_3/framework/img/framework/graph/wattermark.png" alt="A low power homelab server build"></div></a></figure><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-20.png" class="kg-image" alt="A low power homelab server build" loading="lazy" width="500" height="500"></figure><p>The motherboard I selected is the <strong><a href="https://www.asrock.com/mb/Intel/H510M-HVS%20R2.0/index.asp?ref=endomorphis.me">ASRock H510M-HVS R2.0</a></strong>. The main reason is because it has 2x PCIe 3.0 slots (one full size x16, and one x1) and 4 SATA ports. The PCIe 3.0 x16 will be used for the network card while the additional x1 could be use for future upgrade (e.g. cold storage with a SATA controller card).</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-9.png" class="kg-image" alt="A low power homelab server build" loading="lazy" width="1076" height="930" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-9.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-9.png 1000w, https://endomorphis.me/content/images/2023/09/image-9.png 1076w" sizes="(min-width: 720px) 720px"></figure><p>In terms of storage, the purpose of this build is to be a service node rather than a storage node. For this reason, I decided to use 3 SSD with a relatively small capacity: one for for the installation of the hypervisor, and two additional in RAID 1 for the containers and VMs. I had a spare (very old) 128GB SSD that I used as boot device and two <strong>Western Digital Red SA500 500Gb</strong>. Without this spare SSD, I would probably go for a third WD SA500 500Gb for practicity. Of course, if you don&apos;t plan to use another node for storage or don&apos;t have a NAS, you might want to take larger SSDs.</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-22.png" class="kg-image" alt="A low power homelab server build" loading="lazy" width="271" height="186"></figure><p>As network card, I selected the <a href="https://www.trendnet.com/products/10g-sfp-pcie-adapter/10-gigabit-pcie-sfp-network-adapter-TEG-10GECSFP-v2?ref=endomorphis.me"><strong>TEG-10GECSFP (Version v2.0R)</strong></a><strong> </strong>because it has the lowest maximal power consumption that I could find at <strong>1.5W</strong>. I have no way to check this assertion accurately, however, given the fact that it is based on Aquantia NIC, my assumption is that <strong>1.5W </strong>can be true only with a Directly Attached Cable (DAC) and not a Fiber Transceiver.</p><div class="kg-card kg-callout-card kg-callout-card-red"><div class="kg-callout-emoji">&#x2757;</div><div class="kg-callout-text">It is important to use the <strong>v2.0R</strong> as the previous version uses more energy.</div></div><p>In case you are not interested in a 10GbE connection, you might still want to a NIC in the PCIe x16 slot, either to have a 2.5GbE which is now pretty common or some additional ethernet ports.</p><p>Depending on how many ports has the NIC, you could turn the server into a switch or at least have a dedicated management network. </p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-7.png" class="kg-image" alt="A low power homelab server build" loading="lazy" width="1020" height="570" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-7.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-7.png 1000w, https://endomorphis.me/content/images/2023/09/image-7.png 1020w" sizes="(min-width: 720px) 720px"></figure><p>The case I selected is the <strong><a href="https://www.silverstonetek.com/en/product/info/server-nas/RM23-502-MINI/?ref=endomorphis.me">SilverStone SST-RM23-502-MINI</a> </strong>which offers several interesting features:</p><ol><li>several PSU compatibilities, so depending on your budget and needs, you can go from a standard ATX to a 2U redundant.</li><li>two 5.25&quot; bays to expand the server in the future, for instance with a SATA case.</li><li>a 40cm short depth compared to standard rack.</li></ol><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-18.png" class="kg-image" alt="A low power homelab server build" loading="lazy" width="1000" height="413" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-18.png 600w, https://endomorphis.me/content/images/2023/09/image-18.png 1000w" sizes="(min-width: 720px) 720px"></figure><p>The 2U rackmount case is the biggest constraint because it implies a low-profile CPU fan. For the CPU fan my choice goes to the <strong><a href="https://www.alpenfoehn.de/en/products/cpu-cooler/black-ridge-en?ref=endomorphis.me">Alpenfohn Black Ridge Low Profile</a> </strong>because the reviews seem to agree on the fact that it provides the lowest temperature among the most popular low-profile CPU coolers in early 2023.<br>However, there a two important things to notice with this CPU fan:</p><ol><li>the stock fan should be reversed as it blows in the wrong direction for most efficient setting. Contrarily to the reviews I read all over the internet, the stock fan of the Black Ridge is extremely silent such that I did not have to exchange it.</li><li>because of the dimensions, only Very Low Profile (VLP) RAM can be used and a fan above will not fit due to the case height.</li></ol><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-24.png" class="kg-image" alt="A low power homelab server build" loading="lazy" width="583" height="306"></figure><p>In fact, the constraint of the VLP drastically restrict the landascape of compatible RAM sticks. I went for 2x32GB of <a href="https://www.corsair.com/us/en/p/memory/cmk64gx4m2a2666c16/vengeancea-lpx-64gb-2-x-32gb-ddr4-dram-2666mhz-c16-memory-kit-black-cmk64gx4m2a2666c16?ref=endomorphis.me"><strong>Corsair Vengeance LPX (CMK64GX4M2A2666C16)</strong></a><strong> </strong>which have the following timings: 16-18-18-35 (CL-tRCD-tRP-tRAS).</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-12.png" class="kg-image" alt="A low power homelab server build" loading="lazy" width="699" height="424" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-12.png 600w, https://endomorphis.me/content/images/2023/09/image-12.png 699w"></figure><p>In terms of additional fans, as the case supports 2 standards 80mm x 25mm fans, I went for the classic and silent <strong><a href="https://noctua.at/en/nf-a8-pwm?ref=endomorphis.me">Noctua NF-A8 PWM</a>.</strong></p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-13.png" class="kg-image" alt="A low power homelab server build" loading="lazy" width="300" height="297"></figure><p>Now that we have all our components, we can select the PSU accordingly the the peak power consumption. Because we want a server as silent as possible, a natural choice is a PicoPSU. With only 3 SSD, this build can use a <strong><a href="https://www.mini-box.com/picoPSU-90?ref=endomorphis.me">90W PicoPSU</a></strong>. However, if you plan to use a SATA cage with the remaining PCIe slot, I recommend to use a <a href="https://www.mini-box.com/picoPSU-160-XT?ref=endomorphis.me"><strong>160W PicoPSU</strong></a>.</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text">For a clean look, if you are going to use a PicoPSU, you might want to order a <a href="https://www.mini-box.com/s.nl/it.A/id.438/.f?ref=endomorphis.me">PCI power bracket</a> as the power supply will not be external and connected via barrel jack.</div></div><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-14.png" class="kg-image" alt="A low power homelab server build" loading="lazy" width="350" height="312"></figure><p>The PicoPSU needs to be coupled with a power supply. For this build, I recommend a <a href="https://www.leicke.eu/en/products/NT33402?ref=endomorphis.me"><strong>Leicke</strong></a><strong> </strong>but the choice is rather wide and the important thing is to check the power to match the PicoPSU.</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-17.png" class="kg-image" alt="A low power homelab server build" loading="lazy" width="1000" height="391" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-17.png 600w, https://endomorphis.me/content/images/2023/09/image-17.png 1000w" sizes="(min-width: 720px) 720px"></figure><p>To be practical, note that the case supports only one 2.5&quot; SSD and therefore, using a SSD mounting frame that can be mounted in a 5.25&quot; bay such as the <a href="https://en.sharkoon.com/product/Bay5?ref=endomorphis.me"><strong>Sharkoon BayExtension</strong></a>.</p><h2 id="summary-and-cost">Summary and cost</h2><p>Here is a summary of the components with the approximate price as of September 2023. The final build is around <strong>850&#x20AC;</strong>, accounting for delivery costs and additional costs such as thermal paste, etc. </p><!--kg-card-begin: markdown--><table>
<thead>
<tr>
<th></th>
<th>Model</th>
<th>Quantity</th>
<th>Price</th>
<th>Total Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Motherboard</td>
<td>ASRock H510M-HVS R2.0</td>
<td>1</td>
<td></td>
<td>60&#x20AC;</td>
</tr>
<tr>
<td>CPU</td>
<td>Intel Core i3-10105</td>
<td>1</td>
<td></td>
<td>100&#x20AC;</td>
</tr>
<tr>
<td>Storage</td>
<td>Western Digital Red SA500 500Gb</td>
<td>3</td>
<td>30&#x20AC;</td>
<td>90&#x20AC;</td>
</tr>
<tr>
<td>Case</td>
<td>SilverStone SST-RM23-502-MINI</td>
<td>1</td>
<td></td>
<td>194&#x20AC;</td>
</tr>
<tr>
<td>RAM</td>
<td>Corsair Vengeance LPX (CMK64GX4M2A2666C16)</td>
<td>1</td>
<td></td>
<td>124&#x20AC;</td>
</tr>
<tr>
<td>10GbE NIC</td>
<td>TEG-10GECSFP (Version v2.0R)</td>
<td>1</td>
<td></td>
<td>111&#x20AC;</td>
</tr>
<tr>
<td>CPU Cooler</td>
<td>Alpenfohn Black Ridge Low Profile</td>
<td>1</td>
<td></td>
<td>45&#x20AC;</td>
</tr>
<tr>
<td>PicoPSU</td>
<td>90W PicoPSU</td>
<td>1</td>
<td></td>
<td>32&#x20AC;</td>
</tr>
<tr>
<td>Power Supply</td>
<td>Leicke Power Supply</td>
<td>1</td>
<td></td>
<td>30&#x20AC;</td>
</tr>
<tr>
<td>Fans</td>
<td>Noctua NF-A8 PWM</td>
<td>2</td>
<td>20</td>
<td>40&#x20AC;</td>
</tr>
<tr>
<td>SSD Mounting Frame</td>
<td>Sharkoon BayExtension</td>
<td>1</td>
<td></td>
<td>6&#x20AC;</td>
</tr>
<tr>
<td><strong>Total</strong></td>
<td></td>
<td></td>
<td></td>
<td><strong>832&#x20AC;</strong></td>
</tr>
</tbody>
</table>
<!--kg-card-end: markdown--><h2 id="the-build-in-practice">The build in practice</h2><p>The build is pretty simple to setup. The fact that we use a PicoPSU and microATX leaves a lot of space in the case for a good airflow. In particular, I appreciate this case because the additional fans are not obstructed by anything and the storage is really separated from the motherboard.</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/server1_cropped.jpg" class="kg-image" alt="A low power homelab server build" loading="lazy" width="2000" height="1397" srcset="https://endomorphis.me/content/images/size/w600/2023/09/server1_cropped.jpg 600w, https://endomorphis.me/content/images/size/w1000/2023/09/server1_cropped.jpg 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/server1_cropped.jpg 1600w, https://endomorphis.me/content/images/size/w2400/2023/09/server1_cropped.jpg 2400w" sizes="(min-width: 720px) 720px"></figure><p>As I did not think about ordering a PCI power bracket with a barrel jack, I used some cable management clips. For an easier maintenance, I use a different color of SATA cable for the storage drives (black) and the OS drive (red). Ideally, a sticker with a proper number would be better, but with only 3 drives, the risk of confusion is low.</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/server2.jpg" class="kg-image" alt="A low power homelab server build" loading="lazy" width="2000" height="1125" srcset="https://endomorphis.me/content/images/size/w600/2023/09/server2.jpg 600w, https://endomorphis.me/content/images/size/w1000/2023/09/server2.jpg 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/server2.jpg 1600w, https://endomorphis.me/content/images/size/w2400/2023/09/server2.jpg 2400w" sizes="(min-width: 720px) 720px"></figure><p>I installed the server into the 9U rack that is directly inserted in the desk of my office. The server has its independent socket with a smart plug for power consumption measurement. The 1GbE RJ45 is used for for the management network while the 10GbE SFP+ is used for everything else. Unfortunately, I could not use a DAC since the server is roughly 15 linear meters from the router which is the limit before signal degradation. </p><p>I have no tool to measure the noise but I am extremely impressed by how silent it is. Basically, the laptop on which I work on a daily basis is louder. The server is right next to me the whole day, every single day, and yet, I have never heard it. This is even surprising because many people recommend to avoid 2U for silent builds. My assumption is that the key is the PicoPSU for two reasons:</p><ol><li>it takes little space which leaves a huge opening behind the case such that the airflow is really maximized,</li><li>the PicoPSU itself does not make any noise and does not heat up which in return lower the need for the fans to spin as fast as they might need to in a build with an ATX PSU.</li></ol><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/server3_cropped.jpg" class="kg-image" alt="A low power homelab server build" loading="lazy" width="2000" height="2042" srcset="https://endomorphis.me/content/images/size/w600/2023/09/server3_cropped.jpg 600w, https://endomorphis.me/content/images/size/w1000/2023/09/server3_cropped.jpg 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/server3_cropped.jpg 1600w, https://endomorphis.me/content/images/2023/09/server3_cropped.jpg 2221w" sizes="(min-width: 720px) 720px"></figure><p>Finally, here is a summary of the sensors from the smart plug that I use to measure the power consumption. It is not as rigorous as a <em><a href="https://en.wikipedia.org/wiki/Kill_A_Watt?ref=endomorphis.me">Kill A Watt</a></em> but it already give a good idea. The active power oscillates between <strong>26W</strong> and <strong>35W</strong> depending on the load.</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-21.png" class="kg-image" alt="A low power homelab server build" loading="lazy" width="333" height="366"></figure><p>The server is running on <strong>Proxmox</strong> and as shown on the screenshot below, it runs many services for such a low energy consumption and noise.</p><figure class="kg-card kg-image-card"><img src="https://endomorphis.me/content/images/2023/09/image-23.png" class="kg-image" alt="A low power homelab server build" loading="lazy" width="1459" height="800" srcset="https://endomorphis.me/content/images/size/w600/2023/09/image-23.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/image-23.png 1000w, https://endomorphis.me/content/images/2023/09/image-23.png 1459w" sizes="(min-width: 720px) 720px"></figure><p>In conclusion, I am extremely satisfied with this build. It is not as low power as some of the ones in the spreadsheet attached at the beginning of the article, but it offers (relatively) modern hardware with a ton of capabilities, both for playing around and productionizing. In comparison to this database, I am using an active SFP+ connection which add some watts which is the price to pay for a 10GbE connection. <br>Despite being actively cooled, it is as silent as most passive builds which is a big plus for many homelabers, including me! </p><p>In summary, I could not recommend enough this build, although the pricepoint might be a bit high for some people. However, the case and the 10GbE NIC account for about 37% of the total cost, so if you don&apos;t need a 10GbE and can find an alternative case - maybe not even rack-mounted -, it might be possible to squeeze the budget to a mere 600&#x20AC;. In my opinion, both options are a bang for the buck!</p>]]></content:encoded></item><item><title><![CDATA[Why should you have a Homelab in 2023?]]></title><description><![CDATA[From privacy to machine learning and home automation, we explore few reasons why one should invest in a homelab in 2023.]]></description><link>https://endomorphis.me/why-should-you-have-a-homelab-in-2023/</link><guid isPermaLink="false">64fdf1d72093111b77ba7f8a</guid><category><![CDATA[Homelab]]></category><dc:creator><![CDATA[Alexandre Quemy]]></dc:creator><pubDate>Sun, 10 Sep 2023 16:44:24 GMT</pubDate><media:content url="https://endomorphis.me/content/images/2023/09/record_262566_2.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h2 id="what-is-a-homelab-and-why-you-should-have-one">What is a Homelab and why you should have one?</h2>
<img src="https://endomorphis.me/content/images/2023/09/record_262566_2.png" alt="Why should you have a Homelab in 2023?"><p>Technically, a homelab is a <em>lab</em> at <em>home</em>, or, in other words, a domestic infrastructure used for experimentation and learning. The difficulty to truly define what a homelab is comes from the fact that there are as many homelabs as homelabers, to serve as many purposes as one can imagine:</p>
<ol>
<li>experimenting with networking or system administration</li>
<li>leveraging storage solutions to replace Google Drive, Box or the infamous <em>copy on this external hard drive once in a while</em></li>
<li>replacing popular cloud tools and app with self-hosted alternatives</li>
<li>serving music, movies and other multimedia content to an entire home</li>
<li>automating home with a focus on privacy</li>
<li>learning professional skills using a pseudo-corporate environment</li>
<li>...</li>
</ol>
<p>In general, all these use cases share a couple of common goals: <strong>privacy</strong> and <strong>control</strong>. The privacy and control come from the fact that everything<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup> in your  homelab runs on hardware that is physically located on your premises and for which you have a full access. In addition, the softwares that homelabs run are usually Free and Open-Source Softwares (FOSS) which remains the best guarantee when it comes to data collection and usage - and thus, privacy.</p>
<p>So in fact, a homelab does not have to be some expensive and highly specialized hardware, mounted in dozen of rack units, consumming hundreds of kilowatts per hour. A homelab can be as simple as a Raspberry Pi, or maybe an old re-purposed laptop, or a newly bought mini-PC that will be stand next to the TV and serves as a Home Theater PC (HTPC), or maybe all of these working together to offer different type of services!</p>
<h2 id="what-does-it-take-to-start">What does it take to start?</h2>
<p><strong>Define your goals and expected maturity.</strong></p>
<p>The most important at first is to set up goals to achieve in terms of functionalities to offer to the users and level of maturity.<br>
By maturity, I mean the stability and reliability of the service: can the service breaks every now and then for an obscure reason or does the service need to be available 100% of the time to actually be <em>worth it</em>?</p>
<p>In my case, my homelab hosts several critical services:</p>
<ul>
<li>the entire home automation, which includes turning off and on the lights, fans, most home appliances but also the heating system,</li>
<li>my company data and multiple services to help me with daily job.</li>
</ul>
<p>These services need to be as reliable as any commercial offering.</p>
<p>On the other end of the spectrum, I run several services related to MLOps or experimenting with Large Language Models (LLMs) that could break in 15 minutes without any particular impact on anyone&apos;s life. This is just my playground!</p>
<p>Finally, some services are in between, such as the media players: no one will die from not being able to play a movie tonight, but it is still nice to have!</p>
<p><strong>Build incrementally or per sub-function.</strong></p>
<p>Of course, no one has to know perfectly all the different functionalities at first. A homelab can and, maybe even, should be built incrementally with the needs. Actually, it is very likely that one will start with a development environment, to learn, experiment and break, before migrating progressively towards a more stable and production-ready environment. There is not a single path to a homelab. One might even argue that a homelab is the path, <em>literally</em>.</p>
<p>You have an old laptop? Use it as a server for anything. Your services are stable enough and your users want more stability? Upgrade to a better hardware, maybe with uninterruptible power supply (UPC).</p>
<p>You have an old Rapberry Pi? Use it for Home Assistant and a couple of other services like a DNS server. You start to feel the hardware limitation with all your automations and devices in place? Scale to a mini PC.</p>
<p>Another strategy that might be more costly as an initial investment is to plan per sub-function rather than adding hardware from here and there. I personally identify three large sub-functions for any homelab:</p>
<ol>
<li>network: what sort of network infrastrure do you need?</li>
<li>storage: how much and what sort of storage do you need? what is your backup and redundancy strategy?</li>
<li>compute: how much compute power do you need to run your services and applications?</li>
</ol>
<p>Because the network is transversal, I would suggest to pay a particular attention to this sub-function at first. Changing a backbone infrastructure can become costly, especially if it implies to re-wire an entire house! On the other hand, for most people, a gigabyte or 2.5Gb internet might be more than enough and the focus should be on the actually router and switches.</p>
<hr class="footnotes-sep">
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item"><p>There are some exceptions, such as as off-site storage for a proper data backup strategy for instance. <a href="#fnref1" class="footnote-backref">&#x21A9;&#xFE0E;</a></p>
</li>
</ol>
</section>
<!--kg-card-end: markdown--><p></p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://endomorphis.me/content/images/2023/09/homelab_network.png" class="kg-image" alt="Why should you have a Homelab in 2023?" loading="lazy" width="2000" height="1686" srcset="https://endomorphis.me/content/images/size/w600/2023/09/homelab_network.png 600w, https://endomorphis.me/content/images/size/w1000/2023/09/homelab_network.png 1000w, https://endomorphis.me/content/images/size/w1600/2023/09/homelab_network.png 1600w, https://endomorphis.me/content/images/size/w2400/2023/09/homelab_network.png 2400w" sizes="(min-width: 720px) 720px"><figcaption>An example of a homelab in a 9U rack containing networking elements (router, switches, patch panels and access points), home automation platform on a Raspberry Pi and a server dedicated to storage.</figcaption></figure><h2 id="the-cost-of-a-homelab-hardware-energy-and-time">The cost of a homelab: hardware, energy and time</h2><p>The last question to answer is <em>how much does it cost to have a homelab?</em>. Again, this may vary from homelaber to homelaber because some would throw an unreasonable amount of money in what is their main hobby, while some are on a tight budget and do not want to spend more than they would on a commercial alternative.</p><p>There are several aspects to take into account:</p><ul><li>the initial investment</li><li>the running cost, both in terms of time and electricity</li></ul><p>It is easy to estimate the initial investment cost prior spending anything. On the other hand, estimating the running cost might be slightly more difficult as the overall price will depends on the consumption under idle and load, the usage schedule and the price of electricity where the homelab resides. In addition, the load curve of power supplies at low load - which is the main regime for a homelab - are almost never communicated by the manufacturers. In fact, the efficiency certifications focuses on high load and might be misleading for a homelaber. Chosing the right hardware to keep a balance between the compute power and low consumption is a topic by itself which unfortunately is one of the first to face when building a homelab.</p><p>I would also recommend to compute the cost marginally per service. For instance, Google Drive and Box Personal Pro are respectively 25 EUR/year and 108 EUR/year where I am located. Because I need beyond the capability of the free offer, I would anyway pay for one of these services. Since I am using my own service hosted in my homelab, I can say that I marginally save 25 to 108 EUR/year. This single service allows me to justify the energy consumption of my homelab. With a cost of 13.97 cents per kWh at the moment I write this, and about 40W for my storage node, the total annual cost of this particular service is roughly 45 EUR - privacy incuded -.</p><p>In the end, once combined and compared to the commercial alternatives, the cost of running a homelab can be vastly compensated by the marginal savings.</p><p>Finally, a factor that is vastly overlooked is <em>time</em>. How much time do I need to build and maintain a homelab? Regardless of how much you plan to be involved, the answer is: more than that. Running experimental services to learn by breaking things will obviously lead to spending a lot time fix things. Conversely, reaching a maturity level close to a commercial offering for critical services will require a tremendous amount of time ahead. Even with a homelab designed and implemented near professionally, issues will arise and when they come, it means solving them. This can sometimes be daunting or frustrating, especially when the something is critical like turning on the heater, and was working perfectly 10min ago.</p><h2 id="get-a-homelab">Get a homelab!</h2><p>Homelabs are great in the end. They can be simple or complex depending on your needs. There are always things to learn on the way, whether we build a service with high availability for professional purposes or a small experiment with old hardware.</p><p>Even with a high cost of electricity, they can help to save money on the long run when they are used to replace commercial applications. Otherwise, like any hobby, they require a variable investment in cash and time!</p>]]></content:encoded></item></channel></rss>