Peeter Joot's (OLD) Blog.

Math, physics, perl, and programming obscurity.

Archive for November, 2013

Signs, signs, everywhere there’s signs. Do this, don’t do that, can’t you read the sign.

Posted by peeterjoot on November 28, 2013

Here’s a sign that was recently installed in one of the men’s washrooms at work

IMG_1032

and a close up of it

IMG_1033

Yes, there is a set of men’s showers in the X1 location of the building, which is consistent with the graphic of the shower in the sign.  I couldn’t, however, for the life of me, figure out why somebody who was at the washroom sink would have to be reminded that the lab has shower facilities.  Nor could I figure out why we now had a sign that appeared to be instructing those at the sink to pray in the shower.

I’ve pointed it out this sign to a few people now when I was at the sink, but nobody else appeared to be able to decipher it.  Sofia, who is more wise in the ways of the world, told me what this is about: part of the Islamic prayer ritual involves washing one’s feet.

Sure enough, I remember that there was a guy who used to wash his feet in the bathroom sink in the summer.  He always wore sandals, and I thought his washing was because he thought his feet smelled (I wondered why he didn’t switch to socks and shoes if that was the case, and now feel silly for not just asking him).

So, it seems that this sign was likely commissioned and installed just for this one individual.  Somebody objected to his feet washing.  That objector was probably also completely ignorant like me, and likely didn’t know that this was part of his religious ritual.  I’d guess that foot washing objector still doesn’t know that.

Advertisements

Posted in Incoherent ramblings | Tagged: , , | Leave a Comment »

“fun” bug in 64-bit perl 5.10.0 bigint sprintf

Posted by peeterjoot on November 19, 2013

Here’s a rather unexpected bug with perl sprintf

#! /usr/bin/perl

use strict;
use warnings;
use bigint ;

my $a = hex( "0x0A0000001D05A820" ) ;
printf( "0x%016X\n", $a ) ;
printf( "%d\n", $a ) ;
printf( "$a\n" ) ;

The %X printf produces a value where the least significant 0x20 is lost:

$ ./bigint
0x0A0000001D05A800
720575940866189312
720575940866189344

Observe that the loss occurs in the printf and not the hex() call, since 720575940866189344 == 0x0A0000001D05A820.

This bug appears to be fixed in some version of perl <= 5.16.2. Oh, the joys of using ancient operating system versions so that we can support customers on many of the ancient deployments that they seem to like to run on.

Posted in perl and general scripting hackery | Tagged: , , , | Leave a Comment »

second update of phy487 notes (Condensed Matter Physics)

Posted by peeterjoot on November 16, 2013

Here’s an update of my (incomplete) lecture notes for the Winter 2013, University of Toronto Condensed Matter Physics course (PHY487H1F), taught by Prof. Stephen Julian. This makes updates to these notes since the first, and second versions posted.

NOTE: This v.3 update of these notes is still really big (~16M).  Some of my mathematica generated 3d images appear to result in very large pdfs.

This set of notes includes the following these additions (not many of which were posted separately for this course)

November 15, 2013 Semiconductors

November 13, 2013 Thomas-Fermi screening, and nearly free electron model

November 11, 2013 3 dimensional band structures, Fermi surfaces of real metals

November 05, 2013 Fourier coefficient integral for periodic function

November 04, 2013 Tight binding model

November 04, 2013 Fermi properties, free electron specific heat, bulk modulus

November 01, 2013 Nearly free electron model, periodic potential (cont.)

October 29, 2013 Free electron model of metals

October 28, 2013 Electrons in a periodic lattice

October 23, 2013 Huygens diffraction

Posted in Math and Physics Learning. | Tagged: , , , , , , , , , , , , , | 2 Comments »

Political correctness crap in IBM HR circles

Posted by peeterjoot on November 12, 2013

Apparently IBM has fired so many people that they have invented (or started using) the term RA (Resource Action) instead of fired, used like so:

Bob was RAed.

