February 7, 2018 Boycott UPS No comments customs brokerage, customs clearing, GST, UPS

My letter to my MP. I didn’t vote for him, but he is still technically my representative.

Dear Honorable member of parliament Bob Saroya,

I don’t usually have any faith that my elected representative has any chance of actually acting favourably on my behalf, but I will temporarily play optimistic.

Are you familiar with the customs brokerage scam that UPS and some of the other shipping companies are running on Canadians? DHL and Canada Post also play this game, but not with the same zeal and shear exploitation of UPS.

The basic idea behind this scam is that UPS has figured out how to collect from both the shipper and the receiver. They collect once explicitly from the shipper in the USA, who may even think that they have paid all the required fees to ship the package, and then they collect again from the receiver by claiming that they have provided a “customs clearing service”.

Here’s an example of the fees that they try to impose to give the Canadian taxman their cut:

UPS has imposed a $61.95 fee to collect this $1.97 for the Canadian government. They bill this extortion as a “service”, so the taxman gets an additional $8.05. Sweet deal for UPS and the taxman, but not for your constituents.

Is it legal for UPS to levy an effective fee of $70 to collect $2 for the government? Are their any federal government regulatory agencies that Canadians can complain to for charges like this? I’m used to being screwed by the Canadian revenue service, but I imagine even those cold hearted bastards would find this objectionable.

Sincerely,

Peeter Joot

[full address and postal code]

February 7, 2018 Boycott UPS 5 comments B15 clearing form, CBSA, customs broker, customs clearing, self clearing, UPS

I’ve been screwed by Canadian customs clearing fees three times in the past, once by Canada post (~$16 dollars), once by DHL (~$12), and the worst by UPS (~$30). This time UPS has the gall to try to charge me $71.97 to handle a $2 taxman collection.

This package is a set of Christmas gifts from my mom for the kids and us. They’ve been on the road in their 5th wheel for months, and is finally home long enough to send off all the Christmas presents she’d purchased earlier in the year. Mom is honest and itemized the actual values of the items in the package, and this was enough that Canada customs wants to charge me $1.97 to receive it. I’m used to being screwed by the taxman, and would have been willing to pay this to accept the package. Mom says she paid around $50 USD to ship it in the first place, and thinks that she’ll be charged a second time if I sent it back.

Extortion is clearly a justifiable label for the $61.95 fee that UPS is imposing to collect this $1.97 for the Canadian taxman. My GOD! $61.95 to handle a $2 fee! Because the UPS extortion is classified as a “service”, observe that the taxman gets an additional $8.05. Sweet deal for UPS and the taxman, but not for me (or grandma if I don’t accept the package). The UPS goons are waiting for their $71.97, or else they are going to come break some kneecaps (i.e. charge grandma a second time to return the package and deprive her grandkids of their late Christmas present.)

The basic idea behind this scam is that UPS and some of the other companies handling US -> Canadian shipping have figured out how to collect from both the shipper and the receiver. They collect once explicitly from the shipper in the USA, who may even think that they have paid all the required fees to ship the package, and then they collect again from the receiver by claiming that they have provided a “customs clearing service”.

The extent of their service is that they can handle a COD fee for the Canadian government, and keep your package as ransom unless you pay that fee. The actual tax fee that they are collecting is usually peanuts, but they add in their brokerage fee, which is orders of magnitude larger than the small tax imposed. To add insult to injury, they charge you tax (GST) for the extortion “service” they are providing. That GST is also orders of magnitude worse than the tax that was collected on behalf of the Canadian government. It’s win-win for the government, since they get much more than they would have collected originally (in this case $10 instead of $2), and it is certainly win-win for the shipping company, since they get to charge 2x the fees without scaring away the shipper with a higher sticker price. The second time is pure profit, since they don’t have to actually do anything for it.

