Pages

Monday, December 23, 2019

Yabba-dabba-doo!

Coming back to Michigan means going to the gym again! I'm always interested in the energy measurements given by the machines – Calories are a unit of energy, but with a capital "C", they're actually kilocalories, with a lowercase "c". Here's a 30-minute workout on the elliptical:

This says I burned 268 Calories to go 2.43 miles, or 0.009 miles/Calorie.

A few years ago, my parents got the all-electric Chevy Bolt, which also shows the energy used to go a distance, and so I was curious to see how I stack up to their car in terms of efficiency. I asked Sally to send me a photo of one of the status screens:

The number we're interested in is the 3.0 miles/kilowatt-hour. Kilowatt-hour is another unusual measurement of energy, since Watts are energy per time (specifically Joules per second) which we multiply by a time to get back to energy.

To compare these two, we can convert the units to match: 0.009 miles/Calorie = 7.74 miles/kWh, meaning running on an elliptical is 2.58 times as efficient as a modern electric car! You might be thinking a new charging method is in order...
Giphy

...unfortunately, the energy demands of hauling a car around are a bit higher than your own body, as shown by another status screen:

The total energy of 22.4 kWh comes to almost 20,000 Calories, which I don't think is in the range of many humans!

Sunday, December 8, 2019

Rum Pum Pum

[Title from a favorite book of my childhood.]

I've been thinking about all the great things I'll soon be doing in Michigan again, and I was reminded of something that's been on my list for a while. One of the classes offered at the gym Marika and I went to was Cardio Drumming. The "drums" used in these classes are yoga balls sitting on large plastic buckets, and I often wondered about how the vibrations from the drumsticks travel through the spherical balls.

This is an example of the wave equation, which applies to many systems where neighboring points (in this case, parts of the rubber surface) interact with each other. If we just consider a cross-section of the ball, we can use the 1-dimensional version of the equation:

What this says is that the rate of change of the height of the wave in time is related to how much the height is changing in space. I decided to implement a version of this in Python, but then I realized it would make a great HTML5 doodad!

The controls below let you change the properties of the ball and how you interact with it. Stiffness controls how much of each point's amplitude gets transferred to its neighbors (the c^2 above). Using 0 or 1 can cause some bad (but interesting) things to happen. Strike amplitude is how hard you hit the top of the drum every time you press Strike. Again, setting it too high may cause issues. The bucket provides a wall that the vibrations can bounce off of. If you suddenly increase the bucket size, you can trap waves inside. Damping makes the waves die off over time. Due to a bug somewhere, you have to press Reset when you first load this page, but things should work ok after that. Have fun!


Canvas not supported; please update your browser.

Stiffness

Strike Amplitude

Bucket Size

Damping

Sunday, December 1, 2019

Hysterainy

I've been enduring a lot of rain lately, both in Italy, and now back in Annecy. I'm always frustrated by intermittent rain, since I have to wonder whether it's worthwhile to open/close my umbrella when the rain starts/stops. Whenever I start thinking about it, I'm reminded of the idea of magnetic hysteresis. This is the tendency of magnetic systems to "remember" the state they were in earlier, even when outside conditions change.