There has been another round of RAs.

If you don’t want to be RAed, make sure your PBC (personal business committment) document is filled in and sounds good, since there’s a new earnings report due out tomorrow.

This is supposed to sound nicer, but I think it’s the opposite.  To me this sounds like the individual is now a resource, and is be moved around like an entry in some accounting table.  RA means that, unfortunately, they ended up in the delete column.  It’s very impersonal.  Perhaps this is just to make the firing manager feel better, since that manager cannot do anything about the firing quotas when they occur.

Posted in Incoherent ramblings | Tagged: , | 1 Comment »

Remembering cultural insanity and propagandization

Posted by peeterjoot on November 11, 2013

It’s Remembrance day, and we are once again barraged with the heroism of war and sacrifice

warProp1

We get the cuddly manly shots of veterans posing on the field

warProp2

these last two pictures taken from the Markham community paper, where we have our poor veteran Stan, who recalls the “guts blood and luck at Juno Beach” quoted

we got to the beach, and there were dead people all over … You didn’t stop to pick someone up to even [to sic] check if they were still alive.  You just kept moving, otherwise you would have been shot yourself.

I surely sympathize for Stan.  This is truly horrifying, and must have been traumatic.  It’s something that you’d want to forget, and would haunt you for the rest of your life.  However, our unfortunate Stan was sold a narrative.

We must fight the evil villain.

warProp5

People are dying and it is our duty to protect.

warProp6

Kids are doing their part

warProp4

Women are doing their part

warProp8

It is brave and honourable to do your part

warProp3

Even the whisky makers are doing their part!

warProp7

The list of selling points goes on and on.   “Be ashamed of your fear of death.  It’s the right thing to do. … “  It was a vicious and evil sales pitch.  This is a narrative that was backed by hordes of propaganda.

A lot of profit was made by this war.  This is true of all war.

In a sane world, what would we be remembering?  Follow the money.  We should remember those that profited from the war.  We should remember those that directly or indirectly sold armaments to both sides.  Most importantly, we should remember those that bankrolled the war on all sides.  Stan was not on the winning side.  He was on the loosing side.  The winning side resides in corporate and banking boardrooms.  This is what we need to remember whenever the drums of war start beating.

Posted in Incoherent ramblings | Tagged: , , , , | 1 Comment »

New kitchen closet organizer

Posted by peeterjoot on November 9, 2013

Our kitchen closet, by the backwards de-facto main entrance of our house, has been a horrible mess, not just because of Sofia’s seven (!) pairs of boots.  We’ve now built a little shoe rack that helps with that bit of the old chaos:

IMG_0981

This has an adjustable shelf, but will probably remain fixed.  Even cooler is a little “nook” shelf along an odd little crevasse in the closet:

IMG_0982

We’ve now all got a little shelf in there for gloves and hats.  These shelves are also all adjustable, but it may end up being a good distribution as is.  The view of the whole closet is now nice and tidy:

 

IMG_0983

The rack that’s original from the house builder above is starting to fall down, and we’ll need to build something to replace it before too long.

Posted in Home improvement | Tagged: | Leave a Comment »

Fourier coefficient integral for periodic function

Posted by peeterjoot on November 5, 2013

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

In phy487 we’ve been using the fact that a periodic function

\begin{aligned}V(\mathbf{r}) = V(\mathbf{r} + \mathbf{r}_n),\end{aligned} \hspace{\stretch{1}}(1.1)

where

\begin{aligned}\mathbf{r}_n = a_1 \mathbf{a}_1 + a_2 \mathbf{a}_2 + a_3 \mathbf{a}_3,\end{aligned} \hspace{\stretch{1}}(1.2)

has a Fourier representation

\begin{aligned}V(\mathbf{r}) = \sum_\mathbf{G} V_\mathbf{G} e^{ i \mathbf{G} \cdot \mathbf{r} }.\end{aligned} \hspace{\stretch{1}}(1.3)