In the past I had a couple people point me to articles on how to do your own customs clearing. The CBSA website is complete crap, and it’s hard to find out the details for the nearest office. If I look for the Markham area, it looks like there may be an office at the Buttonville airport, but it isn’t obvious that this is open for the public to do clearing services (i.e. it’s not listed as an “inland office” — “A CBSA office classified as a non-direct point of entry providing a full range of CBSA services to the general public”), nor what their hours are, nor is there a phone number to call them to ask. When I called the CBSA 1800 number during business hours, I got no answer. Finding the closest CBSA clearing office is no easier now than a couple years ago.

Whenever shipping from the US is mentioned in conversation, I make a point to tell everybody never to use UPS. Every Canadian should insist that all their US friends and relatives boycott UPS. As I’m a geek, most of my online purchases are esoteric math and physics, or programming books. I now generally only buy from Canada, India or China. The primary reason that I do this is to ensure that UPS never gets any of my business from a shipper that I cannot control. Mom’s now also been asked to never ever ever use UPS again, and I hope that she spreads the word. If they gouge enough customers eventually they should loose them all.

As for this package. I’ve not paid to be screwed this time, and am going to try the self-clearing paperwork myself. I’ll try driving to the Buttonville airport tomorrow and ask in person if they can handle the self-clearing request, or if not where I should go.

If anybody has had some personal experience doing self-clearing paperwork in the GTA area, I’d like to know what office you went to obtain your B15 clearing document.

EDIT: I’m told that there’s a CBSA office open to the public at Pearson Airport Cargo 3:

2720 Brittania Rd E.

Google says that the round trip cost is 2.5 hrs in driving time to avoid the $72 fee.

January 28, 2018 math and physics play No comments complex exponential, cross product, dot product, Geometric Algebra, line intersection, linear solution, linear system, vector product, wedge product

Here’s three more fairly short Geometric Algebra related tutorials that I’ve posted on youtube

January 14, 2018 math and physics play No comments KaTex, latex, MathJax, mathjax-latex, wordpress, wordpress plugin, WP-KaTex

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.

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.

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?

- 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.

- 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!

- The rendering looks great, just like mathjax.
- 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.
- 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.
- The display isn't left justified like the wordpress latex, and looks decent.

January 14, 2018 math and physics play No comments boost, Dirac basis, Geometric Algebra, involution, lightlike, Lorentz transformation, multivector, paravector, Pauli basis, rotation, spacelike, STA, timelike

[Click here for a PDF of this post with nicer formatting]

The notation I prefer for relativistic geometric algebra uses Hestenes’ space time algebra (STA) [2], where the basis is a four dimensional space \( \setlr{ \gamma_\mu } \), subject to Dirac matrix like relations \( \gamma_\mu \cdot \gamma_\nu = \eta_{\mu \nu} \).

In this formalism a four vector is just the sum of the products of coordinates and basis vectors, for example, using summation convention

\begin{equation}\label{eqn:boostToParavector:160}

x = x^\mu \gamma_\mu.

\end{equation}

The invariant for a four-vector in STA is just the square of that vector

\begin{equation}\label{eqn:boostToParavector:180}

\begin{aligned}

x^2

&= (x^\mu \gamma_\mu) \cdot (x^\nu \gamma_\nu) \\

&= \sum_\mu (x^\mu)^2 (\gamma_\mu)^2 \\

&= (x^0)^2 – \sum_{k = 1}^3 (x^k)^2 \\

&= (ct)^2 – \Bx^2.

\end{aligned}

\end{equation}

Recall that a four-vector is time-like if this squared-length is positive, spacelike if negative, and light-like when zero.

Time-like projections are possible by dotting with the “lab-frame” time like basis vector \( \gamma_0 \)

\begin{equation}\label{eqn:boostToParavector:200}

ct = x \cdot \gamma_0 = x^0,

\end{equation}

and space-like projections are wedges with the same

\begin{equation}\label{eqn:boostToParavector:220}

\Bx = x \cdot \gamma_0 = x^k \sigma_k,

\end{equation}

where sums over Latin indexes \( k \in \setlr{1,2,3} \) are implied, and where the elements \( \sigma_k \)