The classic model system for this is the Ising model, which I discussed in an earlier post. The difference here is that we vary the external field and see how the system's internal field reacts. The typical plot looks like this:
Based on Wikipedia
On the x-axis is the applied external field (how much it's raining), and on the y-axis is the field within the system (how likely I am to have my umbrella open). Starting in the center, with both fields zero, we slowly increase the external field, which brings the system along with it. When we decrease the field though, the system lags behind, still giving a positive field when the external one is negative, just like keeping my umbrella up while it's not raining.

I decided to adapt my previous Ising script to try to demonstrate this effect, and I was surprised by my success: Hysteresis.py


On the left is the grid of magnetic spins, which interact with their neighbors and the external field. On the right is a plot of the external field vs the average field of the spins. Aside from the weird jiggling frame I couldn't get rid of, it matches the model above pretty well!

Marika and I are packing things up to return to the States in a couple weeks, so I may miss posting.

Tuesday, November 19, 2019

Cents and Cents-Ability

A late post this week, since I'm currently traveling in Italy with my parents! Going between EU countries and using cash more often than usual has reminded me of how inept I feel making change in euros after 30 years of using the US denominations. I thought I'd take a look at the relationship between the different coin/bill values and the ways to get a certain amount of money.

Here are the US denominations less than $5 (not including $1):
Wikipedia
And the EU denominations less than 5€:
Wikipedia

We're looking for ways to get a total value using some number of each of these coins. We can write this as an equation, for example
where p, n, d, q, and D are the numbers of pennies, nickels, dimes, quarters, and dollars. Since we no longer cut coins to make change, all these values must be integers, which makes this a Diophantine equation. These can be difficult to solve; the Python package SymPy has tools for it, but I couldn't find a way to restrict it to only positive integers (handling anti-pennies is far too dangerous). I was able to make my own though, which uses a simple brute-force technique.

Since it slows down exponentially as the total value gets larger, I was only able to run it for values up to 4 dollars/euros. The results are still interesting though. Here's the minimum number of coins needed to make a total:

As each larger denomination becomes available, there's a sudden drop in the number of coins needed. Since euros include many more denominations, they're able to use fewer.

We won't always get the minimum in change though, so it's useful to look at the different ways to make a value, and find out what the average number of coins is:
These are going to include many sets with mostly pennies though, so we can also look at the median:
At the very beginning of each of these, you can see there are a few cases where the US uses more coins, probably due to the euro having a 2 cent coin, but in the end, more denominations means more coins on average.

There are many things I'll need to unlearn when I return to the US next month (like saying "merci" instead of "thanks"), but since I never really got the hang of euros I suppose making change won't be one of them.

Saturday, November 9, 2019

A Bolt of Cloth

The past couple weeks here have been non-stop drizzling rain – not the nicest farewell I could have – but it reminded me of a post from another of my favorite blogs, Futility Closet.

Wikipedia
Shortly after Benjamin Franklin created the first lightning rod, the idea caught on in Europe as a fashion accessory. There were umbrellas fitted with lightning rods (above), as well as hats, which trailed a wire for grounding. The information on these is a bit sparse, in particular whether they had ever been tested. This concerned me, since I saw some potential problems with the design, which I thought I'd explore today.

First, a quick explanation of how lightning rods work: During thunderstorms, charge collects in clouds. If enough charge builds up, it can overcome the resistance in the air, and create a channel down to the ground, where it discharges. This is lightning, which can carry lots of charge at high speed. Electricity takes the path of least resistance, and since humans and animals carry a lot of salty water, that makes us appealing routes to the ground. Tall buildings can also make good conductors, but since lightning carries so much energy, it can start fires. To protect ourselves, and our homes, we can make even better channels by topping buildings with a metal rod that connects directly to the Earth through a wire. Based on this, the lightning rod apparel doesn't seem unreasonable, but let's look at some issues.

Ground Current
For real lightning rods, the grounding wire is buried several feet deep to better distribute the charge, but that wouldn't be possible with a rod you carry with you. Instead, the wire just drags behind you, but that's no different from lightning striking the ground near you. Lightning carries a lot of charge, and it takes some space to dissipate, which can be just as dangerous as the initial strike. The National Weather Service webpage illustrates this with a charmingly-90s, yet still horrifying, animated GIF:


According to the Washington Post, ground current can be dangerous as far as 60 feet from the initial strike, so you'd need an awfully long tail on your umbrella/hat, not to mention the danger to anyone else who happens to be near the contact point.

Melting Wire
Since these are fashion accessories we're talking about, the Wikipedia article above mentions that the grounding wire was silver, but that could get expensive. One site I found lists the gauge for a grounding wire as 2 AWG, or about a quarter inch. There's also the problem that silver has a lower melting point than copper, 961.78 °C. That made me curious whether you'd be trading electrocution for being sprayed with molten silver.

The energy absorbed by the wire will be
where I is the current, 𝜌 is silver's resistivity, l is the length of the wire, A its area, and t is the duration of the strike. Using those values, along with a normal (rather than rope-sized) silver chain, and a height of 1.8 meters, I come up with 195 Joules, which is nowhere near enough to melt even a thin chain.

Magnetic Field
So at this point, you're still dead from the ground current, but your relatives will be able to salvage your silver chain. What about your smartphone? When current flows through a wire, it produces a magnetic field, according to

I couldn't find info for smartphones, but according to this site, credit cards could be damaged at a distance of 63 centimeters, and pacemakers at 25 meters! I'm not sure whether the short duration of the bolt would change these calculations, but it still doesn't seem like you or your electronics would be safe in a thunderstorm, even if you are wearing the height of 18th century fashion.

Big thanks to Futility Closet for pointing out this fleeting trend! I'm sure we would never use new technology in such a frivolous way, right?

Sunday, November 3, 2019

Riding a Charger

In high school, I got interested in electronics tinkering through the blog Hack-a-Day. I haven't done much myself for many years, but I still read the blog, and last week there was a post that seemed ripe for physics analysis:

The setup is that each player has a button they can press and release. While the button is pushed, a capacitor is charged by a voltage source, and when it's released, the capacitor switches to power a motor that drives the horse. You can see the full plans here, but this is a simplified version of the circuit:
Made using www.circuit-diagram.org
In the state shown above, the voltage source (V) begins to charge the capacitor (C). At first, this would act like a short circuit, so we add a resistor (R) to limit the current flow. For this type of circuit, the charge on the capacitor is given by
The voltage over a capacitor is proportional to the charge stored in it, so as the capacitor charges up, it pushes back more and more on the voltage source, which slows the charge that's added. That leads to an asymptotic behavior:


When the button is released, the switch in the diagram above flips to the other side of the circuit, and the capacitor begins discharging through the motor. This acts like a resistor, but converts the charge flowing through it to motion, driving the horse. Once again, we have an asymptotic relationship, since as the charge flows out of the capacitor, it can't push as strongly:
Here, Q0 is the amount of charge we put on in the first step. This is similar to the plot above, but decaying to zero:


This made me curious if I could come up with the optimal strategy for getting the horse to the end as quickly as possible. That translates into the most charge in the least amount of time, or the maximum current. If we ignore the initial charge up, we can think of switching between some maximum and minimum charge:
The average current through the motor over one cycle is
where tC and tD are the charge and discharge times. The expressions for those are a bit ugly, so I won't write them out here. Rather than try to get the exact maximum current, we can try a variety of values for Qmin/max:
The best option appears to be keeping the capacitor at ~50% charge by rapidly flipping the switch between the two states. As with many games, the answer lies in hyperactivity!

Saturday, October 26, 2019

In France It's "Quantum Royale"

Earlier this week, Google announced it had achieved "quantum supremacy", so I thought I'd discuss a bit about what quantum computing is, and what Google managed to do.

In classical computers, like the one I'm writing this on, information is stored in bits, which have a value of either 0 or 1. These bits can be combined in different ways to perform calculations. The time it takes to do a calculation depends on the number of steps, which in turn depends on the number of bits.

Quantum computers have quantum bits, or qubits, which represent entangled particles. That means the states of different qubits can depend on each other, and they can (temporarily) take on values between 0 and 1, representing a superposition of the two. This can be exploited to perform calculations exponentially faster than a classical computer could.

One of the exemplary problems where quantum computers are useful is prime factorization. This is the problem of finding all the prime numbers that divide a given number, which you can imagine as a tree:
Factoring 24 into 3x2x2x2
Typically, this is done by trying each possible factor, until we find one that divides the number, and then repeating for the results. In essence, quantum computing lets us try all the possibilities at once, and only keep the ones that work. The actual algorithm is a bit more complicated, but we're just skimming the concept here.

Why should we care about factoring numbers? Current encryption algorithms are based on the product of two large primes. You share the product, which others can use to encrypt a message for you, but the only way to decrypt it is to use the individual factors, which you keep secret. With quantum computers though, anyone can factor the product you gave them, and read your messages.

Google published a paper in the prestigious journal Nature claiming to have reached "quantum supremacy" (the originator of the phrase now regrets choosing it). The trouble with quantum systems is that they're fragile – Any disturbance from outside the system will affect the states of the qubits, invalidating the calculation. This risk increases with the number of qubits, so the question becomes, can we maintain the integrity of a system with enough qubits to be useful?

Quantum supremacy refers to the point where we can build quantum computers with the necessary number of qubits to do calculations that are impossible on classical computers. Google claims to have reached that point, with their 53-qubit Sycamore computer. They solved a problem in 200 seconds that they say would take a classical computer 10,000 years. IBM disputes this calculation, claiming that the classical computer would only take a few days.

It remains to be seen who is right, but it's still cool to see a project with such world-changing potential coming into being.

Saturday, October 19, 2019

A Singular Family

This week, I got some great questions from my nephew Ezra, along with his parents Nate and Carrie. I gave them some quick answers off the top of my head, but I thought they deserved a more in-depth treatment as well.

Ezra: What does a gravity wave feel like [to a person]?
As a reminder, gravitational waves warp space as they pass. If a wave passed through the center of a hula-hoop, it might look like this:
Each image is a point in time. Adapted from my thesis.

Gravitational waves are incredibly weak, which is why we need 2.5 miles of detector to pick them up. They’re a squeezing and stretching of space, so if you could feel them, they’d be a combination of a hug (awww) and a medieval rack (ahhh!). Some of the early detectors were big pieces of tuned metal that scientists hoped would ring like a xylophone if the correct frequency passed by. Those were never sensitive enough though.


Nate: But aren't they weak because they're distant? What if you were closer to a pair of black holes approaching collision? Could you be close enough to feel the waves but far enough to not be inside?
Good point! We can take the first LIGO detection, GW150914, as an example. According to that paper, the distance was about 410 megaparsecs, and the peak strain was 10^-21. Strain is the fraction by which the wave changes distances, so a meter stick would be stretched and squeezed by 1/1000000000000000000000 meter! That's pretty tiny, but strain drops off as 1/distance, so we can get a bigger effect closer to the collision. We probably don't want to be inside the event horizon of the final black hole, which has a radius of
Plugging in the 62 solar masses from the paper, we get 183 km. Supposing a 6 ft person observed the collision from 200 km away then, their height would change by a little over 4.5 inches!

Carrie: Is a black hole a hole in space-time or a depression?
It's both! -ish. This is a difficult question to answer, since the whole point of a black hole is that we don't know what's going on inside it. The trouble is that when a star collapses into a black hole, it creates a singularity – a point of infinite density. That creates a lot of problems for General Relativity, since things falling into the singularity could wind up going faster than light, and other bad things that happen when you have an infinite quantity. Instead, we put an event horizon around the singularity at the point where light can no longer escape from it, which is usually where bad stuff starts. Wikipedia has some nice representations of a singularity with and without an event horizon (bad stuff not included):
Black hole, via Wikimedia Commons
Naked singularity, via Wikimedia Commons
Thanks for some great questions!

Saturday, October 12, 2019

Countertop Charybdis

Last weekend, I was making another batch of my friend Jean's dosa recipe, and I started thinking about the whirlpool in my blender:
Water, not batter, so it's easier to see

I was curious if I could figure out the shape of the well, and how it depended on the speed and ingredients.

The basic idea is that we have water molecules with some angular momentum, rising to some height h based on the distance from the center, r. If we ignore drag/viscosity, we can just set the rotational energy equal to the gravitational energy:
where ω is the angular velocity, and m is the mass. Solving for h gives
This has a parabolic cross-section, which is characteristic of a rotational vortex, according to Wikipedia.

Really though, there's some drag on the liquid: It's moving quickly in the center, where the blades are, but at the walls it has to slow down. I looked at the models for viscosity of liquids, and I was hopeful I could find a way to apply it here:
F is the force between one sheet of liquid and the next, 𝜇 is a constant that depends on the liquid, A is the area of the liquid, and v is its rotational speed. In our case we can write
I was hoping I could solve this, with an input velocity at the center, and an output velocity at the outside, but I'm not sure what to do with the time derivative. Looking at the photo up there, I'm inclined to say a parabola is good enough, unless one of you readers can suggest a way to solve this!

Saturday, October 5, 2019

Pump and Circumstance

My parents are in the process of installing a set of heat pumps in my childhood home, so they don't have to rely on the old wood stove, which requires buying, stacking, and splitting large quantities of lumber every year. I was interested to learn more about these real-world pumps, since physicists are introduced to the idea of heat pumps and heat engines in any intro thermodynamics class.

The idea with both these devices is that we have some working gas that we move to different levels of temperature (T), pressure (p), volume (V), and entropy (S). The reservoir where we keep this gas is attached to a piston/shaft. The piston controls the pressure and volume, and we can either turn the shaft to create a temperature difference (heat pump), or apply a temperature difference to make the shaft turn (heat engine).

Usually these different stages the pump goes through are shown on a p-V diagram, which shows the relationship between pressure and volume at each step. Here's a simple example:
The steps are

  1. At a low, constant pressure, expand the gas to a larger volume
  2. Keeping that volume fixed, increase the pressure to a high value
  3. Decrease the volume again, but at the new pressure
  4. Bring the pressure back to the start, at the original volume
The reason physicists like to represent this in terms of pressure and volume is that it's easy to find the energy:
This says that the energy produced by the system is equal to the area under each curve in the plot above. This is where the arrows come in: pointing to the right means the volume is increasing, and dV is positive, while to the left is negative. How does this relate to temperature though? If we're using an ideal gas (air is close), then these factors are related by
so in the plot above, the upper right corner will be the hottest, while the lower left will be the coolest. Since the arrows are to the left at the higher pressure, we put in more energy than we get out, and this is a heat pump that will make that temperature difference.

What's really interesting about heat pumps is their efficiency: The amount of energy you get out (through heating/cooling), divided by the energy you put in (turning the shaft). In the case of an old fashioned electric heater, you run current through a big piece of metal, which heats up, converting 100% of the input energy into heat. It seems odd that you could do better than 100%, but heat pumps manage it.

The key is that we use ambient energy, which doesn't count against our input. In my parents' case, the pump is taking energy from the cold outside, and moving it to the warm inside, so the efficiency is
where Q is the energy exchanged with each location.

When physicists talk about efficiency, we like to bring in the Carnot cycle, which is the theoretical maximum efficiency. The p-V diagram for this case is a bit funny looking:
For this type of pump, we can replace the energy in the efficiency equation with the indoor and outdoor temperatures, in Kelvin. According to Steve's last NOAA report in 2012, the lowest recorded temperature in Ashfield was 249 K. For an indoor temperature of 293 K (brisk for my taste, but I'm sure he would prefer cooler), the efficiency comes to 666%! Clearly these heat pumps are the work of the devil...

