Sekai 🌐 πŸ—Ί

Sekai (δΈ–η•Œ) is the kanji for “the world”. That’s a great word because of the scale that it designates.

Conditional Batch File Editing

Adopted Mmark for Math Posts

Problem During the adoption of Mmark for math posts on this blog, I had to insert markup: mmark at the last line of front matter of the source file of each math post. Seek help I separated this into two SO questions Sed conditional match and execute command with offset, and A question about AWK multiple line recognition. Solution From #1., I learnt the use of variables in AWK scripts. From #2, some users explained how these variables can be used for multi-line regex search. [Read More]
awk  sed  Mmark 

My Intended Trigo Answer

The Math.SE question $2\cos(2x) - 2\sin(x) = 0$ has attracted several answers from high-rep users.

I am expanding @rhombic’s comment into an answer.

$$ \begin{aligned} 2\cos(2x)-2\sin(x)&=0 \\ 2 - 4\sin^2(x)-2\sin(x)&=0 \\ 2\sin^2(x)+\sin(x) - 1&=0 \\ (2 \sin(x) - 1)(\sin(x) +1) &= 0 \\ \sin(x) = \frac12 \text{ or } \sin(x) &= -1 \\ x = \frac{\pi}{6}, \frac{5\pi}{6} \text{ (rejected) or } & \frac{3\pi}{2} \text{ (rejected)} \end{aligned} $$

Improved Integration of Hugo and $\KaTeX$

Problem There’s no custom $\KaTeX$ macro in local preview since I’ve merged some recent commits from the upstream of this blog’s theme, in particular, Beautiful Hugo’s pull requests #246 and #255, which allowed self-hosting the theme’s static JS, CSS and font files. This self-hosted option is particularly useful in case of slow response from Cloudflare’s CDN. Even they do appear on the public GitLab site, the final rendered Markdown + $\TeX$ code would be succumb to syntax errors due to their absence in the preview process. [Read More]
KaTeX  Mmark  Hugo 

JavaScript Copy Button

Goal To create a copy button for my Math.SE comment template in order to save the trouble of copying and pasting. My first attempt I put the boilerplate inside a Markdown codeblock to prevent them from getting interpreted by Hugo’s Markdown parser. Under each codeblock, I placed the copy button. Comment boilerplate goes here ... πŸ“ Another comment boilerplate goes here ... πŸ“ … My page’s original layout $(document).ready(function() { $('. [Read More]

My Dual Answer

Update: The question has been reopened. I intended to answer κΉ€μ’…ν˜„’s problem on Math.SE. However, the programs in the question body aren’t typeset in MathJax. As a result, I downvoted and closed this question because found it unclear. From the proposed dual, it seems that I shouldn’t interpret the primal as a linear program. Anyways, without further clarifications from OP, I found no reason to look at this further. Here’s my intended answer: [Read More]

Finite Population Sampling without Replacement

Personal note of finite population sampling

First moment Population: $ \Omega = \{ x_1, \dots, x_N \} $ Collection of $n$-samples: $\mathcal{S} = \{ s \in \Omega^n \mid \forall i,j \in s, i \ne j \} $ Collection of $n$-samples containing $x$: $ \mathcal{S}_x = \{ s \in \mathcal{S} \mid x \in s \} $ Observe that $ |\mathcal{S}_x| = \binom{N-1}{n-1} $. Let population mean be zero. $\mu = 0$, i.e. $ \sum_{i = 1}^N x_i = 0 $ [Read More]

Replacing Deprecated Hugo Syntax in Blog Theme

Fixing Beautiful Hugo issue #261

Problem Since the recent Hugo upgrade to v0.55.3, the following messages popped up after each local site regeneration with hugo server. WARN 2019/04/24 18:07:00 Page's .URL is deprecated and will be removed in a futu re release. Use .Permalink or .RelPermalink. If what you want is the front matte r URL value, use .Params.url. WARN 2019/04/24 18:07:00 Page's .Hugo is deprecated and will be removed in a fut ure release. Use the global hugo function. [Read More]

Julia Rcall Installation

Rcall.jl build failure due to missing dependencies

Problem During the installation of RCall.jl, the package wasn’t successfully built due to a missing variable $R_HOME. $ julia -q julia> Pkg.add("RCall") Resolving package versions... Installed WinReg ─ v0.3.1 Installed RCall ── v0.13.2 Updating `~/.julia/environments/v1.0/Project.toml` [6f49c342] + RCall v0.13.2 Updating `~/.julia/environments/v1.0/Manifest.toml` [6f49c342] + RCall v0.13.2 [1b915085] + WinReg v0.3.1 Building RCall β†’ `~/.julia/packages/RCall/ffM0W/deps/build.log` β”Œ Error: Error building `RCall`: β”‚ ERROR: LoadError: R_HOME is not a directory. β”‚ Stacktrace: β”‚ [1] error(::String) at . [Read More]
Julia  RCall  R 

Xubuntu Screen Enlargement

Tonight, the screen of Xubuntu suddenly enlarged and blurred. Typing “xubuntu screen display enlarged” on Google, I’ve learnt that the <Alt> key and the mouse scroll wheel can enlarge/minify screen display from Ubuntu Forums.

Linux