\begin{equation}\label{eqn:boostToParavector:80}

\sigma_k = \gamma_k \gamma_0.

\end{equation}

which are bivectors in STA, can be viewed as an Euclidean vector basis \( \setlr{ \sigma_k } \).

Rotations in STA involve exponentials of space like bivectors \( \theta = a_{ij} \gamma_i \wedge \gamma_j \)

\begin{equation}\label{eqn:boostToParavector:240}

x’ = e^{ \theta/2 } x e^{ -\theta/2 }.

\end{equation}

Boosts, on the other hand, have exactly the same form, but the exponentials are with respect to space-time bivectors arguments, such as \( \theta = a \wedge \gamma_0 \), where \( a \) is any four-vector.

Observe that both boosts and rotations necessarily conserve the space-time length of a four vector (or any multivector with a scalar square).

\begin{equation}\label{eqn:boostToParavector:260}

\begin{aligned}

\lr{x’}^2

&=

\lr{ e^{ \theta/2 } x e^{ -\theta/2 } } \lr{ e^{ \theta/2 } x e^{ -\theta/2 } } \\

&=

e^{ \theta/2 } x \lr{ e^{ -\theta/2 } e^{ \theta/2 } } x e^{ -\theta/2 } \\

&=

e^{ \theta/2 } x^2 e^{ -\theta/2 } \\

&=

x^2 e^{ \theta/2 } e^{ -\theta/2 } \\

&=

x^2.

\end{aligned}

\end{equation}

Paravectors, as used by Baylis [1], represent four-vectors using a Euclidean multivector basis \( \setlr{ \Be_\mu } \), where \( \Be_0 = 1 \). The conversion between STA and paravector notation requires only multiplication with the timelike basis vector for the lab frame \( \gamma_0 \)

\begin{equation}\label{eqn:boostToParavector:40}

\begin{aligned}

X

&= x \gamma_0 \\

&= \lr{ x^0 \gamma_0 + x^k \gamma_k } \gamma_0 \\

&= x^0 + x^k \gamma_k \gamma_0 \\

&= x^0 + \Bx \\

&= c t + \Bx,

\end{aligned}

\end{equation}

We need a different structure for the invariant length in paravector form. That invariant length is

\begin{equation}\label{eqn:boostToParavector:280}

\begin{aligned}

x^2

&=

\lr{ \lr{ ct + \Bx } \gamma_0 }

\lr{ \lr{ ct + \Bx } \gamma_0 } \\

&=

\lr{ \lr{ ct + \Bx } \gamma_0 }

\lr{ \gamma_0 \lr{ ct – \Bx } } \\

&=

\lr{ ct + \Bx }

\lr{ ct – \Bx }.

\end{aligned}

\end{equation}

Baylis introduces an involution operator \( \overline{{M}} \) which toggles the sign of any vector or bivector grades of a multivector. For example, if \( M = a + \Ba + I \Bb + I c \), where \( a,c \in \mathbb{R} \) and \( \Ba, \Bb \in \mathbb{R}^3 \) is a multivector with all grades \( 0,1,2,3 \), then the involution of \( M \) is

\begin{equation}\label{eqn:boostToParavector:300}

\overline{{M}} = a – \Ba – I \Bb + I c.

\end{equation}

Utilizing this operator, the invariant length for a paravector \( X \) is \( X \overline{{X}} \).

Let’s consider how boosts and rotations can be expressed in the paravector form. The half angle operator for a boost along the spacelike \( \Bv = v \vcap \) direction has the form

\begin{equation}\label{eqn:boostToParavector:120}

L = e^{ -\vcap \phi/2 },

\end{equation}

\begin{equation}\label{eqn:boostToParavector:140}

\begin{aligned}

X’

&=

c t’ + \Bx’ \\

&=

x’ \gamma_0 \\

&=

L x L^\dagger \\

&=

e^{ -\vcap \phi/2 } x^\mu \gamma_\mu