Saturday, September 28, 2019

Lean on Me

For some reason, my bus the past week has been especially full, forcing me to stand for most of my commute. I'm always surprised by how difficult it is to keep my balance going around curves, so I thought I'd try putting some hard numbers to the issue.

I've talked about the strange, non-inertial effects of being in a turning vehicle before, but this situation is much simpler. When the bus goes around a turn, it drags my feet along with a centripetal acceleration. Balance is all about keeping the total forces on you over your feet:
Here, ar is the centripetal acceleration of the bus, and g is the acceleration from gravity. Using geometry,
When something moves in a circle with radius r and velocity v, the centripetal acceleration is
Putting these together and solving for v gives
The turning radius for a standard city bus is about 21.5 feet, and the maximum angle a person can lean is around 15°. Putting these together gives a speed of just 9 mph! As a non-driver, I don't really have a feel for typical turning speeds, but the National Association of City Transportation Officials suggest a maximum of 15 mph, so our limit is well below this. Of course, when you're riding a bus you can lean into the curve, and hold on to the railings, neither of which we've accounted for here. Still, I feel a little justified in lurching around awkwardly during my commute.

Saturday, September 21, 2019

Harry Nyquist the Scientist (Harry! Harry! Harry!)

Ok, doesn't quite scan, so I guess he's not destined for TV stardom, but one of his ideas is at the core of this week's post. Last week, I was talking to my parents over Facetime and Steve, ever the stickler for visual quality, complained that my lights appeared to be flickering:


Looking at it from my end though, the light appeared fine. I realized that the LED bulb must be flickering (by design) at a rate higher than my eyes can perceive, but my laptop camera is recording below the Nyquist rate, causing the flickers to appear.

Before getting into that, let's talk about how LED bulbs work. LEDs require direct current (DC), while house power is alternating current (AC), so the first thing we need to do is convert between these two. Alternating current is a sinusoid, oscillating between positive and negative of a certain value:
There's an electrical component called a diode that only allows current to flow in one direction. In fact, that's the D in LED, but right now we're just talking about the regular kind of diode, not the Light Emitting ones. By arranging a few of those in a clever way, we can switch the negative part of that curve to positive:
Made with circuit-diagram.org
On the left is the AC source, and on the right is a voltmeter. The diodes in the middle only allow current to flow in the direction of the arrow. The voltmeter's output looks something like this:
This isn't ideal though, since the voltage is going all the way down to zero. We need a way to smooth out this curve. We can do that by adding a capacitor, which stores and releases charge as the voltage changes:
Now the voltage looks something like this:
Still not perfect, but it's the best we can do with something simple. Those little bumps mean the LEDs will be flickering a tiny bit, but it's at twice the rate of the original AC input. In France, this is 2x50 times per second (Hz).

The camera on my laptop captures video at about 30 frames per second. According to Nyquist, to accurately record a signal, we need to take data at twice the rate that the data changes, but that would be 200 Hz, far above what my camera is capable of. We can see why this is necessary by considering a point moving in a counter-clockwise circle:
The dot completes a cycle every 8 steps. The image on the left is sampled every step, while the one on the right is sampled every 7 steps. The slower sample rate causes the dot to appear to be moving backwards. You've probably seen a similar effect in videos which include old TVs or computers that used CRT screens. The screen appears to blink because the camera captures the screen at different points in its refresh.

That leaves us with the question of why the light doesn't blink according to our eyes. That's addressed by the flicker fusion threshold, which comes from the spectacularly-named field of psychophysics. Our eyes aren't able to perceive changes in intensity above a certain rate, instead averaging things out. For most people, it's around 80 Hz, so the LEDs easily surpass that, but the captured video is nowhere close.

Thanks for a great question/complaint Steve!