## A new computer for me this time.

November 5, 2020 Incoherent ramblings , , , , , , , , , ,

It’s been a long long time, since I bought myself a computer.  My old laptop is a DELL XPS, was purchased around 2009:

Since purchasing the XPS lapcrusher, I think that I’ve bought my wife and all the kids a couple machines each, but I’ve always had a work computer that was new enough that I was able to let my personal machine slide.

### Old system specs

Specs on the old lapcrusher:

• 19″ screen
• stands over 2″ tall at the back
• Intel Core I3, 64-bit, 4 cores
• 6G Ram
• 500G hard drive, no SSD.

My current work machine is a 4yr old mac (16Mb RAM) and works great, especially since I mainly use it for email and as a dumb terminal to access my Linux NUC consoles using ssh.  I have some personal software on the mac that I’d like to uninstall, leaving the work machine for work, and the other for play (Mathematica, LaTex, Julia, …).

I’ll still install the vpn software for work on the new personal machine so that I can use it as a back up system just in case.  Last time I needed a backup system (when the mac was in the shop for battery replacement), I used my wife’s computer.  Since Sofia is now mostly working from home (soon to be always working from home), that wouldn’t be an option. Here’s the new system:

### New system specs

This splurge is a pretty nicely configured, not top of the line, but it should do nicely for quite a while:

• Display: 15.6″ Full HD IPS | 144HZ | 16:9 | Operating System: Win 10
• Processor: Intel Core i7-9750H Processor (6 core)
• RAM Memory: XPG 32GB 2666MHz DDR4 SO-DIMM (64GB Max)
• Storage: XPG SX8200 1TB NVMe SSD
• Graphics: NVIDIA GeForce GTX 1660Ti 6GB
• USB3.2 Gen 2 x 1 | USB3.2 Gen 2 x 2 | Thunderbolt 3.0 x 1 (REAR)| HDMI x 1 (REAR)
• 4.08lbs

The new machine has a smaller screen size than my old laptop, but the 19″ screen on the old machine was really too big, and with modern screens going so close to the edge, this new one is pretty nice (and has much higher resolution.)  If I want a bigger screen, then I’ll hook it up to an external monitor.

