CFiHKAL: Continued Fractions I have Known and Loved

Departing from our usual programming, this will not be a blog post about anything related (at least directly) to magnetic resonance or quantum dynamics. It will be a post about mathematics, particularly continued fractions.

How I met continued fractions

After graduating high school at 16, I discovered continued fractions, having been intrigued by much of the mythology surrounding the Indian mathematician Srinavasa Ramanujan. Continued fractions were one (of several) areas of mathematics Ramanujan made incredible contributions to.

[It goes without saying that Ramanujan was one of the most naturally gifted mathematicians in history, despite never having received any formal training, with a signature habit of providing extraordinary results without proof.]

So I spent a lot of my time on random number theory problems, and published a couple of my continued fractions in the Online Encyclopedia of Integer Sequences (OEIS) you can find here.

Later, as an undergrad, I enjoyed the work of the Soviet mathematician Alexander Khinchin – yes physicists, the same Khinchin of Wiener-Khinchin theorem fame – since the master of the Soviet school of probability theory also published the classic book on continued fractions.

I then became a scientist and unfortunately lost a lot of the freedom/time to pursue this little side-gig.

So here’s a collection of cool continued fractions I have encountered over the last 10 years.

1. Powers of the Golden Ratio and the Lucas numbers

This is the most trivial example of a simple continued fraction:

Which is the golden ratio:

Continued fractions can be more neatly expressed in the “K notation” commonly ascribed to Carl Friedrich Gauss (from Kettenbruch, the German name for a continued fraction):

One of the first cool simple patterns I stumbled upon in mathematics was the following relationship relating to powers of the golden ratio:

Which has the general form:

In which Ln denotes the Lucas numbers.

2. Good ol’ π

The simple continued fraction for π may appear to show no consistent pattern:

But there are incredible non-simple continued fractions for Pi. The most famous is Lord Brouncker‘s continued fraction:

Lord Brouncker had a fascinating biography which included being the first president of the Royal Society and having a prolonged affair with the wife of the first cousin of Oliver Cromwell.

Other contfracs include:

  1. “An Elegant Continued Fraction for Pi” by Leo Jerome Lange, American Mathematical Monthly 106 (1999)



  2. “Another Continued Fraction for Pi” by Thomas J .Pickett, Ann Coleman, American Mathematical Monthly 115 (2008)



3. Ratios of the Modified Bessel Function

In 1990, Stanley Rabowitz posed a fascinating problem:

Which was formally proven by Neville Robbins in 1993 in the Fibonacci Quarterly, 33(4); pages 311-312.

Incredibly, there is a general identity which may be found in the Handbook of Continued Fractions for Special Functions:

[I may add some more contfracs in the future. For now I have to get back to doing my job.]

Hartmann-Hahn Evolution from Solution to Solids, Part II: Quasiperiodicity and Nuclear Spin Plasma Dispersion as Consequences of the High-Temperature Approximation

In the previous blog post, we derived the effective Hamiltonian of (anisotropic) Hartmann-Hahn evolution:

In this blog post, we will derive and explore the general form of the (IzSz) polarization transfer trajectory under Hartmann-Hahn conditions in INS spin systems.

First, let’s recall some basic quantum mechanical properties. The operator amplitude of B in A (i.e. how much of operator B is in operator A) is given by:

In which we’ve used the concept of a Frobenius norm and a funky operation, common within the field of NMR at least, called the “Liouville bracket” (see the paper by Jean Jeener):

Part A: Hartmann-Hahn transfer from a virtual spin-ℓ particle to a single spin-1/2 particle

We’ll begin by considering the basic problem of spin order transfer from a spin-ℓ particle I to a spin-1/2 particle S. We have (at least as a start):

In which it is crucial to note a consequence of the high-temperature approximation: the initial density operator is ℓz. This is the fundamental root cause of a host of complications we will see later.

If we define the following effective angle (just so the notation doesn’t get too horrible):

We calculate the following polarization trajectories for the first values of ℓ, which can be expressed as a sum of oscillators:

I’ve written the equations in this weird way to make the otherwise nonobvious pattern clear. Using mathematical induction, we have the general result:

In which the apparently mysterious coefficient is related to a basic identity of angular momentum raising/lowering/ladder operators:

The argument inside the sine functions represents eigenvalues that are essentially (discretely) distributed along a Wigner semicircle.

Now, let’s look at the actual functions representing the polarization transfer trajectories. The first two are simple periodic functions:

But all hell breaks loose once we have ℓ ≥ 3/2:

Why does this happen? Due to the fact that the functions are sums of oscillators with frequencies that are incommensurate (irrational multiples with respect to each other), the trajectory is now not periodic but quasiperiodic. This means that:

  1. In general, the trajectory never repeats itself exactly in time.
  2. In general, we cannot find closed-form simple expressions for when a local maximum, minimum, or zero occurs.

Essentially, we are dealing with a quantum many-body problem. However, a form of order does emerge for large values of ℓ:

Here, Hk(z) denotes the Struve function of the first kind of order k. The Struve function is a cousin of Bessel functions, which are commonly encountered in solid-state NMR. This equation implies that at high-temperature conditions, the maximum possible transfer from a high-spin particle I via a Hartmann-Hahn sequence is:

Struve and Bessel functions naturally arise in integrals of trigonometric functions inside trigonometric functions. Here’s a hint:

The particular mathematical trick I used to obtain this problem was the following identity:

I have not been able to find this identity in the mathematical literature, so it’s worth revealing the works my formal proof:

All we have to do to get the final result is plug in z = [ℓ(ℓ+1)]1/2 × βJ.

There have been at least two reports of the Struve function popping up in magnetic resonance problems [1, 2]. For those who don’t believe me, here is a comparison of plots of the polarization transfer trajectory for a hypothetical spin-100 particle vs. the Struve function approximation:

Part B: Hartmann-Hahn transfer in INS spin systems (from N spin-1/2 particles to a single spin-1/2 particle)

The previous results can be used to great effect to automatically obtain the form of the polarization transfer trajectory in INS spin systems. We merely have to do some sneaky normalization (the old I-spin basis had 2ℓ+1 states, the new I-spin basis has 2N states) and employ our friend the Catalan triangle to account for multiplicities:

Here’s what the first few functions look like. Just like before, we have a quantum many-body problem where quasiperiodicity kicks in when N > 2.

You will notice something peculiar for larger values of N – neglecting the transient “revivals”/Loschmidt echoes, the time period between t = 0 and t = 1/J begins to vaguely resemble a cross-polarization curve in solids. There is a gradual loss of coherent behavior and a prominent “surge” in the beginning.

In fact, there is an exact solution for the Hartmann-Hahn polarization transfer trajectory in the thermodynamic limit of large N:

In which “F” denotes the Dawson integral (also called Dawson’s integral or the Dawson function).

Deriving this result was not completely straightforward, requiring both the Struve function result shown earlier and the (1st derivative of the!) Gaussian limit for the Catalan triangle coefficients obtained via what I’ve called the “extended de Moivre-Laplace theorem” (see my paper):

… as well as a couple of tricks. Essentially, the limiting form of the Catalan triangle coefficients gives you a Laplace transform-looking cursed object that spits out the required result:

You can compare the Dawson function approximation (blue) to the analytical expression (black) for a hypothetical N = 1000 spin system:

In the high-N thermodynamic limit, there are no oscillations or coherent behavior whatsoever. We have a surge followed by a plateau to 1. This resembles the sort of cross-polarization kinetics you would see in solid-state magnetic resonance, usually with some kind of relaxation/damping:

But in the absence of relaxation, we have the following results for Hartmann-Hahn evolution in the thermodynamic limit:

Nuclear spin plasmas?

The Dawson integral is also known as the Fried-Conte plasma dispersion function or simply “the plasma dispersion function”. What the hell is a function associated with plasma physics doing in magnetic resonance? If you’re feeling crazy enough, there is a simple physical analogy you could make:

The criteria for plasma formation are typically a combination of (very) high temperature and high density – which obviously combine to to produce high plasma pressure. The “plasma-like” behavior we have just characterized emerges in nuclear spin systems that display a combination of high spin temperature (a very easy condition to satisfy unless you are doing some form of hyperpolarization) and high spin density (a large sqrt(N)), leading to a virtual quantity one could perhaps call… a high nuclear spin pressure? But only if you really wanted to.

Speaking of hyperpolarization, you can appreciate that there are vivid consequences for polarization transfer in highly-polarized spin systems – for now I can say that the dynamics become simpler (think one populated ground state, one oscillator) and the enhancement is no longer plagued by destructive interference. But that aspect might be better suited for another blog post/paper.

EDIT (17/06/2024, 19:44 UK time): I fixed a couple of typos and wasn’t too happy with the lack of mathematical exposition so I expanded the mathematics a bit.

Hartmann-Hahn Evolution from Liquids to Solids, Part I: Introduction