e^{ \vcap \phi/2 } \gamma_0 \\

&=

e^{ -\vcap \phi/2 } x^\mu \gamma_\mu \gamma_0

e^{ -\vcap \phi/2 } \\

&=

e^{ -\vcap \phi/2 } \lr{ x^0 + \Bx } e^{ -\vcap \phi/2 } \\

&=

L X L.

\end{aligned}

\end{equation}

Because the involution operator toggles the sign of vector grades, it is easy to see that the required invariance is maintained

\begin{equation}\label{eqn:boostToParavector:320}

\begin{aligned}

X’ \overline{{X’}}

&=

L X L

\overline{{ L X L }} \\

&=

L X L

\overline{{ L }} \overline{{ X }} \overline{{ L }} \\

&=

L X \overline{{ X }} \overline{{ L }} \\

&=

X \overline{{ X }} L \overline{{ L }} \\

&=

X \overline{{ X }}.

\end{aligned}

\end{equation}

Let’s explicitly expand the transformation of \ref{eqn:boostToParavector:140}, so we can relate the rapidity angle \( \phi \) to the magnitude of the velocity. This is most easily done by splitting the spacelike component \( \Bx \) of the four vector into its projective and rejective components

\begin{equation}\label{eqn:boostToParavector:340}

\begin{aligned}

\Bx

&= \vcap \vcap \Bx \\

&= \vcap \lr{ \vcap \cdot \Bx + \vcap \wedge \Bx } \\

&= \vcap \lr{ \vcap \cdot \Bx } + \vcap \lr{ \vcap \wedge \Bx } \\

&= \Bx_\parallel + \Bx_\perp.

\end{aligned}

\end{equation}

The exponential

\begin{equation}\label{eqn:boostToParavector:360}

e^{-\vcap \phi/2}

=

\cosh\lr{ \phi/2 }

– \vcap \sinh\lr{ \phi/2 },

\end{equation}

commutes with any scalar grades and with \( \Bx_\parallel \), but anticommutes with \( \Bx_\perp \), so

\begin{equation}\label{eqn:boostToParavector:380}

\begin{aligned}

X’

&=

\lr{ c t + \Bx_\parallel } e^{ -\vcap \phi/2 } e^{ -\vcap \phi/2 }

+

\Bx_\perp e^{ \vcap \phi/2 } e^{ -\vcap \phi/2 } \\

&=

\lr{ c t + \Bx_\parallel } e^{ -\vcap \phi }

+

\Bx_\perp \\

&=

\lr{ c t + \vcap \lr{ \vcap \cdot \Bx } } \lr{ \cosh \phi – \vcap \sinh \phi }

+

\Bx_\perp \\

&=

\Bx_\perp

+

\lr{ c t \cosh\phi – \lr{ \vcap \cdot \Bx} \sinh \phi }

+

\vcap \lr{ \lr{ \vcap \cdot \Bx } \cosh\phi – c t \sinh \phi } \\

&=

\Bx_\perp

+

\cosh\phi \lr{ c t – \lr{ \vcap \cdot \Bx} \tanh \phi }

+

\vcap \cosh\phi \lr{ \vcap \cdot \Bx – c t \tanh \phi }.

\end{aligned}

\end{equation}

Employing the argument from [3],

we want \( \phi \) defined so that this has structure of a Galilean transformation in the limit where \( \phi \rightarrow 0 \). This means we equate

\begin{equation}\label{eqn:boostToParavector:400}

\tanh \phi = \frac{v}{c},

\end{equation}

so that for small \(\phi\)

\begin{equation}\label{eqn:boostToParavector:420}

\Bx’ = \Bx – \Bv t.

\end{equation}

We can solving for \( \sinh^2 \phi \) and \( \cosh^2 \phi \) in terms of \( v/c \) using

\begin{equation}\label{eqn:boostToParavector:440}

\tanh^2 \phi

= \frac{v^2}{c^2}

=