It doesn’t seem that long ago when I’d just started porting DB2 LUW to 64bit, and most of the “big iron” machines that we got for the testing work barely had more than 4G of ram each.  The Solaris kernel guys we worked with at the time told me about the NUMA contortions that they had to use to build machines with large amounts of RAM, because they couldn’t get it close enough together because of heat dissipation issues.  Now you can get a personal machine for 1800 CAD with 32G of ram, and 6G of video ram to boot, all tossed into a tiny little form factor! This new machine, not even counting the video ram, has 524288x the memory of my first computer, my old lowly C64 (I’m not counting the little Radio Shack computer that was really my first, as I don’t know how much memory it had — although I am sure it was a whole lot less than 64K.) ### C64 Nostalgia. Incidentally, does anybody else still have their 6402 assembly programming references? I’ve kept mine all these years, moving them around house to house, and taking a peek in them every few years, but I really ought to toss them! I’m sure I couldn’t even give them away. Remember the zero page addressing of the C64? It was faster to access because it only needed single byte addressing, whereas memory in any other “page” (256 bytes) required two whole bytes to address. That was actually a system where little-endian addressing made a whole lot of sense. If you wanted to change assembler code that did zero page access to “high memory”, then you just added the second byte of additional addressing and could leave your page layout as is. ### Windows vs. MacOS It’s been 4 years since I’ve actively used a Windows machine, and will have to relearn enough to get comfortable with it again (after suffering with the transition to MacOS and finally getting comfortable with it). However, there are some new developments that I’m gung-ho to try, in particular, the new: With WSL, I wonder if cygwin is even still a must have? With windows terminal, I’m guessing that putty is a thing of the past (good riddance to cmd, that piece of crap.) ## Condensed matter physics notes February 16, 2019 math and physics play , , , Here’s an update of my old Condensed Matter Physics notes. Condensed Matter Along with a link to the notes, are instructions on building the PDF from the latex and the github clone commands required to make a copy of those sources. Mathematica notebooks are also available for some of the calculations and plots. ## classical optics notes. February 15, 2019 math and physics play , , , Here’s an update of my old classical optics notes. Along with a link to the notes, are instructions on building the PDF from the latex and the github clone commands required to make a copy of those sources. Mathematica notebooks are also available for some of the calculations and plots. Looks like most of the figures were hand drawn, but that was the only practical option, as this class was very visual. ## Electric field of a spherical shell. Ka-Tex rendered [Take II]. January 14, 2018 math and physics play , , , , , , In a previous post I attempted to use the katex plugin to render an old post instead of using Mathjax. It seems that was not actually rendered with KaTex, but (I think) it was rendered with the latex keyword handling in the Jetpack plugin, which I also had installed. I’ve customized the katex plugin I have installed to use a different keyword (katex instead of latex). This is a test of KaTex, the latex rendering engine used for Khan academy. They advertise themselves as much faster than mathjax, but this speed comes with some usability issues. Here’s a rerendering of an old post, with the latex rendered with WP-KaTeX instead of MathJax-LaTeX. # The post ### Problem: Calculate the field due to a spherical shell. The field is [katex display=”true”]\mathbf{E} = \frac{\sigma}{4 \pi \epsilon_0} \int \frac{(\mathbf{r} – \mathbf{r}’)}{{{\left\lvert{{\mathbf{r} – \mathbf{r}’}}\right\rvert}}^3} da’,[/katex] where [katex]\mathbf{r}'[/katex] is the position to the area element on the shell. For the test position, let [katex]\mathbf{r} = z \mathbf{e}_3[/katex]. ### Solution: We need to parameterize the area integral. A complex-number like geometric algebra representation works nicely. [katex display=”true”]\begin{aligned}\mathbf{r}’ &= R \left( \sin\theta \cos\phi, \sin\theta \sin\phi, \cos\theta \right) \\ &= R \left( \mathbf{e}_1 \sin\theta \left( \cos\phi + \mathbf{e}_1 \mathbf{e}_2 \sin\phi \right) + \mathbf{e}_3 \cos\theta \right) \\ &= R \left( \mathbf{e}_1 \sin\theta e^{i\phi} + \mathbf{e}_3 \cos\theta \right).\end{aligned}[/katex] Here [katex]i = \mathbf{e}_1 \mathbf{e}_2[/katex] has been used to represent to horizontal rotation plane. The difference in position between the test vector and area-element is [katex display=”true”]\mathbf{r} – \mathbf{r}’ = \mathbf{e}_3 {\left({ z – R \cos\theta }\right)} – R \mathbf{e}_1 \sin\theta e^{i \phi},[/katex] with an absolute squared length of [katex display=”true”]\begin{aligned}{{\left\lvert{{\mathbf{r} – \mathbf{r}’ }}\right\rvert}}^2 &= {\left({ z – R \cos\theta }\right)}^2 + R^2 \sin^2\theta \\ &= z^2 + R^2 – 2 z R \cos\theta.\end{aligned}[/katex] As a side note, this is a kind of fun way to prove the old “cosine-law” identity. With that done, the field integral can now be expressed explicitly [katex display=”true”]\begin{aligned} \mathbf{E} &= \frac{\sigma}{4 \pi \epsilon_0} \int_{\phi = 0}^{2\pi} \int_{\theta = 0}^\pi R^2 \sin\theta d\theta d\phi \frac{\mathbf{e}_3 {\left({ z – R \cos\theta }\right)} – R \mathbf{e}_1 \sin\theta e^{i \phi}} { {\left({z^2 + R^2 – 2 z R \cos\theta}\right)}^{3/2} } \\ &= \frac{2 \pi R^2 \sigma \mathbf{e}_3}{4 \pi \epsilon_0} \int_{\theta = 0}^\pi \sin\theta d\theta \frac{z – R \cos\theta} { {\left({z^2 + R^2 – 2 z R \cos\theta}\right)}^{3/2} } \\ &= \frac{2 \pi R^2 \sigma \mathbf{e}_3}{4 \pi \epsilon_0} \int_{\theta = 0}^\pi \sin\theta d\theta \frac{ R( z/R – \cos\theta) } { (R^2)^{3/2} {\left({ (z/R)^2 + 1 – 2 (z/R) \cos\theta}\right)}^{3/2} } \\ &= \frac{\sigma \mathbf{e}_3}{2 \epsilon_0} \int_{u = -1}^{1} du \frac{ z/R – u} { {\left({1 + (z/R)^2 – 2 (z/R) u}\right)}^{3/2} }. \end{aligned}[/katex] Observe that all the azimuthal contributions get killed. We expect that due to the symmetry of the problem. We are left with an integral that submits to Mathematica, but doesn’t look fun to attempt manually. Specifically [katex display=”true”]\int_{-1}^1 \frac{a-u}{{\left({1 + a^2 – 2 a u}\right)}^{3/2}} du = \frac{2}{a^2},[/katex] if [katex]a > 1[/katex], and zero otherwise, so [katex display=”true”]\boxed{ \mathbf{E} = \frac{\sigma (R/z)^2 \mathbf{e}_3}{\epsilon_0} }[/katex] for [katex]z > R[/katex], and zero otherwise. In the problem, it is pointed out to be careful of the sign when evaluating [katex]\sqrt{ R^2 + z^2 – 2 R z }[/katex], however, I don’t see where that is even useful? # KaTex commentary 1. Conditional patterns, such as: \left\{ \begin{array}{l l} \frac{\sigma (R/z)^2 \mathbf{e}_3}{\epsilon_0} & \quad \mbox{if z > R $} \\ 0 & \quad \mbox{if$ z < R $} \end{array} \right.  messed up KaTex, resulting in render errors like: Using $$...$$ within math mode instead of$ ... $also messed things up. Example: \left\{ \begin{array}{l l} \frac{\sigma (R/z)^2 \mathbf{e}_3}{\epsilon_0} & \quad \mbox{if$ z > R $} \\ 0 & \quad \mbox{if$ z < R \$ }
\end{array}
\right.