The Hartmann-Hahn (HH) experiment [1. the original 1962 paper] is one of the cornerstones of modern magnetic resonance, with a history so deeply tied to “cross-polarization” that the two are often considered synonymous. Several different ways of engineering an HH Hamiltonian exist [2], and despite the stereotypical association of HH evolution with solid-state experiments (due to the stringent matching condition associated with the conventional experiment, and the comparatively miniscule J-couplings encountered in solution), it has enjoyed a rich history in the solution-state [3. the beautiful paper by Chingas et al.; 4. the informative chapter by Glaser and Quant, 5, 6, 7], and repeatedly stimulated the minds of the greatest theorists [8, 9, 10, 11]. In practice, for reasons of robustness, the most common variation on a “Hartmann-Hahn” experiment in solution will typically exploit sequences originally designed for heteronuclear decoupling [12. Levitt’s “MOIST” experiment, which is just MLEV-4, 13. M. Ernst et al.’s study of cross-polarization].

I thought I would write a series of blog posts to talk about some neat and underappreciated features of Hartmann-Hahn evolution, whose solution-state theory (which I have spent a good deal of time thinking about) appears to have been totally understudied since the paper by Chingas and coworkers at the US Naval Research Laboratory [3]. But the deeper theory will first require a solid introduction as foundation, which by itself is likely to be more useful to a general audience. So here is Part I.

1. Classic Hartmann-Hahn evolution

Consider a heteronuclear spin-1/2 system consisting of two spin species I and S. In general, each spin species may have an arbitrary number of spins. The spins precess at Larmor frequencies ω0I and ω0S respectively, and are connected via a mutual J-coupling JIS.

Under the secular assumption (the difference in Larmor frequencies of the two spins greatly exceeds the J-coupling):

The J-coupling Hamiltonian is given by:

In the doubly-rotating frame, this can be treated as the total Hamiltonian.

Under the tacit assumption of the rotating-wave approximation:

Consider the general propagator of a matched (that is to say, ω1I = ω1S = ω1) rf-field along the x-axis, synchronously applied on the I and S channels, on resonance, following a simultaneous 90y rotation:

The Hamiltonian may be rewritten in the interaction frame of the rf-field to give the interaction frame Hamiltonian:

And the effective propagator Ueff(t) can be taken as the complex exponential of the average Hamiltonian, which may be expressed as a sum of Magnus expansion terms:

Note that we have used the Nielsen convention [14] for indexing of the Magnus expansion terms that differs from the older literature [15] by one. The first term is given by:

Whose solution in this case is given by:

Containing undesirable double-quantum “error” terms:

In the limit of a nutation frequency greatly exceeding the heteronuclear J-coupling (ω1 >> JIS), the first-order average Hamiltonian (Hav) simply reduces to:

In which the scaling factor κ is simply 1/2 in ideal circumstances (the absence of pulse imperfections, errors, etc.). The corresponding propagator, Uav(t), is:

Irrespective of the number of spins I and S, Equation (13) holds under the previous assumptions of:

  1. The Hartmann-Hahn condition; the rf field applied to both spin species synchronously, and along the same axis, must be matched.
  2. The nutation frequency overwhelmingly exceeds the heteronuclear J-coupling.
  3. The rotating-wave approximation.
  4. The absence of pulse imperfections in the form of either resonance offset and/or pulse strength errors on either the I or S channels.

Equation (13) above corresponds to the well-known effective Hamiltonian describing evolution under anisotropic Hartmann-Hahn transfer conditions [3, 4].

2. Hartmann-Hahn transfer via DualPol

Hartmann-Hahn transfer need not be achieved via matched rf fields applied on both spin channels synchronously – it is possible to engineer an alternative route of polarization transfer using pulse-interrupted free precession.

Consider the following multiple-pulse sequence applied to the secular J-coupling Hamiltonian HJ, under the assumption that the pulses (applied synchronously on the I and S channels) represent perfect rotations of negligible duration:

The evolution has a piecewise form. If the repetition rate greatly exceeds the coupling constant (τ-1 >> JIS), the average Hamiltonian may be taken as the first-order term of a Baker-Campbell-Hausdorff expansion:

Which, in this case, is simply:

It is trivial to engineer the previous sequence, but we have only considered the bilinear term(s) IzSz present within HJ. It is also obvious that – due to the lack of a refocusing element – the sequence is particularly vulnerable to inhomogeneous broadening i.e. resonance offset effects.

More formally, the presence of a single resonance offset term, such as Iz, leads to a first-order average error Hamiltonian of the form:

Clearly, unless the offset terms are much smaller than the J-coupling, polarization transfer is compromised. In standard solution-state NMR, where heteronuclear J-couplings are on the order of 1-100 Hz, this means that the sequences are strictly restricted to on-resonance applications. The stringent requirement on the matching condition is analogous to the sensitivity of the conventional Hartmann-Hahn experiment to the condition ω1I = ω1S.

The problem is easy to remedy by simply introducing a refocusing element in the pulse sequence, as follows:

This leads to a pulse sequence we have called DualPol [see the trilogy of rhodium papers I coauthored with Harry Harbor-Collins 16, 17, 18]. DualPol is a dual-channel variant of the PulsePol sequence [19] invented by Tratzmiller [20] of the Ulm group, originally in the context of optical DNP in NV centres, which we had shown could be applied for excitation of nuclear singlet order [21]. This diversity of applications is of course no coincidence and directly follows from the premise of archetypal pulse sequences.

DualPol engineers a Hartmann-Hahn Hamiltonian Hav that is highly robust against resonance offset and pulse strength errors. Unusually for solution-state cross-polarization sequences… DualPol is windowed.

3. Some Notes on Windowed and Windowless Sequences

During the development of heteronuclear spin decoupling, there were competing arguments as to the final form of the decoupling sequence. Should the decoupling sequence be windowed (“hard” strong pulses separated by comparatively long delays) or windowless (“soft” pulses, with the rf field applied continuously without any gaps)?

As the legend goes, the late Ray Freeman had insisted that windowed decoupling was superior. His PhD student at the time, Malcolm Levitt, had proven his advisor wrong by showing [Levitt’s PhD thesis 22] that windowless decoupling was more efficient, in the sense of less power deposition and less sample-heating (the most serious concerns for solution-state applications at the time). This became common wisdom among solution-state NMR spectroscopists, and indeed, windowed sequences for decoupling/cross-polarization became rather unusual.

I can relay a vaguely similar personal anecdote: during our testing of the DualPol sequence (note that the problem now is cross-polarization, not decoupling), my advisor had pointed out the previous point to us, and argued against us in favor of windowless sequences, which conventional wisdom as well as literature evidence had conclusively shown were more efficient. We exhaustively ran comparisons with every windowless sequence there was – from MOIST/MLEV-4 to DIPSI and FLOPSY – and found that in all cases DualPol had superior behavior with regards to compensation against resonance offset errors (our main concern at the time due to the massive bandwidth expected for heavy spins such as 103Rh). So I won this argument and a grand cash prize of £0.

How could this be? The bandwidth of a pulse sequence is determined by the peak nutation frequency. It depends on how much beating your probe can take, but a windowed pulse sequence (such as DualPol), in general, allows one to use much more powerful pulses – with a larger nutation frequency – than windowless sequences, which have 100% duty cycles by definition. For the same average rf power deposition, windowed pulse sequences are associated with a wider effective bandwidth! Indeed, the basic logic of “windowed = wider” is generally a feature of ultra-broadband sequences in the solution-state [23].

Evolution-Constrained Bounds on Polarization Transfer in I_{N}S Spin Systems Part II: Adiabatic Sweeps

Everybody loves adiabatic sweeps. They are a popular way of achieving Iz → Sz polarization transfer because you can kill two birds with one stone: you usually get an impressive enhancement factor as well as automatic robustness against errors in whatever parameter you felt like sweeping, whether it was pulse strength, resonance offsets/detuning, or something else.

But what goes up must come down. Here’s the unfortunate catch: an adiabatic sweep can never give you the maximum possible enhancement factor. See my OEIS sequence A362534, and consult the Sacred Table:

In this blog post we’re going to try and deal with the adiabatic column of this table, but I should first provide a disclaimer: note that the basic observation that adiabatic sequences do not lead to the maximum possible transfer of polarization dates back (at least) to Hodgkinson and Pines’ paper from 1997 [1]. The adiabatic-associated bounds themselves were derived by Chingas, Garroway, and friends at the US Naval Research Laboratory [2, 3] even earlier.

The bounds on an adiabatic Iz → Sz transfer, in INS spin systems, are simply:

Where we have used our good friend the Catalan triangle to avoid doing more group theory than we really need to. (I shall not bear gruppenpest in this house.)

But hold on, where does the above result come from? The bound is very simply obtained by considering the much easier problem of an adiabatic Iz → Sz transfer in a two-spin subsystem (I = ℓ, S = 1/2):