\frac{ \sinh^2 \phi }{1 + \sinh^2 \phi}

=

\frac{ \cosh^2 \phi – 1 }{\cosh^2 \phi}.

\end{equation}

which after picking the positive root required for Galilean equivalence gives

\begin{equation}\label{eqn:boostToParavector:460}

\begin{aligned}

\cosh \phi &= \frac{1}{\sqrt{1 – (\Bv/c)^2}} \equiv \gamma \\

\sinh \phi &= \frac{v/c}{\sqrt{1 – (\Bv/c)^2}} = \gamma v/c.

\end{aligned}

\end{equation}

The Lorentz boost, written out in full is

\begin{equation}\label{eqn:boostToParavector:480}

ct’ + \Bx’

=

\Bx_\perp

+

\gamma \lr{ c t – \frac{\Bv}{c} \cdot \Bx }

+

\gamma \lr{ \vcap \lr{ \vcap \cdot \Bx } – \Bv t }

.

\end{equation}

Authors like Chappelle, et al., that also use paravectors [4], specify the form of the Lorentz transformation for the electromagnetic field, but for that transformation reversion is used instead of involution.

I plan to explore that in a later post, starting from the STA formalism that I already understand, and see if I can make sense

of the underlying rationale.

[1] William Baylis. *Electrodynamics: a modern geometric approach*, volume 17. Springer Science \& Business Media, 2004.

[2] C. Doran and A.N. Lasenby. *Geometric algebra for physicists*. Cambridge University Press New York, Cambridge, UK, 1st edition, 2003.

[3] L. Landau and E. Lifshitz. *The Classical theory of fields*. Addison-Wesley, 1951.

[4] James M Chappell, Samuel P Drake, Cameron L Seidel, Lachlan J Gunn, and Derek Abbott. Geometric algebra for electrical and electronic engineers. *Proceedings of the IEEE*, 102 0(9), 2014.

January 10, 2018 math and physics play 1 comment KaTex, latex, MathJax, mathjax-latex, wordpress, wordpress plugin, WP-KaTex

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.

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

where is the position to the area element on the shell. For the test position, let .

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

Here has been used to represent to horizontal rotation plane.

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

with an absolute squared length of

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

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

if , and zero otherwise, so

for , and zero otherwise.

In the problem, it is pointed out to be careful of the sign when evaluating , however, I don’t see where that is even useful?

- 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.

- 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! - 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!
- 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.
- 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.
- Left justified display mode is hard to read. The mathjax rendered centered display mode looks much better.

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.

December 25, 2017 Incoherent ramblings No comments ASCII, Christmas

Lance got me a little notebook for Christmas, the first page of which had a message that I had to work to decode:

Conveniently, it was all ASCII, and all in a single base. He got the evil idea of wishing he’d encoding each character in a different base, which would have made life more difficult. I used the following quick hack to decode:

There was one small encoding error, a missing zero that transformed an ‘s’ into a ‘;’.

December 12, 2017 Bitcoin 6 comments alt-coin, free-market, video games

My step-son Karl started suiting up in snow gear this morning, even before eating breakfast, to go out and shovel the snow. I managed to get some food into him first, and while he was in the kitchen, he noticed sadly that the dishwasher had not been run last night, so he wasn’t able to unload it for us!

He then proceeded to explain to me that if he does things that we (the adults in the house) like, then he has noticed that he gets more game (i.e. video-game) time.

The volume in video-game time futures may not be very high, but this coin, as unphysical as bitcoin, is a actively being traded in Markham, Ontario. Kids understand the free market very well, long before they ever actively take any sort of economics!

December 8, 2017 Bitcoin No comments altcoin, bitcoin, bitcoin cash, bitcoin fork, bitcoin gold, dashcoin, dogecoin, electrum, electrum-dash, litecoin, monero, Scott Horton show, segwit2x, transaction fee

There have been disagreements in the bitcoin development community about how to deal with scaling. These have resulted in a number of currency forks or proposed forks in the recent past, including