Here \mathbf{G} is a vector in reciprocal space, say

\begin{aligned}\mathbf{G}_{rst} = r \mathbf{g}_1 + s \mathbf{g}_2 + t \mathbf{g}_3,\end{aligned} \hspace{\stretch{1}}(1.4)

where

\begin{aligned}\mathbf{g}_i \cdot \mathbf{a}_j = 2 \pi \delta_{ij}.\end{aligned} \hspace{\stretch{1}}(1.5)

Now let’s express the explicit form for the Fourier coefficient V_\mathbf{G} so that we can compute the Fourier representation for some periodic potentials for some numerical experimentation. In particular, let’s think about what it meant to integrate over a unit cell. Suppose we have a parameterization of the points in the unit cell

\begin{aligned}\mathbf{r} = u \mathbf{a}_1 + v \mathbf{a}_2 + w \mathbf{a}_3,\end{aligned} \hspace{\stretch{1}}(1.6)

as sketched in fig. 1.1. Here u, v, w \in [0, 1]. We can compute the values of u, v, w for any vector \mathbf{r} in the cell by reciprocal projection

Fig 1.1: Unit cell

\begin{aligned}\mathbf{r} = \frac{1}{{2 \pi}} \left(  \left(  \mathbf{r} \cdot \mathbf{g}_1 \right) \mathbf{a}_1 + \left(  \mathbf{r} \cdot \mathbf{g}_2 \right) \mathbf{a}_2 + \left(  \mathbf{r} \cdot \mathbf{g}_3 \right) \mathbf{a}_3 \right),\end{aligned} \hspace{\stretch{1}}(1.7)

or

\begin{aligned}\begin{aligned}u(\mathbf{r}) &= \frac{1}{{2 \pi}} \mathbf{r} \cdot \mathbf{g}_1 \\ v(\mathbf{r}) &= \frac{1}{{2 \pi}} \mathbf{r} \cdot \mathbf{g}_2 \\ w(\mathbf{r}) &= \frac{1}{{2 \pi}} \mathbf{r} \cdot \mathbf{g}_3.\end{aligned}\end{aligned} \hspace{\stretch{1}}(1.8)

Let’s suppose that \mathbf{V}(\mathbf{r}) is period in the unit cell spanned by \mathbf{r} = u \mathbf{a}_1 + v \mathbf{a}_2 + w \mathbf{a}_3 with u, v, w \in [0, 1], and integrate over the unit cube for that parameterization to compute V_\mathbf{G}

\begin{aligned}\int_0^1 du\int_0^1 dv\int_0^1 dwV( u \mathbf{a}_1 + v \mathbf{a}_2 + w \mathbf{a}_3 ) e^{-i \mathbf{G}' \cdot \mathbf{r} }=\sum_{r s t}V_{\mathbf{G}_{r s t}}\int_0^1 du\int_0^1 dv\int_0^1 dwe^{-i \mathbf{G}' \cdot \mathbf{r} }e^{i \mathbf{G} \cdot \mathbf{r} }\end{aligned} \hspace{\stretch{1}}(1.9)

Let’s write

\begin{aligned}\begin{aligned}\mathbf{G} &= r \mathbf{g}_1 + s \mathbf{g}_2 + t \mathbf{g}_3 \\ \mathbf{G} &= r' \mathbf{g}_1 + s' \mathbf{g}_2 + t' \mathbf{g}_3,\end{aligned}\end{aligned} \hspace{\stretch{1}}(1.10)

so that

\begin{aligned}e^{-i \mathbf{G}' \cdot \mathbf{r} } e^{i \mathbf{G} \cdot \mathbf{r} }=e^{ 2 \pi i (r - r') u } e^{ 2 \pi i (s - s') u } e^{ 2 \pi i (t - t') u } \end{aligned} \hspace{\stretch{1}}(1.11)

Picking the u integral of this integrand as representative, we have when r = r'

