HNHacker News
TopNewBestAskShowJobs

quarterwave

166 karma · joined February 7, 2014

submissionscomments
quarterwave··on Writing a Phase-locked Loop in Straight C
For anyone interested, here's the essence of a phase-locked loop:

Say you're climbing up a long staircase and the step height increases suddenly - then you'll bump into the next step. If the height were to go the other way i.e; decrease, then you'll put your foot down hard trying to place the next step. That change in step height is in fact a change in frequency, and you're forced to adjust your pace abruptly by adjusting the timing (phase) of your subsequent steps.

Is there a 'gentler' way to adjust the phase? Now say you're wearing some kind of spongy sandals that can take up the slack, so at every step you increasingly sense that the frequency has changed. This accumulation indicates that phase is mathematically the integral of instantaneous frequency with respect to time.

We now put this integral in a feedback loop. Then, if the staircase step height changes suddenly we use the slow accumulated phase to produce an error signal that gradually drives the frequency generator (in this case, our brain) to adjust the pace of our step till we get in lock-step.

The actual dynamics is more complicated, involving a non-linear frequency capture (which linearizes the system) and then the slower phase lock. You can see this in the waveforms in the original post.

quarterwave··on World's Simplest Electric Train [video]
Nice demo! Quick back of the envelope calculation for the current to overcome dynamic friction:

I = mu_friction * Mass * grav_acc / (Turns_per_length * Area * Br_magnet)

Say Mass=0.1kg, coil at 600 turns per metre, hand-wave mu_friction=0.2, and a rare-earth retention Br=1Tesla, gives a current of 3A. Maybe more to chug along, would deplete a 2000mAh battery in about 30 minutes. Wire looks about 20 AWG, should get quite hot.

quarterwave··on Principles of Rich Web Applications
You're right, and your explanation helped me understand the article better when I read it again. Thanks.
quarterwave··on Principles of Rich Web Applications
For real-time updates in response to user actions, which is a bigger concern: average latency, or its variance?

Example: Server generates a sine wave which gets displayed as a rolling chart waveform on the client. As client spins a knob to control the amplitude, the server-generated stream should change (sine wave is a trivial example, representative of more complex server-side computation).

quarterwave··on Parallax Propeller 1 P8X32A Released as Open Source Design
I once used the Basic Stamp in a product prototype - a fairly sophisticated piece of instrumentation. I initially chose the Basic Stamp (iirc it had a Ubicom chip) for its totally rock solid RS-232. Eventually I realized that the Basic Stamp was enabling me to write firmware for a reasonably complex "real time" control system. Over thousands of cycles of tests on a limited production run I never had a single glitch or problem with the firmware.
quarterwave··on Calculus with pics and gifs
One way to understand limits is compound interest. Start with a dollar, compound 100% in year to get $2. Halving the interest rate and compounding twice gives $2.25. The "limit" of this less-interest-more-often process, ad infinitum, is e (2.718...). This introduces both infinitesimal and infinite.
quarterwave··on The Unreasonable Effectiveness of Mathematics in the Natural Sciences (1960)
I first encountered this wonderful quote in the foreword to one of the editions of the Feynman Lectures, the foreword in this case being written by an awesome physics professor in my college (V.Balakrishnan a.k.a Balki): "... the combination of physics and mathematics in the Feynman Lectures surely embodies in an exemplary manner what has been called 'the unreasonable effectiveness of mathematics in the physical sciences' (Wigner)"

Balki also introduced us to the mythical student HAROLD - Hypothetical Alert Reader Of Limitless Dedication, whom he had encountered in Schwinger's lectures.

quarterwave··on A Comparison of Image Hashing Libraries
Is an image hash a very different beast from the hashing function used in passwords etc? In the latter we want large sensitivity to small changes, while in an image hash we want a measure sensitive to similarities.

Naively I'd expect image hashing to be like cross-correlation (non-linear) while password hashing can be done with shifts and modulo-2 (linear).

quarterwave··on The Fourier Transform, explained in one sentence
Saw this after posting my comment. I agree this is the simplest way to think of an FFT.
quarterwave··on The Fourier Transform, explained in one sentence
Think of FFT like music notation - a separation into notes, dynamics, and tempo.

Alexander Graham Bell came up with the idea of increasing the capacity of telegraph lines by combining several 'dit-da-dit' streams at different pitches. He called it a 'harmonic telegraph'. The idea was that a mechanical arrangement of reeds tuned to different pitches would pluck out each stream of data. This insight eventually led to the invention of the telephone.

Finally, if 'orthogonal basis set' is difficult to understand, think of giving someone 'left/right' driving directions. An FFT would then (roughly) be the mathematical equivalent of 'driving directions' for a clip of music or speech.

quarterwave··on Acoustics and Vibration Animations
This is superb stuff, e.g; phase change at hard/soft boundaries is explained nicely. EE's may recognize the conformal map leading to the Smith chart; since EM waves are E+M we can have both 'open-circuit' and 'short-circuit' hard boundaries (duals of each other).