Here’s what I think would have to happen for a bitcoin fork to be successful:

- It can get itself onto most of the exchanges.
- It solves enough of the core bitcoin problems that people will actually start using it.
- Wallets are ubiquitously available (web wallets, full node wallets, mobile, …).
- It gets the Bitcoin Brand(TM), and all the marketing clout that brand carries.

There are a number of problems that bitcoin-core has right now:

- The scaling is absolutely abhorrent.
- Transactions with default wallet fees get stuck in limbo. Those fees are no longer pennies or fractions of pennies, but are dollars.
- A full node wallet requires a massive amount of space.
- It uses a public ledger without a built in mixer, so isn’t really anonymous, especially when the exchanges that so many transactions are occurring at have extensive personal info (drivers licences, passports, …).
- Massive energy cost to maintaining the network.

Long term I think many of these issues are disastrous, but the scaling and fees are the killer issues, and I mean that literally. If a solution to those problems is not incorporated into bitcoin core, then people will be forced to completely abandon bitcoin, and it will be left entirely to speculators (and then proceed to crash, after which it may become usable again for a while.)

Here’s a recent example that illustrates this. I tried to send $150 USD equivalent to the Scott Horton show, which is hands down the most informative foreign policy show in existence. I’d previously sent him a $200 USD equivalent donation in bitcoin (and got a listen and think audio lifetime subscription in exchange!), but I thought a signed copy of his book would be awesome, so decided to send some more.

- At the time I did this, the market price of bitcoin was around $15k USD/bitcoin, so this was about a 10mBTC (0.01 BTC) transaction.
- The wallet that I used to send the coin (electrum, which doesn’t require a full node) included a default fee of 0.392 mBTC (0.000392 BTC = ~$5.88 USD).

After 19 hours, this transaction still has zero confirmations, and my wallet is now showing this transaction as “Low Fee” with a hazard sign:

A 4% fee on $150 is no longer enough to successfully yield a single bitcoin transaction confirmation after almost a full day! At this rate, will my attempted send to the Scott Horton show ever go through? Have I lost the bitcoin I attempted to send?(*) I don’t think there is any way to bump up the fee on an existing transaction attempt to force it through (**).

Bitcoin has been portrayed as a low fee system that will replace extortionist money transfer systems like Western union, kill the banks that are in bed with governments, enable billions of unbanked access to world finances, and facilitate micro-transactions for small services. It certainly hasn’t met with these expectations if somebody fully banked can’t even send $150.

The days of being able to sent tips with bitcoin for services that seem desirable appear to be in the past. I happen to have a tips page on this blog. I’ve renamed it to ‘cryptocurrency tips’ from ‘bitcoin tips’, since bitcoin now appears to be effectively non-functional.

(This doesn’t change the fact that a blog about math, physics, programming and random incoherent ramblings isn’t monetizable, so nobody will ever likely sent me enough bit or alt coin to even cover hosting fees, let alone the academic fees that have been associated with a lot of the content).

I have had at various points some altcoin wallets including:

- dashcoin (was darkcoin)
- litecoin
- dogecoin
- ethereum
- monero

I currently only have dashcoin and litecoin wallets with non-zero contents (and haven’t fired up my litecoin wallet in a long time … it’s sitting on a VM unused with a token amount in it.)

These coin implementations have a range of features (privacy, transaction rates, low fees, ASIC resistance, …). I don’t think any of them deal with blockchain archiving that will be required for continuous future use, and think that it is fundamentally broken that a full node wallet cannot download only a working portion of the blockchain (or grab other subsets on demand). However, if the coin implementation doesn’t handle scaling and low fees, I think it is going to be doomed. I’m not seeing signs that bitcoin core is taking those issues seriously.

(*)

This particular transaction has now disappeared from my electrum wallet, although it is still visible on the network.

It appears that whether or not a transaction truly expires also depends on all the possible mining clients. To protect myself against the Scott Horton show being paid twice should I resubmit my transaction with a higher fee, I’d have to generate a new wallet, and transfer all my funds into that.