\begin{aligned}\int_0^1 du e^{ 2 \pi i (r - r') u } =\int_0^1 du= 1,\end{aligned} \hspace{\stretch{1}}(1.12)

and when r \ne r'

\begin{aligned}\int_0^1 du e^{ 2 \pi i (r - r') u } ={\left.{{   \frac{    e^{ 2 \pi i (r - r') u }   }   {   2 \pi i (r - r')    }}}\right\vert}_{{u = 0}}^{{1}}=\frac{1}{{2 \pi i (r - r') }} \left(  e^{ 2 \pi i (r - r') } - 1  \right).\end{aligned} \hspace{\stretch{1}}(1.13)

This is just zero since r - r' is an integer, so we have

\begin{aligned}\int_0^1 du e^{ 2 \pi i (r - r') u } = \delta_{r, r'}.\end{aligned} \hspace{\stretch{1}}(1.14)

This gives us

\begin{aligned}\int_0^1 du\int_0^1 dv\int_0^1 dwV( u \mathbf{a}_1 + v \mathbf{a}_2 + w \mathbf{a}_3 ) e^{ -2 \pi i r' u } e^{ -2 \pi i s' v } e^{ -2 \pi i t' w } =\sum_{r s t}V_{\mathbf{G}_{r s t}}\delta_{r s t, r' s' t'}= V_{\mathbf{G}_{r' s' t'}}.\end{aligned} \hspace{\stretch{1}}(1.15)

This is our \textAndIndex{Fourier coefficient}. The \textAndIndex{Fourier series} written out in gory but explicit detail is

\begin{aligned}\boxed{V( u \mathbf{a}_1 + v \mathbf{a}_2 + w \mathbf{a}_3 ) = \sum_{r s t}\left(  \int_0^1 du' \int_0^1 dv' \int_0^1 dw' V( u' \mathbf{a}_1 + v' \mathbf{a}_2 + w' \mathbf{a}_3 ) e^{ -2 \pi i (r u' + s v' + t w') }  \right)e^{ 2 \pi i (r u + s v + t w) }.}\end{aligned} \hspace{\stretch{1}}(1.16)

Also observe the unfortunate detail that we require integrability of the potential in the unit cell for the Fourier integrals to converge. This prohibits the use of the most obvious potential for numerical experimentation, the inverse radial V(\mathbf{r}) = -1/\left\lvert {\mathbf{r}} \right\rvert.

Posted in Math and Physics Learning. | Tagged: , , , , | Leave a Comment »

Markham parking bylaws

Posted by peeterjoot on November 4, 2013

In What is the justification for such a harsh and expensive bylaw?, I’d posted a letter to my Markham city councillor.  To my surprise, the response was both hopeful, and helpful:

I can sympathize with you on this as it’s also happened to me when I forgot to move my car into my driveway.  I recently had a meeting with the commissioner and By-Law manager to discuss the situation in Cornell as I’m not happy with the over zealous enforcement.   As a result of that meeting, the city is preparing a report for council to request funds to undertake a wholesome review of the parking situation right across the city. This will examine on street parking, permits and snow removal etc.  I expect a report back sometime in the spring.

While the above is too late for your current situation, I hope you intend to come over to the civic centre and request some relief from the parking adjudicator.  He works very day from noon until 4 pm and Thursday nights from 5-7pm as well.  Usually, you can get at least a 50% reduction.

I sincerely hope that we can get some improvements to the overall situation sometime next year and I ask for your patience while we work on it.

We see bureaucracy at work in full force here, with a report required to make a report.  However, perhaps on review, there will be a decision for less parking extortion in Markham.  I’m not holding my breath, since this form of indirect taxation is probably a nice cash cow.

The suggestion to see the parking adjudicator was a good one, and I was immediately able to get a 50% reduction, seemingly just for showing up and objecting.  It’s not obvious that this would have been an action I could take, since the ticket enumerated only two options: 1) pay, or 2) request a trial date.

Posted in Incoherent ramblings | Tagged: , , , | Leave a Comment »