This resulted in a messed up parse like so:

It looks like it's the mbox that messes things up, and not the array itself, so \text could probably be used instead.

2. The latex has to be all in one line, or else KaTex renders the newlines explicitly. Example:

Having to condense all my latex onto a single line is one of the reasons I switched from the default wordpress latex engine to mathjax. It was annoying enough that I started paying for my wordpress hosting, and stopped posting on my old free peeterjoot.wordpress.com blog. Using KaTex and having to go back to single line latex would suck!

3. The rendering looks great, just like mathjax.
4. The Mathjax-Latex wordpress plugin has some support for equation labeling and references. I don't see a way to do those with the WP-KaTex plugin.
5. I can have a large set of macros installed in my default.js matching a subset of what I have in my .sty files. I don't see a way to do that with the WP-KaTex plugin, but perhaps there is just no documented mechanism. KaTex itself does have a macro mechanism.
6. The display isn't left justified like the wordpress latex, and looks decent.

## Electric field of a spherical shell. Ka-Tex rendered

January 10, 2018 math and physics play , , , , , ,

This is a test of KaTex, the latex rendering engine used for Khan academy. They advertise themselves as much faster than mathjax, but it looks like the reason for that is because they generate images that look crappy unless the browser resolution is matched to the images just right.

Here’s a rerendering of an old post, with the latex rendered with WP-KaTeX instead of MathJax-LaTeX.

# The post

### Problem:

Calculate the field due to a spherical shell. The field is

$\mathbf{E} = \frac{\sigma}{4 \pi \epsilon_0} \int \frac{(\mathbf{r} - \mathbf{r}')}{{{\left\lvert{{\mathbf{r} - \mathbf{r}'}}\right\rvert}}^3} da',$

where $\mathbf{r}'$ is the position to the area element on the shell. For the test position, let $\mathbf{r} = z \mathbf{e}_3$.

### Solution:

We need to parameterize the area integral. A complex-number like geometric algebra representation works nicely.

\begin{aligned}\mathbf{r}' &= R \left( \sin\theta \cos\phi, \sin\theta \sin\phi, \cos\theta \right) \\ &= R \left( \mathbf{e}_1 \sin\theta \left( \cos\phi + \mathbf{e}_1 \mathbf{e}_2 \sin\phi \right) + \mathbf{e}_3 \cos\theta \right) \\ &= R \left( \mathbf{e}_1 \sin\theta e^{i\phi} + \mathbf{e}_3 \cos\theta \right).\end{aligned}

Here $i = \mathbf{e}_1 \mathbf{e}_2$ has been used to represent to horizontal rotation plane.

The difference in position between the test vector and area-element is

$\mathbf{r} - \mathbf{r}' = \mathbf{e}_3 {\left({ z - R \cos\theta }\right)} - R \mathbf{e}_1 \sin\theta e^{i \phi},$