The section on reverberation reminds me of Dr.Cooper at the cinema, conducting impulse response tests.

quarterwave··on A Math Model Is Predicting the Ebola Outbreak
Course is classroom format. i will post the assignment on github.
quarterwave··on A Math Model Is Predicting the Ebola Outbreak
Well put.

A 'predictive model' should say 'if you do X then you will end up with Y' - and the X cannot be adjusting some number. The X has to be stuff like 'building ETU's in West Africa', or 'canceling all flights',... A predictive model should be able to say 'don't bother canceling flights, it's no use - instead do this...'.

Note: I'm going to be teaching a course in Erlang programming next month where the homework assignment is epidemic modeling - 100K's of concurrent processes moving around, getting exposed to each other - that sort of stuff. Rather ambitious, but I feel it's a good use case for Erlang - a pandemic is a 'viral' chat application.

quarterwave··on Beethoven transformed music, but has veneration of him stifled his successors?
In south Indian classical (Carnatic) music the greatest modern composer is Tyagaraja (1767-1847), who interestingly was a contemporary of Beethoven. Tyagaraja was prolific in a form of composition called a kriti, at once both structured as well as intense.

The kriti eventually led to the modern Carnatic concert format, in the early twentieth century. Where concerts once used to be night-long expositions of virtuosity in rural temple festivals, the modern concert became a brisk 2 hour affair that catered to urban schedules. A couple of 'heavy' abstract pieces, then a few kritis serving as anchor, rounded off with several light blitz pieces (usually scorned by the cognoscenti).

quarterwave··on The 2014 Nobel Prize in Physics
One person who should also have got the Nobel prize for pioneering work on III-V LED's is Nick Holonyak.

http://en.wikipedia.org/wiki/Nick_Holonyak

quarterwave··on The Mathematics of Ebola Trigger Stark Warnings
I searched for R_0 data on flu pandemics and found this:

http://www.ecdc.europa.eu/en/healthtopics/documents/0905_pan...

Note the sharp jump as R_0 goes from sub-2 to over-2, which should not be surprising (hand wave about branch processes, light of a thousand suns, etc).

Over to someone better qualified to comment - is the present situation with Ebola taking us into a pandemic territory similar to 1918 H1N1?

quarterwave··on Wifi: “beamforming” only begins to describe it
Anyone dealing with antennas and noise should read the classic 1946 paper by Dicke: http://www.eng.yale.edu/rslab/internal/Papers/dickepaper.pdf

tl, dr: One puzzler is that antenna radiation is frequency dependent, while that of Johnson noise in the microwave regime is flat with frequency. Then, considering detailed balance, how does an antenna matched to a terminated coax cable establish thermal equilibrium with space? What happens is that the 1/f^2 of the antenna pattern is cancelled by the f^2 (in the long-wavelength regime) of the Rayleigh-Jeans blackbody radiation formula.

quarterwave··on Feds Threatened to Fine Yahoo $250K Daily for Not Complying with NSA's PRISM
Tony: Umm... Control?

Control: Yes, Tony?

Tony: If I may ask, how did you determine this sum of a 150,000 pounds a day?

Control: A very good question, Tony. You see, I simply took the figure that our American cousins have calculated using a supercomputer, and converted the currency.

Tony: That's very clever of you, Control.

Control: Thank you, Tony. It proves that what we lack by way of resources we make up for with good old British ingenuity.

quarterwave··on The terrifying mathematics of Ebola
http://en.wikipedia.org/wiki/1918_flu_pandemic

mentions two theories why the 1918 flu pandemic ended (see section 'End of the pandemic').

I'm trying to understand the mutation theory. How come there is no 'watchmaker' situation here? Is it because a virus is simple enough that its replication is directly driven by thermodynamics, as opposed to more 'organized' forms of exploring the configuration space?

