An Electrical Engineering Haiku

the openest mind

measures no open loop gain

without much bias


Can you represent a sine curve using sawtooth waves?


It occurred to me when looking at this picture that there may be a time in a laboratory setting when representing a sine curve with sawtooth waves might be useful.  Can it be done?

The answer is yes – for the impatient, here is the plot I eventually made. The recipe is given below…


as was explained to me in the subreddit /r/puremathematics by reddit user /u/Gro-Tsen as follows:

First, let me discuss how one can formally compute the coefficients expressing a sine wave as a sum of sawtooth waves: assume we have a formal sum

f(x) = g(x) + c₂·g(2x) + c₃·g(3x) + c₄·g(4x) + …

where c₂,c₃,c₄,… are known coefficients, and we want to invert this to find a similar expression for g in function of f,

g(x) = f(x) + d₂·f(2x) + d₃·f(3x) + d₄·f(4x) + …

(our goal is to compute the d coefficients in function of the c's).

This can be done inductively as follows: assuming the N−1 first d's are known (starting with just d₁=1), truncate the expression of g to the first N terms (leaving the N-th d coefficient, d[N], as an unknown) and substitute this in the first expression, then equate the first N coefficients: clearly this will give an equation determining the unknown d[N] in function of the known ones and the c's, in fact, for all N>1 this gives

d[N] = − sum(d[i]·c[N/i]) where i ranges over divisors of N (including i=1, for which d₁=1, but excluding i=N)

so we can compute

  • d₂ = −c₂
  • d₃ = −c₃
  • d₄ = −c₄+(c₂)²
  • d₅ = −c₅
  • d₆ = −c₆ + 2·c₂·c₃

and so on (for any prime number, d[p] = −c[p] as is clear from my inductive formula).

Now we can try the above purely formal method in the case where g(x) = sin(x) and f(x) is the sawtooth wave defined by f(x)=x/2 for −π<x<π. We have

f(x) = sin(x) − sin(2x)/2 + sin(3x)/3 − sin(4x)/4 + …

in other words c[i] = (−1)i+1/i and we can compute the d's from the above process:

1, 1/2, -1/3, 1/2, -1/5, -1/6, -1/7, 1/2, 0, -1/10, -1/11, -1/6, -1/13, -1/14, 1/15, 1/2, -1/17, 0, -1/19, -1/10, 1/21, -1/22, -1/23, -1/6, 0, -1/26, 0, -1/14, -1/29, 1/30, -1/31, 1/2, …

so we should have sin(x) = f(x) + f(2x)/2 − f(3x)/3 + f(4x)/2 − f(5x)/5 − f(6x)/6 − f(7x)/7 + f(8x)/2 − f(10x)/10 − … (where, again, f(x) is x/2 − π·floor((x+π)/(2π))).

Unfortunately, this reasoning was completely formal and does not say anything about convergence. I don't think one can reasonably expect convergence a.e. or L² convergence, because one can easily see that d[2n] is always 1/2, for any n>0, so the d[i] don't even tend to zero! Still, there's probably some weak sense in which the series converges (e.g., I'm pretty sure it converges as distributions), but since I'm an algebraist and not an analyst I'll just leave it at that.

Well “terrific,” I thought.   But does it really work?  /u/Gro-Tsen warned us that it would not converge, and he was correct.  I fired up Mathematica and generated the following image with 100 terms of the expansion /u/Gro-Tsen provided, displaying the weird convergence (code below). I still don’t know if its the convergence of the series causing this effect, or the built in machine representation of a sawtooth in Mathematica.

The coefficients were pulled from OEIS sequence A067856 with each entry divided by it’s index.  Here is the Mathematica code for the plot:

Tooth[x_] := SawtoothWave[(x - Pi)/(2*Pi)] - .5

Plot[Tooth[x], {x, -2*Pi, 2*Pi}]  (* this will verify that the function Tooth[] is valid *)

BigArr =

{1, 1, -1, 2, -1, -1, -1, 4, 0, -1, -1, -2, -1, -1, 1, 8, -1, 0, -1, -2, 1, -1, -1, -4, 0, -1, 0, -2, -1, 1, -1, 16, 1, -1, 1, 0, -1, -1, 1, -4, -1, 1, -1, -2, 0, -1, -1, -8, 0, 0, 1, -2, -1, 0, 1, -4, 1, -1, -1, 2, -1, -1, 0, 32, 1, 1, -1, -2, 1, 1, -1, 0, -1, -1, 0, -2, 1, 1, -1, -8, 0, -1, -1, 2, 1, -1, 1, -4, -1, 0, 1, -2, 1, -1, 1, -16, -1, 0, 0, 0}

BigArray = BigArr*(Array[1/# &, 100, 1])

Plot[Array[Tooth[# x] &, 100, 1].BigArray, {x, -2*Pi, 2*Pi},
ImageSize -> 1800]

Donate Bitcoins

The cost of artificially pumping a low volume altcoin: pumping the alt markets by yourself with the BTC/LTC “pump machine” strategy

Understanding the magnetic dipole moment

If you want to understand more about the parameter μ, try this.

We know (or at least accept) the usual equation E = – μ • B and perhaps one or two expressions for μ, like I*A or maybe even one using the current density J

μ = 1/2 ∫ d3x (r x J)

But this mysterious parameter can be found using only elementary physics, simply proposing that E is proportional to B, and finding that constant of proportionality.

Start with the same example that we used to find the gyromagnetic ratio of the electron, the charged particle motion in a circle due to uniform B. Now write down the kinetic energy of the particle – that’s right, just plain old

E = 1/2 m v2

Of course, v = r ω and we know from equating

m v2 / r = e v B  (the force due to B)

that m ω = e B. Propose there exists a constant of proportionality μ obeying

E = μ B = 1/2 m v2

where E is your expression you wrote down for kinetic energy. Solve for μ until you are satisfied that you have the same expression as you’d get by doing the integral above or using the current loop model I*A. You will obtain the same result as if you were to calculate

μ = IA = current x area = e ω/(2 π)π r2 = 1/2 e ω r2

or using the integral over current density J

μ = 1/2∫ d3x [r x J] = 1/2 r ρ*(Volume) v = 1/2 r e (rω) !!!

Note that here, ρ is charge density, so ρ (Volume) = total charge. The current density J is defined as ρv where v is the velocity of drift for the charge distribution ρ.

A round about derivation of the gyromagnetic ratio of a particle using elementary physics notions

A round about derivation of the gyromagnetic ratio of a particle using elementary physics notions

Of course, you can’t get the g-factor this way.  But hey.

Gyromagnetic ratios of various nuclei; A table of selected nuclear spins

Gyromagnetic ratios of various nuclei; A table of selected nuclear spins

Some gyromagnetic ratios of nuclei in MHz/T; some nuclear spins

Hello world!

Welcome to! This is your very first post. Click the Edit link to modify or delete it, or start a new post. If you like, use this post to tell readers why you started this blog and what you plan to do with it.

Happy blogging!