with an absolute squared length of

\begin{aligned}{{\left\lvert{{\mathbf{r} - \mathbf{r}' }}\right\rvert}}^2 &= {\left({ z - R \cos\theta }\right)}^2 + R^2 \sin^2\theta \\ &= z^2 + R^2 - 2 z R \cos\theta.\end{aligned}

As a side note, this is a kind of fun way to prove the old “cosine-law” identity. With that done, the field integral can now be expressed explicitly

\begin{aligned} \mathbf{E} &= \frac{\sigma}{4 \pi \epsilon_0} \int_{\phi = 0}^{2\pi} \int_{\theta = 0}^\pi R^2 \sin\theta d\theta d\phi \frac{\mathbf{e}_3 {\left({ z - R \cos\theta }\right)} - R \mathbf{e}_1 \sin\theta e^{i \phi}} { {\left({z^2 + R^2 - 2 z R \cos\theta}\right)}^{3/2} } \\ &= \frac{2 \pi R^2 \sigma \mathbf{e}_3}{4 \pi \epsilon_0} \int_{\theta = 0}^\pi \sin\theta d\theta \frac{z - R \cos\theta} { {\left({z^2 + R^2 - 2 z R \cos\theta}\right)}^{3/2} } \\ &= \frac{2 \pi R^2 \sigma \mathbf{e}_3}{4 \pi \epsilon_0} \int_{\theta = 0}^\pi \sin\theta d\theta \frac{ R( z/R - \cos\theta) } { (R^2)^{3/2} {\left({ (z/R)^2 + 1 - 2 (z/R) \cos\theta}\right)}^{3/2} } \\ &= \frac{\sigma \mathbf{e}_3}{2 \epsilon_0} \int_{u = -1}^{1} du \frac{ z/R - u} { {\left({1 + (z/R)^2 - 2 (z/R) u}\right)}^{3/2} }. \end{aligned}

Observe that all the azimuthal contributions get killed. We expect that due to the symmetry of the problem. We are left with an integral that submits to Mathematica, but doesn’t look fun to attempt manually. Specifically

$\int_{-1}^1 \frac{a-u}{{\left({1 + a^2 - 2 a u}\right)}^{3/2}} du = \frac{2}{a^2},$

if $a > 1$, and zero otherwise, so

$\boxed{ \mathbf{E} = \frac{\sigma (R/z)^2 \mathbf{e}_3}{\epsilon_0} }$

for $z > R$, and zero otherwise.

In the problem, it is pointed out to be careful of the sign when evaluating $\sqrt{ R^2 + z^2 - 2 R z }$, however, I don’t see where that is even useful?

# KaTex commentary

1. Conditional patterns, such as:

\left\{
\begin{array}{l l}
\frac{\sigma (R/z)^2 \mathbf{e}_3}{\epsilon_0}
& \quad \mbox{if $$z > R$$ } \\
0 & \quad \mbox{if $$z < R$$ }
\end{array}
\right.


messed up KaTex, resulting in render errors like:

2. The latex has to be all in one line, or else KaTex renders the newlines explicitly. Example:
Having to condense all my latex onto a single line is one of the reasons I switched from the default wordpress latex engine to mathjax. It was annoying enough that I started paying for my wordpress hosting, and stopped posting on my old free peeterjoot.wordpress.com blog. Using KaTex and having to go back to single line latex would suck!
3. The rendering looks like crap, unless you match your resolution to exactly those used to create the images. The mathjax rendering may be slower, but looks much better!
4. The Mathjax-Latex wordpress plugin has some support for equation labeling and references. I don’t see a way to do those with the WP-KaTex plugin.
5. I can have a large set of macros installed in my default.js matching a subset of what I have in my .sty files. I don’t see a way to do that with the WP-KaTex plugin, but perhaps there is just no documented mechanism. KaTex itself does have a macro mechanism.
6. Left justified display mode is hard to read. The mathjax rendered centered display mode looks much better.

## EDIT.

I’m not sure I was getting the katex plugin when I used the [ latex ] … [ /latex ] tags.  I see some comments that indicate that there is built in handling of these tags in the Jetpack plugin.  If I change frontend.php in the katex plugin to use [ katex ] … [ /katex ] tags instead, then I see much different results.