All we’ve really done here is some sneaky normalization i.e. multiply by the (2ℓ+1) factor associated with the old 1-spin-ℓ basis, divide by the 2N factor associated with the new N-spin-1/2 basis, and you’re golden. Then, just consult the aforementioned Catalan triangle to account for the multiplicity of the spin-ℓ manifolds [As emphasized in that blog post, a common theme in tackling multispin problems where permutation symmetry is strictly satisfied, is solving for the irreducible subspaces and simply adding things up.]

Conveniently, it turns out that there is a closed form for the adiabatic-associated bounds:

Which I think is somewhat less intimidating than the equivalent form given in the aforementioned paper by Chingas et al.:

Evolution-Constrained Bounds on Polarization Transfer in I_{N}S Spin Systems Part I: Refocused INEPT

It is seldom appreciated that the bounds on spin-order transfer are evolution-constrained. That is to say, a particular type of evolution (corresponding to some pulse sequence, effective Hamiltonian, or equivalent definition) – designed to convert some well-defined initial spin order configuration (be it a population, coherence, or arbitrary mixture thereof) into another well-defined target – may be associated with a distinct upper bound on the maximum achievable spin order transfer, an upper value that is in general lower than the absolute upper bound, irrespective of whether the absolute upper bound happens to be symmetry-constrained [1] or not [2].

Oof, that was a mouthful. Here’s what I’m talking about (a table from a paper I’ve been writing for a few forevers):

For now, let’s talk about just one of the columns from my table. The refocused INEPT pulse sequence is perhaps the most commonly used polarization transfer experiment in solution-state NMR spectroscopy. The experiment was described by Burum and Ernst [3] as a sequel to the famous INEPT sequence devised by Morris and Freeman [4].

To my surprise, most NMR spectroscopists are unaware of the simple general expressions for both the optimal refocusing duration and the ensuing maximum enhancement factor, despite the fact that they were derived by David Doddrell and coworkers in the land Down Under in the 1980s [5, 6, 7, 8, 9, 10]. To save the reader time ruffling through references, these expressions can be found in a very brief JACS paper [11].

Let’s start with the INEPT sequence, which has a very simple theory in INS spin systems. In a nutshell, INEPT accomplishes the conversion Iz → [Ix → 2IySz → 2IzSz →] 2IzSy (from pure I-spin longitudinal order to maximally I-correlated S-spin order, via a zz- or two-spin longitudinal- order intermediate), via the following steps:

  1. The I-spins are tipped to the transverse plane by a 90y pulse i.e. something like Iz → Ix. [Alternatively, from another frame of reference, the Hamiltonian is tipped from 2πJ×IzSz → 2πJ×IxSz].
  2. Evolution for a total time period of τ = 1/(2J) leads to a total rotation τ×2πJ = π about the IxSz axis (more properly π/2 about the 2IxSz axis). This basically accomplishes the transformation Iz → 2IySz.
  3. The I spins are tipped to the longitudinal plane by a 90x pulse; i.e. 2IySz → 2IzSz
  4. The S spins are tipped to the transverse plane for detection by 90-x pulse; i.e. 2IzSz → 2IzSy, leading to an antiphase multiplet most people associate with INEPT, that you can read more about in my paper [12].

[Note: there are some sign changes involved depending on the sign of the J-coupling, whether a 180 degree pulse is used, its phase, etc. which I will not waste our time worrying about.]

The key thing to note about the INEPT sequence is that the I-spins are evolving under the action of the S-spins, of which – by definition – there is only one in INS spin systems. Hence, the optimal duration of the INEPT sequence is always going to be 1/(2J). It’s a no-brainer.

Now, let’s consider the eponymous refocusing block present in refocused INEPT. In a nutshell, the refocusing block tries to accomplish the transformation 2IzSz [→ 2IzSy → Sx] → Sz. Note the symmetry with the INEPT sequence; it’s mirrored. Due to the fact that the S-spin is evolving under the action of (in general) multiple I-spins, things get a bit tricky, but it’s nothing we can’t handle. The problem essentially amounts to solving:

Where:

All we have to do is evaluate the first few solutions. We get:

Now, the solution is staring us right in the face. It is easy to see by mathematical induction that we have a general solution for the transformation amplitude of longitudinal 2IzSz to Sz:

Obtaining the optimal duration of the refocusing tau (aka the time at which the maximum occurs) is a simple matter of high-school calculus:

Leading to:

In the thermodynamic limit, we encounter yet another high-school calculus problem:

The reader is encouraged to compare these values with the so-called “entropy bound” (a term I despise with a passion) and the thermodynamic limit of Sorensen’s bound [13].