(**)

It appears there are mechanisms to reset fees for transaction if they aren’t confirming, but they are wallet specific. The electrum 2.8 wallet software I was using did not have such a mechanism, and the transaction itself disappeared from the electrum history after about 24hrs. I upgraded my wallet to electrum 3.0.2, and the transaction showed up again, after which I was able to initiate a ‘child pays for parent’ transaction sending an additional fee (0.00178749 == $28 USD, another 18% fee, bringing the total fees to over 22%) to force my initial donation through.

[The electrum “child pays for parent” processing leaves a lot to be desired. After submission, that dummy transaction does not show in the transaction history, and there is no indication on the original transaction, that it has been made. I only knew that it worked the next morning, when my original transaction had confirmations.]

The moral of the story is that bitcoin can’t be used for small transactions anymore. If you send any or try to cash it in, you better make sure your wallet software is up to date, and setting fees high enough that the transaction will be processed. In the case of my donation to the Scott Horton show, where I asked for his $50 and $100 donation perks (signed copy of his book, and a QR silver respectively), despite paying additional fees, I may have gotten the better deal in the transaction, as I get two tangible items for bitcoin that is getting hard to spend (even if you can find somewhere that accepts it).

I don’t think it’s a surprise that dashcoin (and probably other altcoins) have gone up relative to bitcoin 25% in the last day, since bitcoin has hit this peak. A lot of the alt-coins can be spent and the fees aren’t exorbitant. It remains to see how some of these altcoins will do under the network pressure recently imposed on bitcoin.

November 9, 2017 Mainframe No comments cobc, COBOL, gnuCobol, Murach's mainframe COBOL, numeric, PIC

I recently bought Murach’s COBOL reference:

and coded the chapter 1 compound interest calculation myself before looking at the solution. I was surprised to see that (n)vim has built in syntax highlighting for COBOL. It even helps position the comments and line starts in the right places, which was handy.

Having been horrified any time in the past that I saw COBOL code, it feels weird to be coding my own hello-world in the language, but it works, and with ALL CAPS output, it looks sufficiently dinosaur’ish to be COBOL:

./interest ----------------------------------------------- TO END PROGRAM, ENTER 0. ENTER THE INVESTMENT AMOUNT. 1000 ENTER THE NUMBER OF YEARS. 1 ENTER THE INTEREST-RATE. 1 FUTURE-VALUE = 0001010.00 ----------------------------------------------- TO END PROGRAM, ENTER 0. ENTER THE INVESTMENT AMOUNT. 1000 ENTER THE NUMBER OF YEARS. 2 ENTER THE INTEREST-RATE. 1 FUTURE-VALUE = 0001020.10 ----------------------------------------------- TO END PROGRAM, ENTER 0. ENTER THE INVESTMENT AMOUNT. 0 END OF SESSION.

- I wasn’t sure about when I had to use statement terminators (.’s) in the ELSE body, so I moved the whole basic block to a helper function.
- I got messed up initially with the syntax for the PIC values at first, as I’d used .’s instead of V’s to specify that my variables were numeric. This caused cobc (gnu-cobol front end) to complain that INTEREST-AMOUNT was not numeric, and I eventually found the answer in the PIC table of the book.
- The point of this exercise was probably to use a loop, which I avoided by calculating the value in one shot. I’ll have to go back and see how to do that.
- There doesn’t seem to be any notion of function prototype, and the function bodies can be either before or after their calls.
- Functions are annoyingly, but appropriately (given the requirement to be over the top verbose for many things), called PARAGRAPHs in COBOL. I wonder what the mainframe does with name mangling, given that symbol names have to be 8 characters, and COBOL function names are up to 30. Perhaps only the external entry points (the program-id?), have that restriction?
- cobc’s implementation of -g sucks, and a debug session shows the lines of the generated .c files instead of the COBOL sources. There ought to at least be #line markers in the generated C sources instead of comments.