quarterwave··on Falling in Love with the Dark
Thanks for posting this link, I now begin to understand what Shakespeare meant by 'spangled starlight sheen' [A Midsummer Night's Dream].
quarterwave··on Gravity Simulator
Looks like a binary star, similar to the two suns of Tatooine.

http://en.wikipedia.org/wiki/Binary_star#mediaviewer/File:Or...

OP: This is an amazing tool to learn the sensitivity of dynamical systems to initial conditions. Well done!

quarterwave··on Reverse engineering a counterfeit 7805 voltage regulator
This is a beautiful post, and I am reluctant to try and say anything profound. Still, all of HN's a stage so I'll attempt a brief explanation for the general reader about why we need voltage regulators.

A logic chip like a microprocessor is designed for a particular supply voltage, if this voltage drops too much the logic circuitry will switch falsely. Say we had only a capacitor and we tried to power the logic chip with it. As the chip draws current the capacitor discharges - this is because current is movement of charge, so the charge (and energy) can come only by draining the capacitor. For an ideal capacitor the voltage is directly proportional to the charge across it, so as the charge drains the voltage falls. To hold the voltage constant we need to keep 'topping up' the capacitor with charge. This is what a voltage regulator does - it uses a negative feedback loop to sense the capacitor voltage and when that voltage falls the circuit provides just the right amount of charge 'juice' for the top-up.

As we take the foot off the clutch pedal in a car, the load gets engaged to the engine and if we sense a stall we press the gas pedal a bit. That's the imagery of a voltage regulator in action.

The capacitor plays a key role because the regulator feedback loop isn't very fast - one trouble with fast feedback circuits is chatter, or responding to every blip. Negative feedback circuits are designed to be more like ship wheels - they like to steer sedately and not respond to every excited cry from the mast. But what happens if a current blip arises because a logic circuit block turns on all at once (in response to some block of code)? That local current blip is provided by the capacitor, it acts like an ATM to provide local draws - but it still depends on the regulator to top it up.

In fact you can think of a battery as a capacitor that tops itself up via electrochemistry, it works as long as there are ions in the electrolyte. If instead of 'bandgap energy' we used the chemist's terminology of 'electrochemical potential difference', then the system similarity becomes evident.

quarterwave··on Why Flunking Exams Is Actually a Good Thing
Years ago in college, for the toughest course I'd carefully pick an advanced textbook - something one or two levels ahead of the current one - and soak myself in that. Example: for an introductory quantum mechanics course I read Dirac's book, then supplemented this with Russian problem books - they were the best & came with answer gists. I would freely look up answers for the tough problems, then go back and see if I could come up with a better way. After this regimen, the course itself became a minor formality.

I realized only much later that this was an obsessive approach, like buying chess books after losing early in one's first tournament. There was no sense of carpe diem, it was about owlishly building up a 10:1 advantage before closing in.

quarterwave··on Essential Coding Theory
Clearly not a book for the ordinary reader. For me the transition from Sec.1.1 to Sec.1.2 was akin to starting with a quiet walk in the park, and then suddenly finding oneself clinging to a rock face as a cloud of chalk dust drifts down from the climbers up ahead....
quarterwave··on What's a Mathematician to do?
In my humble opinion, the key is to judge oneself accurately. Or get someone to do so.

Ramanujan wrote to Hardy: "I am already a half starving man. To preserve my brains I want food and this is my first consideration. Any sympathetic letter from you will be helpful to me here to get a scholarship either from the university of from the government."

Returning to our world, a tenured university position could provide stability, while a contractual appointment to teach Linear Algebra I & II might end next year - and a journey by stagecoach to the next temporary appointment. In such a situation it may be simpler to write code for a living, while one 'dreamed a dream' on weekends.

The way it normally works, one figures out these answers during the M.A level itself. The trouble starts if one does not & keeps plodding on.

I apologize if this sounds dull & dreary, but I recently gave this advice to a nephew who wanted to study maths after an undergrad degree - he is now safely writing code for a salary & his parents are relieved. Have I stymied the next Ramanujan, perhaps out of a sense of sour grapes at my own inability to prove the Riemann Hypothesis? Both are possible, but unlikely.

quarterwave··on Physicists Take Low-Light Images Using Less Than One Photon per Pixel
"Photon number is conjugate to phase' - I'd like to understand that better, is it the same as saying photon counting destroys phase information? Would it also hold true for gated counting?
quarterwave··on Fourier Image Filtering
Is 'frequency' 1d or 2d? Also, gain transfer function looks like a spline, why not try an FIR?

It would cool to add a few images with periodicity. I expected the lake bed image to show some quasi-periodic lines, but couldn't make that out in the spectrum.

quarterwave··on Myths About Working as an Engineer at a Startup
Well written, tallies with my start-up experiences.
quarterwave··on Richard Attenborough dies aged 90
Albert Einstein said of Mahatma Gandhi: "Generations to come, it may well be, will scarce believe that such a man as this one ever in flesh and blood walked upon this Earth."

When we were in school our class was taken to see the film "Gandhi". Our usually noisy class sat stunned throughout. Thanks to Attenborough the hope of Einstein came true.

quarterwave··on Is The Speed of Light Everywhere the Same?
Very good question. Here's the gist of it, a rough way of thinking about it.

A time varying electromagnetic field is produced by moving charges (except for a minor distinction about steady currents). The direction of motion of the charges determines the polarization of the emitted field. Later on, when the field encounters matter it produces an identical motion of charges i.e; if originally an East-West charge motion produced a North-South field then a N-S field will induce an E-W motion among new charges which in turn re-emit N-S light. The original light and the re-emitted light interfere, the delay is what slows the light down, as noted by others. But you can see why the direction is the same.

Note: I suppose this picture is somehow tied to reciprocity of the Maxwell equations between sources and fields, I need to go look it up again.

← PreviousPage 2 of 5Next →