Latest post

Nov 19, 2024, 17:57:17

The <input type="number"> is so evil. I thought that entering 1e309 will have its value return 1e309 and that converting it to a number will give me infinity. Nope, it will return an empty string, and converting it to a number gets me zero. Note that 1e309 IS A VALID FLOATING-POINT NUMBER according to the #HTML standard.

#web #webdev #javascript #coding

follow me on Mastodon

Articles

  • Kinetic energy, momentum, and angular momentum of rigid bodies

    In this article, we will find that the inertia matrix naturally appears when we calculate the kinetic energy TT or the angular momentum M\mathbf M of a rigid body. Then, we introduce the concept of principal inertia Jpri\mathbf J_{\mathrm{pri}}. We also study how the inertia matrix changes under translations and rotations and how those transformations may lead to conclusions that can help us simplify the calculation of inertia matrices.

  • Hölder means inequality

    The Hölder mean of x\vec x with weights w\vec w and a parameter pp is defined as Mp,w ⁣(x)(wxp)1pM_{p,\vec w}\!\left(\vec x\right)\coloneqq\left(\vec w\cdot\vec x^p\right)^{\frac 1p}, and the value at p=,0,+p=-\infty,0,+\infty are defined by the limits. We can prove using Jensen’s inquality that the Hölder mean increases as pp increases. This property can be used to prove HM-GM-AM-QM inequalities.

  • A polynomial whose sum of coefficients is a factorial

    The function (1z)n+1k=1knzk\left(1-z\right)^{n+1}\sum_{k=1}^\infty k^nz^k is a polynomial of degree nn w.r.t. zz, and the sum of its coefficients is n!n!. This turns out to be properties of Eulerian numbers.

  • The image of a circular object through a thin lens

    The image of a circle with radius rr and centered at C(2f,0)C\left(-2f,0\right) through a thin lens at x=0x=0 with focal length ff and centered at O(0,0)O\left(0,0\right) is a conic section with the focus being (2f,0)\left(2f,0\right), the directrix being line x=fx=f, and the eccentricity being rf\frac rf.

  • The point on the circle farthest to two lines

    Suppose PP is a point on the circle C\odot C. When is the sum of distances from PP to two edges of O\angle O extremal? It turns out to be related to angle bisectors (the intersections of C\odot C and the bisector of O\angle O or its adjacent supplementary angle are extremals), while the edge cases (at the intersections of C\odot C and edges of O\angle O) are a little tricky: we need to use the bisectors to divide the plane into four quadrants, pick the two quadrants where the line intersecting C\odot C at PP lies, translate the region to make it center at CC, and see whether PP is inside the translated region.

  • Typesetting math in emails

    After some comparison among solutions, I use KaTeX to typeset math in my emails.

  • Mapping from Kepler problem to free particle on 3-sphere

    There is a canonical transform of the Kepler problem which is the same as the problem of motion of a free particle on 3-sphere. The explicit formula of the transform as well as some links about this topic is written in the article. The explicit formula for E<0E<0 is up2p02p2+p02n^+2p0p2+p02p,\mathbf u\coloneqq\frac{p^2-p_0^2}{p^2+p_0^2}\hat{\mathbf n}+\frac{2p_0}{p^2+p_0^2}\mathbf p, where u\mathbf u is the position of the particle on 3-sphere (a 4-dimensional vector), p\mathbf p is the momentum of the original particle in Kepler problem, n^\hat{\mathbf n} is a vector perpendicular to the 3-dimensional hyperplane where p\mathbf p lies, and p02mEp_0\coloneqq\sqrt{-2mE}.

  • Solving linear homogeneous ODE with constant coefficients

    By using power series, we can prove that the problem of solving linear homogeneous ODE with constant coefficients can be reduced to the problem of solving a polynomial with those coefficients. This article illustrates this point in detail, but it uses a very awful notation…

  • Thoughts on a middle school thermal physics problem

    To heat an object with hot water, if we divide the water into more parts and use each part to heat the object one after another, the final temperature will be higher. If the number of parts tends to infinity, then the final temperature will tend to the limit T+eCC0(T0T)T+\mathrm e^{-\frac C{C_0}}\left(T_0-T\right), where TT is the initial temperature of the object, T0T_0 is the temperature of the hot water, CC is the heat capacity of the object, and C0C_0 is the heat capacity of the hot water.

  • I created a community rhythm game called Dododo

    I have created a community rhythm game called Dododo. It is a rhythm game with musical rhythm notations.

subscribe via RSS