Showing posts with label analytical projects. Show all posts
Showing posts with label analytical projects. Show all posts

Tuesday, January 27, 2026

AutoArt folder distribution

 kw: analytical projects, art generation, ai art, statistics, statistical distributions, lognormal, scale free

I began using art generating software in November 2022, when DALL-E2 became available. Since then, I've enjoyed having a series of art generating "engines" available, including numerous engines (called "models") in the aggregators Leonardo AI and OpenArt. As often as I can, I generate images for this blog; in some cases, I download images I find on the Internet. However, my primary artistic pastime is creating images of things and scenes I imagine.

Just in the past few days I was inspired by a heavy snowfall to find short poems about snow, and use them to create wintry images. This image was drawn by Nano Banana Pro, under the Leonardo AI umbrella with "None" as the style; that is, native NB Pro. The aspect ratio was set to 16:9. It displays the entire poem, something NB Pro can do better than any other art engine I have found. The prompt was "Watercolor painting evoked by a poem:", followed by the text of the poem "The First Snow" by Charlotte Zolotow.


The image is particularly evocative in shifting to an exterior view as the window dissolves. I suspect there are a number of images that use this device in the training material for NB Pro.

When I made signed versions of this and several others that were generated in the same session, to be included in a folder for a "screen saver" slide show, I began thinking about the various numbers of different image types I've created in the past three-plus years. Last year I went through my (poorly organized) folder stack of "AutoArt" and reorganized it into 35 categories, each in its own folder. To date, there are 1,472 signed images in 35 folders containing between two and 405 images. My inner statistician began to stir…

The image below shows two analyses of the statistical distribution of the numbers of files in these folders.

Charts like these make it quite evident which statistical treatment is appropriate to a particular set of data. I'll explain what these charts mean and how they were created.

"Scale Free" is a type of power law distribution related to the Pareto distribution. It is easy to analyze, which makes it popular. To analyze a series of numbers graphically in Microsoft Excel:

  • Enter the numbers in column B, starting in cell B2.
  • Put an appropriate header in cell B1
  • Highlight these data (B1:B36 in this case)
  • Sort from largest to smallest, using the Sort & Filter section under Editing in the Ribbon.
  • Enter 1 in cell A2 and 2 in A3.
  • Put a header in cell A1; I usually put "N".
  • Highlight cells A2 and A3.
  • Double-click the fill handle at the lower right of A3. This will fill the rest of the column with numbers in order, as far as the data goes in column B. In this case, we get numbers from 1 to 35.
  • Highlight these two columns to the end of data. In this case, from A1 to B36.
  • In the Ribbon, use Insert and in the Charts section, select the icon showing scattered dots with axes; this is X-Y Chart.
  • The title of the chart is whatever the header text is in B1. Edit as you wish.
  • Double-click one of the axes to open the Format dialog.
  • Click Logarithmic Scale near the bottom of the menu.
  • Click the other axis and also click Logarithmic Scale. This is now a log-log chart.

The result will be similar to the upper chart. Now for the lognormal analysis, beginning with these two columns of numbers:

  • Insert a new column between A and B; this is the new column B.
  • In cell B1 enter a header such as "Prob.". You are going to create a probability axis.
  • In cell B2 enter this formula (where the largest number in column A is 35):

=NORM.S.INV((A2-0.5)/35)

  • Double-click the fill handle at the lower right of A2 to fill the column with the formula.
  • Highlight the data in B and C (B1 to C36 in this case).
  • Use Insert as before to create an X-Y Chart.
  • Edit the chart title.
  • Note that the vertical axis is now centered above the zero. 
  • Assuming the Format dialog is still open, click the horizontal axis.
  • In the middle of the menu in the section "Vertical Axis Crosses", click the bubble at "Axis Value".
  • Enter "-3".
  • Click the vertical axis and click Logarithmic Scale. This is now a log-probability chart.
  • If you want the markers to be a different color, click one of them. The Format Data Series menu appears at the right.
  • Select the icon of a paint bucket pouring paint.
  • Click the Marker tab
  • For both Fill and Border, select the color you want.

This will be similar to the lower chart. For the data I used, the chart shows the points scattered approximately along a straight line. By contrast, in the upper chart there is a definite downward bend. In a log-log chart such a shape is diagnostic that the distribution is not scale free, but is more likely to be lognormal, or even normal (Gaussian). In this case, the second chart shows that lognormal is a good model of the data distribution.

This is an illustration of the Theory of Breakage, formally described by A.N. Kolmogoroff in 1941. When an area is divided (US state or county areas are good examples), the distribution is lognormal. When a sheet of glass is broken, the weights of the pieces also have a lognormal distribution (I've done this experiment). Some recent publications claim that a theory of breakage produces a power law distribution, but this is false. Certain phenomena in nature tend to be normally distributed. The classic example is the height of adult men, or of women (but not both) in a population, such as the residents of a particular town or county. However, most phenomena produce groups of measurements that are lognormally distributed, in which the logarithm of the quantity being measured is distributed as a normal, or Gaussian, curve.

I could go further into this, but this is enough for the purpose of this post.

Monday, November 17, 2025

Greenhouse Effect – the hidden players

 kw: analytical projects, greenhouse effect, global warming, absorption spectra, saturation

Reading a book about agriculture led me to thinking about the "hidden" greenhouse gases. I am sure almost everyone has read or heard that methane is 80 times as potent as carbon dioxide as a greenhouse gas. I recently learned that nitrous oxide (laughing gas, also a dental anesthetic) is between 250 and 300 times as potent as carbon dioxide. Both of these gases are produced by agricultural activity, so they have increased in the past 200 years as agriculture has been increasingly mechanized, and as chemical fertilizers have been used in ever-increasing amounts. (I generated this image using Leonardo AI; it is free of copyright restrictions)

I researched in several sources to find answers to these questions:

  • What were the concentrations of nitrous oxide and methane prior to the Industrial Revolution?
  • What are their concentrations now?
  • How to they affect global warming?
  • Are there other greenhouse gases we should be concerned about?

To simplify the text, I will dispense with formatting the numbers in chemical formulas as subscripts. Thus, CO2 = Carbon Dioxide, CH4 = Methane, and N2O = Nitrous Oxide (Nitrogen has several oxides; only this one is important here).

Here is the connection with agriculture: The middle-American farm belt was created by plowing the prairie and planting grain crops. Today, by far the most important crops are corn and soybeans. The thick, rich prairie soils contained a 10,000-year store of CO2, deposited by the roots of grasses and held there as they decomposed. Plowing the prairie released the CO2 at a pretty steady rate over the past century. It is still going on. Plowing also releases stored CH4.

When I lived in South Dakota in the 1970's and early 1980's, most of the agriculture in the state was cattle ranching, with some grain crops being grown in the eastern third. Since that time seed companies have developed strains of corn and soybeans that can better resist drought, begin growing at lower temperature and ripen faster. South Dakota cattle ranches are being plowed and sown with grains at a steady rate.

Secondly, overuse of nitrogen fertilizer causes much of the "extra" to be converted to N2O. Large amounts also go downstream and contribute to the Dead Zone offshore of the Mississippi Delta.

Thirdly, cattle produce a lot of methane, and the reduction in cattle numbers in the Dakotas is more than offset by continued increases elsewhere; also, plowing the prairie releases CH4, and all this is added to the amount released by fossil fuel production. I have yet to see a credible analysis of all the sources of CH4.

Yet all we ever hear about is the rise in concentration of CO2 alone. This is indeed significant, from about 280 ppm in the 1700's to about 440 ppm today. This "baseline increase" is (440-280)/280 = 0.57, a 57% increase in the past century or so. 

What of CH4 and N2O? Let us first convert them to equivalent CO2. I'll leave out a lot of words and summarize the figures:

  1. CH4 as a GHG is 80x as effective as CO2. Current CH4 concentration is 1.9 ppm; times 80 that is equivalent to 152 ppm CO2. In the 1700's, CH4 was 0.72 ppm, or CO2 equivalent (CO2eq)  of 57.6 ppm.
  2. N2O as a GHG is ~280x as effective as CO2. Current N2O concentration is 0.34 ppm; times 280 that is equivalent to 95.2 ppm CO2. In the 1700's, N2O was 0.27 ppm, or CO2eq of 75.6 ppm.

Added together, these two gases presently have CO2eq of 247. The preindustrial level was 133. Let's add these to CO2 to see the real picture of the greenhouse effect at these two times:

  • Preindustrial: 280+133 = 413 ppm CO2eq
  • Today: 440+247 = 687 ppm CO2eq
  • (687-413)/413 = 0.66, a 66% increase in CO2eq

The actual increase in CO2eq is greater than the effect of CO2 alone. Suppose we could reduce CH4 and N2O to preindustrial levels. This would subtract 114 ppm CO2eq, for 573. Then (573-413)/413 = 0.39, or 39% increase in CO2eq, compared to preindustrial. To put this in context according to the mental model held by "climate crisis" folks, for CO2 only, a 39% increase over 280 ppm would be 389 ppm. That is about where we stood in 2011; it winds back the clock sixteen years!

Let us focus a moment on N2O. By itself, increase in the concentration of this gas is responsible for about 20 ppm CO2eq, the last nine years of increase. This is nearly all due to overfertilization. Guess which industry complex is bigger and has a stronger lobby in DC than oil and gas? Agriculture plus agrichemicals (particularly fertilizer). I have read in more than one place that without artificial nitrogen-based fertilizer, the world's farmland could support no more than four billion people. It is very complex to analyze just how much fertilizer could be reduced to still support the current world population, but reduce nitrate runoff and outgassing of N2O into the atmosphere. For the moment, I just have to leave these thoughts unfinished. If we could come up with a plan, powerful interests would oppose it.

At this point in my analysis I wondered what other greenhouse gases exist, and how they might modify the picture. As it happens, nothing much. Here is a table I worked from for the figures above, which adds six greenhouse gases that, together, are sometimes written about in very scary terms, but have no practical effect at present:


First, ground level Ozone (O3) has a modest Global Warming Potential (GWP: 1.5 x CO2), and exists in the 1-10 parts per billion range, so it is not effectively a greenhouse gas. Then, the industrial chemicals Sulfur Hexafluoride (SF6) and Nitrogen Trifluoride (NF3) have very high GWP, but exist at levels of a few parts per trillion. To totally eliminate them would reduce CO2eq by much less than one percent (see the black text at the bottom of the table)

Various fluorinated refrigerants, those highlighted in brown, have very high GWP, but also exist at levels of a few parts per trillion, so together, they also amount to less than one percent (the brown text). Thus, they present no useful "targets" for ameliorating the greenhouse effect.

My aim here has been to back off a few steps to see a bigger picture. As it happens, this points a finger where none has been pointed before, at farmers. A significant proportion of the increase in CO2eq results from farm practices. In particular, far too many farmers use more fertilizer than their crops really need. There is too much of, "a little more might help." No, it doesn't, it harms. It even harms the farmer, who spends more than needed on fertilizer that isn't helping.

I have a philosophical point to end with. I think that the greenhouse effect will prove to be more beneficial than otherwise. The "father of greenhouse warming", Svante Arrhenius, thought so. Another degree or two of warming is likely to make more of Canada and Siberia amenable to crop production, and let's not forget South Africa and Argentina. On another note, I saw an article recently with a headline, "550,000 will die of extreme heat." The subhead said, "The greatest cause of early death." The article never mentioned that 4.6 million will die from cold. Nine times as many! The subhead is, quite simply, a lie, and the article is utterly one-sided deception. I suspect many of those 4.6 million would love for their home country to be a little warmer.

Tuesday, May 16, 2023

Studying tartan designs

 kw: analytical projects, plaids, tartans, statistical distributions, scale free, lognormal

Guess what this is? It isn't quite what it looks like. It's a printed plaid, a plaid-like pattern printed on white flannel, the backing for a comforter we made many years ago. Until I looked at it closely (microscopically), I thought it was a woven plaid.

Close inspection also reveals that the weave is single-over-under, rather than the over-2-under-2 of most plaid fabrics. Nonetheless, it is an attractive pattern, one of my favorites!

Some time ago I began to wonder about the distribution of stripe widths on plaids. Long ago I wrote, in GWBASIC, a "screen saver" program that produced plaid patterns on the screen. I used a scale free distribution because it is easy to program. It would generate a bunch of width values and then scramble them by sorting against a set of random numbers; it would assign colors and generate a plaid pattern.

I don't know how plaids are designed. The Scottish tartans such as Black Watch or Douglas can be centuries old, and were selected with aesthetics in mind, and an eye for being imposing because they were worn into battle. Today I suppose artistic designers pick the colors and stripe widths in a purely aesthetic way.

I decided to study the statistical distributions found in my own shirts and other fabrics. I figured out how to wrap a shirt around a dictionary to hold it on a scanner, and did so for 17 flannel shirts and two plaid jackets, plus the pattern above which I photographed because the comforter is large and very thick. I have a number of plaid summer shirts, which I may analyze in the future, but they are not included here.

The large variation in stripe widths led me to consider three model distributions: Normal, Lognormal and Scale Free or Log-Log. When graphed with appropriate coordinates, each of these is a straight line, but, for example, a Normal distribution will graph as a curved line on either Log-Log or Lognormal coordinates. First, we need to see the shapes of these distributions:

The Normal distribution is frequently called the Gaussian distribution, because it was first proposed by the mathematician Carl F. Gauss in the early 1800's. When several random variables are added and measured repeatedly, the distribution of the sum tends toward the center-weighted shape shown in orange. A mathematical proof of this additive tendency is called the Central Limit Theorem.

The Lognormal distribution results when an exponential function is taken for a set of values that have a Normal distribution. The Lognormal shape is shown in green. Also, when several random variables are multiplied and measured repeatedly, the distribution of the sum tends toward a Lognormal distribution. The logarithmic form of the Central Limit Theorem describes this tendency. Furthermore, when an area or extended object is fractured or divided into many pieces via a random process (such as dropping a pane of glass), the areas or weights of the pieces closely approximate a Lognormal distribution. I verified this once in the laboratory using a small piece of glass I broke with a light blow of a hammer, and then weighed a couple hundred pieces. The mathematical proof of this is called the Theory of Breakage, which was propounded by A.N. Kolmogoroff in 1941.

The Scale Free distribution results when a series of measurements are taken of the reciprocals of a uniform random distribution. This is also called a Fractal distribution, based on the work of Benoit Mandelbrot in the 1980's. A theoretical continuous Scale Free distribution has no limit in either direction; no largest or smallest member being predicted. Discrete sets of values that have a Scale Free distribution, however, do have a largest and smallest member. While the theoretical, continuous Normal and Lognormal distributions also have no limits, the probabilities of extreme values are vanishingly small (for a Lognormal distribution, "extreme" means either a very large positive value, or a value that is positive, but very, very close to zero).

Each distribution can be rectified (made to approximate a straight line) by sorting all the values and graphing them in order in an appropriate coordinate system. Idealized examples of these three distributions are all shown together in the three coordinate systems that are relevant to this discussion:


These charts each rectify one of the distributions. Firstly, for "Probability Coordinates", the horizontal axis has units of standard deviation and the vertical axis is linear. The sorted values in a Normal distribution (orange) follow a straight line here. Secondly, for "Log-Probability Coordinates", the horizontal axis is the same, while the vertical axis is the logarithm of the values, which straightens out the Lognormal distribution (green). Thirdly, for "Log-Log Coordinates", the horizontal axis is the logarithm of the ordinal number of the sorted values and the vertical axis is the logarithm of the values. This rectifies the Scale Free distribution (blue). Note that in each case, the "other two" distributions display a distinct curvature.

Now, for sets of more realistic distributions, created by appropriate random processes, we see the same three graphs:


The three coordinate systems are the same as those above. A straight line has been added to each graph to emphasize which set of values has been rectified.

How does all this apply to a study of plaids? I gathered data from the scans of the 20 plaids, measuring each one in both directions. This is because the warp and woof of the weave have different pitches, so the plaid designers adjust the number of threads of each color so the resulting plaid will not look distorted. Here is an example of a set of data for one of the plaids. I used rather generic color names, because the widths of the stripes were the meaningful parameter, not the color pattern.

Note that, while the order of the colors is the same in both directions, the number of threads is seldom the same in direction 2 as compared to direction 1. This enlargement of the pattern shows the threads; it takes a careful look to see that the spacing is different between horizontal and vertical. Look at the white square. It has 9 horizontal threads but 6 vertical threads, yet the "square" appears pretty close to a square.

One benefit of the over-2-under-2 weave is that it makes counting threads in wider bands easier, because I could count by 4.

This is a more overall view of the pattern. Although each "unit" of the pattern contains 5 white stripes, 4 black stripes, 2 navy stripes and only 1 gray stripe, gray dominates because its stripe is so wide, with navy blue running a close second.

What did I do with all these numbers? There are a lot of them. A few patterns had 38-40 stripes, and many had quantities in the 20's. Some plaids have mirror symmetry, a smaller number don't.

I copied all the data, sorted each set (each direction for each plaid), and set up both ordinal and probability axes for them all. I charted them in groups to see how they looked. I was looking for rectified distributions. As we see below, with a few of them as an example, the results are not clear-cut. I had been hoping to see a clear indication that the distributions were primarily either Scale Free or (my preference) Lognormal. The reality is a little of both. The graphs that follow pertain to six non-symmetrical patterns.

The overall view is that many of the lines have a downward curvature at the right, but not all. In particular, the yellow line and the gray line mostly hidden behind it (#16), and the lighter blue and lighter green lines in the midst of the scrum (#10), don't curve down.

The downward curvature indicates that most of these are better modeled as Lognormal. The next graph shows that presentation.


Here many of the lines appear straighter, while some either flatten out or curve oppositely (not really "upward"). We also see that the dark red line and the dark blue that accompanies it also flatten out, even though they have a bit of downward curvature in the other graph.

None of the patterns showed a hint of being closer to Normal than to Lognormal or Scale Free, so I didn't pursue that any further.

"Eyeballing" the charts proved unsatisfactory, so I used a mathematical measure of linearity, relevant to either Log-Log or Lognormal coordinates, to more clearly discern the trends.

I saw from this that some of the patterns were more Lognormal in one direction and more Scale Free in the other. I found the following:

  • 7 patterns were Lognormal in both directions.
  • 4 patterns were mixed, but leaned Lognormal more than Scale Free.
  • 2 patterns were mixed, but leaned Scale Free.
  • 7 patterns were Log-Log in both directions.

Here we have, from left to right, #3, which is the most Lognormal of them all, #8, which is the most ambiguous, and #6, which is the most Scale Free of them all.


As it happens, #3 and #8 are favorites of mine, and if the red plaid from our comforter were made into a shirt, as a pattern, it would also be a favorite (although my wife doesn't like me to wear red shirts); it is also a mixed-distribution pattern. I care less for #6; I consider it almost ugly. Just to show that Scale Free patterns are also attractive, another of my favorites is shown here, #10, which is more Scale Free in both directions:

A characteristic of Scale Free distributions is a greater number of narrower stripes, and this one shows that. It illustrates that what we like doesn't have a very strong mathematical basis. I had been thinking just the opposite, but I don't mind being proven wrong.

In the future I may scan my plaid summer shirts and analyze them, to see if these tendencies hold up. This has been an enlightening exercise.




Friday, January 13, 2023

Backyard gravitational energy storage

 kw: analytical projects, energy, energy storage, batteries, gravitational energy storage

The Federal subsidy for installing solar panels on houses' roofs continues. I can't take advantage of it because the huge trees in my back yard shade too much of the roof too much of the time. I was told there is an extra subsidy to pay for removing big trees. Hmm, I wonder what the carbon "pollution" balance is between removing several 150-foot trees and using solar power…produced with panels that were manufactured using large amounts of fossil fuel-powered equipment. Is anybody producing solar panels using only solar power?

Anyway, at my latitude, I must use air conditioning about one-third of the year. On the warmest days, the A/C runs periodically all night long, particularly when the overnight low temperature is in the 80's (°F of course; that's about 30°C). It's no longer possible in most states to have the solar panels "run the meter backward" during the day, to build up an energy credit with the utility. Thus, I would have to purchase electricity to run my A/C, and the rest of the house, at night.

I'd like to store energy during the day to use at night. The Tesla Powerwall is one expensive option, and it is probably insufficient. Let's do some figuration.

My electricity bill shows monthly usage between 500 and 1,100 kwh/month. The smaller amount is characteristic of spring and autumn. My A/C unit is a heat pump, so my highest usage is actually in slightly warmer winters, when the heat pump usually runs rather than the backup oil furnace. Let's take 600 kwh/month as the top end of A/C-heat pump usage. That's about 20 kwh/day on the "worst" days, from an energy consumption perspective. Not every day is the same, so there are probably peak days with usage in the 30-40 kwh range. In the summer, more cooling is needed during the day; in winter, more heating is needed at night. Considering that these are very approximate figures, I can begin with the likelihood that an energy storage solution in the range of 20 kwh is appropriate.

First possible option: Tesla Powerwall 2. At a web page for This Old House, I find that the Powerwall 2 has a current (early 2023) price of $11,500 for one battery with a capacity of 13.5 kwh, and $18,500 for a unit with two batteries (27 kwh total). The warranty life is 10 years, with a guarantee of 70% remaining capacity at the end of 10 years. That brings the effective storage of an older unit as low as 9.45 kwh or 18.9 kwh. My benchmark figure of 20 kwh thus requires a two-battery system, with replacement needed 9-10 years down the road. Also, such a unit weighs about 500 pounds (230 kg).

If you're enough of a maker (we used to say "handyman"), what about buying a bunch of car batteries and wiring them together with a charger and a large inverter for converting the DC output to AC at 110 volts (or 220V, for your A/C)? Lead-acid batteries have an energy density of about 40 watt-hours per pound (wh/lb) or 88 (or 90) wh/kg. To achieve 20 kwh we need 500 pounds of car batteries. Hmm, that's about the same as the Tesla unit. Of course, adding the charger and inverter will probably add 100 lbs, and the supporting structure would be another hundred or so. A typical car battery costs $200 or more and weighs 45 pounds; we need 11 of these, perhaps 12 for good measure (even numbers are better for balancing charging and discharge circuits). Not knowing what large, fast chargers cost, nor large inverters, this is still looking pretty good at a battery cost of about $2,400.

That sets some sidebars on direct electricity storage. But I've been wondering about gravitational energy storage. This picture shows one company's proposal for using concrete cylinders and a six-arm crane that uses wind turbine-generated electricity to raise the cylinders, and generates electricity when they are lowered during periods of less wind. They claim overall efficiency of 90%.

The concept is by Energy Vault. The tower is 33 storeys tall (about 100 meters). However, I couldn't make much sense of the numbers in the report, which describes 5,000 concrete blocks with a total weight of 35 tons. That doesn't add up; it works out to 14 pounds per block. I suspect the actual weight of each block is 1,400 lb (640 kg). Such a cylinder would have a volume of a little less than a third of a cubic meter (or about 1/3 of a cubic yard), which is almost twice the volume of an oil drum. From the picture, that looks about right.

What kind of weight would I need to make a backyard gravitational power "tower"? In most neighborhoods, one cannot construct anything taller than a 2-story house; perhaps 30 feet (9 m) at the very most. More figuration is needed, to convert weight and distance to watt-hours.

  • One horsepower is 33,000 ft-lbs per minute, or 550 ft-lbs per second
  • One kilowatt = 1.36 HP = 738 ft-lbs/s
  • 1 kwh = 738×3,600 = 2,692,800 ft-lbs = 372,400 kg-m
  • 20 kwh comes to 7,448 Tonne-m (nearly 7½ million kg-m)
  • Divide by 9: About 830 Tonnes (910 tons) raised to a 9 m height

Ok, just to run my overnight energy storage, I need to be able to raise and lower upwards of 900 one-ton blocks, using motors that can function as generators with a 4000-watt capacity. Standard concrete weighs 2,400 kg (2.4 Tonnes) per cubic meter, or 4,000 lbs (2 tons) per cubic yard. 830/2.4 = 346 cubic meters of concrete, a mass 18 by 19 meters, one meter thick (English units: 455 cubic yards, about 64 by 64 feet, and 3 feet thick).

My back yard is rather small, only 30 feet deep, though it's 90 feet wide. I do have a side yard that's plenty large enough. I wonder what my neighbors would think if I built a structure as tall as my house, with a footprint of more than 4,000 sq ft. And the big electric motors/generators would most likely whine when in use. I'd probably have to remove some soil and seat it 2-3 feet below grade (with drainage infrastructure for rainy weather) to keep the total height below 30 feet.

Maybe I can use iron (I can't afford 900 tons of lead!). Iron's density is 7,874 kg/cubic meter, or 3.28 times that of concrete. This would shrink the volume needed to 105.5 cubic meters or 138 cubic yards. Reducing the vertical depth to 2 feet means the footprint would be no longer 4,000 sq ft but 1,860 sq ft, or about 43 feet square. My 2,000 square-foot house is two storeys, so it's size is only 25 by 40 feet.

The picture is a bit ridiculous. The primary virtue of such a system is that its energy capacity doesn't reduce over time the way the Powerwall will. But it illustrates the amazing energy density of batteries, even lead-acid car batteries, compared to big blocks of iron or concrete and big motors to lift and lower them.

This is a fun mental exercise. It convinces me to wait for better batteries to be developed. Systems based on something besides lithium, for sure! Sodium-sulfur can have 2-4 times the energy density of lithium-ion, and sodium-ion is in the two-times range. Recent research has produced prototypes that don't have to be kept at 300°C (570°F) to operate efficiently. I can wait.

Monday, December 26, 2022

Measuring my metabolism…crudely

 kw: analytical projects, weight, metabolism

For decades we've had a bedroom scale, the kind with a spring. Over the years I found that the weight it showed was a little variable if I leaned one way or another. Naturally, being overweight, I soon learned how to lean so the weight shown was as small as possible, without me falling over. I finally realized I was fooling myself, particularly because my weight in the doctor's office, adjusting for clothing and shoes, was about five pounds greater than my "home weight". That made a big difference to me, emotionally, because it pushed me over a boundary: I am just six feet tall. At home I would get a weight of 215-216 pounds, for a BMI of 29.2-29.3. That's near the top end of "overweight". A couple of years ago the medical scale showed 226 pounds, and with shoes on and my cell phone in a pocket I had five pounds of "accessories", for a naked weight of 221. That's a BMI of 30, which is "obese". Boo-hoo!

Over a period of about a year I did my best to eat more moderately, and my doctor said one day, "Oh, you've lost a little weight." I weighed 224 clothed, or 219, a BMI of 29.7. My "home weight" was 213-214. Better, but not good enough. Then I caught Covid-19, to which I reacted by fasting for several days (low blood sugar reduces the chances of getting pneumonia). That brought my "home weight" below 210 pounds.

I bought a digital scale. Its reported accuracy is 0.2 pounds, which is 3.2 ounces. This scale helped me calibrate the old spring scale, which is actually surprisingly good. If I stand straight on the spring scale I get the same reading, within a pound, as the digital scale. Of course, I am rather enamored of that extra digit, and the digital scale is much easier to read.

I had read enough of recent literature to realize that it is eating sugar and "fast carbs" like potatoes that cause weight gain, not eating fat. I went nearly full-carnivore for a while. When I had eggs for breakfast (I typically fry 3 eggs in olive oil), rather than buttered toast I had breakfast sausage: two of the little links, which each have the same number of calories as a slice of the bread I'd use for toast. I quit having sandwiches; just some lunch meat and cheese, which I'd take to work in a baggie, or prepare on the spot when I ate at home (I work 3 days/week). I began losing about a pound weekly. My present morning weight is 195 pounds.

I've been weighing myself morning and evening for some time, and I took note of a certain regularity. After a morning pee, I weigh a pound less (plus or minus 0.2 pounds) than in the evening before bed. Then for a few days I checked my weight in the morning before visiting the toilet, and found it was either 0.4 or 0.6 pounds less, and another 0.4 to 0.6 pounds would go into the toilet. I thought, "I am losing half a pound overnight just by breathing!"

I realized that I was measuring my metabolism, in a crude way. That 0.4-0.6 pounds (6.4-9.6 ounces, or about 180-270 grams) represents glucose being oxidized and its oxidation products being exhaled.

If you have had any exposure to biochemistry, you'll find this formula familiar:

Glucose, the primary sugar in grapes, is the energy currency of life. Plants use photosynthesis to add carbon dioxide from the atmosphere to water brought up from the roots, producing glucose and releasing oxygen to the atmosphere. Animals consume plants, from which they obtain glucose (and lots of other chemicals); they add oxygen to the glucose to break it down to water and carbon dioxide. This simple chemical formula hides the complexities of the Krebs cycle, and the energy input by ATP to keep it running during respiration, or the production/activation of ATP during photosynthesis.

To see where the weights come and go, here are the atomic masses of these molecules:

  • glucose - 180
  • oxygen - 32 (a 2-atom molecule)
  • water - 18
  • carbon dioxide - 44

In chemistry, a mole is the weight in grams times the molecular weight. Thus a mole of hydrogen atoms weighs one gram, and a mole of carbon dioxide, which has a molecular weight of 44, is 44 grams. If we multiply the last three numbers above by six, to correspond to the equation above, we find this:

In respiration, 180 g of glucose combines with 192 g of oxygen to produce 108 g of water and 264 g of carbon dioxide. In photosynthesis, the opposite happens. The two gases outweigh the sugar and water.

These are the gram weights appropriate to the oxidation of 0.4 pounds of glucose. For those of us who are not as familiar with metric, I'll take advantage of the fact that all the weights in the prior paragraph are divisible by 12, and use somewhat greater actual weights, for the following:

In respiration, 7.5 oz of glucose combines with 8 oz of oxygen to produce 4.5 oz of water and 11 oz of carbon dioxide.

7.5 ounces of glucose is 0.47 pounds, so this is similar, and gives me a feel for what is going on.

How much energy does this represent? We are told in nutrition tables that a gram of sugar has four calories (the dietary calorie is a Kcalorie, or the amount of heat that must be used to raise the temperature of a kilogram of water 1°C). I found that the oxidation of a mole of glucose releases 280 calories. One mole of glucose, as above, is 180 grams, almost exactly 0.4 pounds, so at the low end of my nightly weight loss (before urination), my metabolism has produced 280 calories. When I sometimes get a reading of 0.6 pounds, that converts to 420 calories. I suspect that the actual amount is the same each night, but when I have a bedtime weight of 195 pounds, it might really be anywhere between 194.9 and 195.1. Then, if the actual amount of glucose "burned" is 0.5 pounds, my morning weight would read either 194.4 or 194.6. Half a pound of glucose converts to 350 calories.

I sleep 6-7 hours. Let's use an average of 6.5. Dividing 350 by 6.5 yields 53.8 calories per hour. Multiply by 24, and we find 1,292 calories per day. That seems to be my basic (not basal!) metabolism when at total rest. A Basal Metabolic Rate calculator tells me 1,628 calories per day. Further, for an entirely sedentary man my age, daily caloric need is 1,989. Explanatory text points out that "body maintenance" for most people is about 70%. If I understand that correctly, let's see what I get by dividing 1,292 by 1,628: 0.79 or 79%. And then 1,292 / 1,989 = 0.65 or 65%. So it seems to be in the right range.

There is a second factor to consider, which is nitrogen metabolism. Small amounts of protein are discarded daily. They are the source of the nitrogen in urea, the main non-water component of urine, and creatinine. The urine of a healthy and properly hydrated person contains 9.3 g/dL of urea and 0.67 g/dL creatinine. The latter can be ignored for practical purposes. I don't have a general molecular formula for protein, so I'll just do a simple "bonehead" analysis.

Molecular weight of nitrogen: 28
Molecular weight of urea: 60

Thus a half-pound of urine (one cup or about 120 ml, or 0.12 liter) contains about 11g of urea, or 5.2 g of nitrogen. Roughly speaking, protein is 16% nitrogen, so that represents the discard of about 32 g of protein. That is insignificant compared to the amount of glucose metabolized, at least in terms of energy/calories.

Daily urine production for a man my size is about 1.4 liter, and it will apparently contain about 130 g of urea, which contains 61 g of nitrogen, derived from the discard of 380 g (13 oz) of protein. This emphasizes that we need to consume at least that amount of protein daily, because it can't be produced by converting either carbohydrate or fat; they contain no nitrogen.

These numbers are quite at variance with the recommendation that adult men need 0.8 g of protein per kg of body weight. That converts to about 70 g/day for me (195 lbs = 88 kg). I need to do more research, because the discrepancy between 70 g and 380 g is huge. This could take a while…

Bottom line: Someone who weighs about 200 pounds can expect to lose a half pound of glucose overnight, expelled in the breath as water vapor and carbon dioxide. In addition, about an ounce of protein is lost overnight and expelled during the morning pee.

Thursday, April 22, 2021

To Jupiter in a Week?

 kw: analytical projects, space travel, solar system

I began reading a bit of space opera from the early 1950's, in which a space pilot goes from Earth to Jupiter in seven days. I wondered how that would be possible. My first thought was, "Jupiter is around half a billion miles away. What does it take to speed up to around 70 million miles/day (~3 million mph)?"

For perspective: About fifteen years ago, the New Horizons spacecraft was launched from Earth and boosted to a speed of about 45 km/s (about 100,000 mph). Thirteen months later it approached Jupiter, still going just under 20 km/s, and was directed into a slingshot flyby that boosted its speed to about 22.5 km/s.

From this point we go metric. Jupiter's distance from Earth varies between 588 and 968 million kilometers (Mkm). For what it is worth, when Earth is at quadrature with Jupiter, one can gain an extra 30 km/s of takeoff speed, and at that point the distance is near the average of about 780 Mkm. For this analysis I'll be dividing by 7 and by two numbers divisible by 3, and to have an even-numbered result, I'll pick a distance that is divisible by 126 million (126=9x7x2). I chose 126x6 = 756 Mkm.

First simple analysis: 756/7 = 108. Thus, average speed needs to be 108 Mkm/day or 1,250 km/s. That's almost 28 times as fast as the starting speed of New Horizons (Clearly, science fiction writers in the pre-Sputnik days expected great advances in rocket fuel technology). Suppose the rocket can accelerate at 1G for as long as needed. How long does it take to get up to 1,250,000 m/s?

Basic velocity formulas:

  • 1G acceleration (a) = 9.8 m/s²
  • Velocity (v) = 9.8*t m/s
  • Distance in time t = 4.9*t² m

Turn the second formula around: t = v/9.8, which comes to 1,250,000/9.8 = 127,550 sec = 35.43 hours. It takes about a day and a half to get up to speed. Without going into detail, this means that actual travel time would be more like 8.5 days. But this puts us in the right ballpark.

Let us figure what acceleration is needed to go half the distance at constant acceleration, then turn around and slow down in the same amount of time and distance. Half the distance is 378 Mkm. Solve the third equation for a, the acceleration needed to go 378 Mkm in 3.5 days, or 84 hours, or 302,400 seconds: a = 2*dist/t², which comes to 8.27 m/s². That is about 0.84 G. With that level of acceleration, our pilot can have the comfort of a near-1G environment for the whole trip, except for turnaround at the midpoint, and other maneuvers at both ends. Peak speed would be 8.27*302,400 = 2.7 million m/s or 2,700 km/s, or more than twice the average speed.

So there we have it. We just need a fuel-&-engine system that can accelerate at near-one-G for a total of a week, and repeat the performance for the return trip.

A secondary consideration is, what would be the consequences of hitting a dust particle, or worse, a sand-size particle, at a speed of 2,700 km/s? An average grain of beach or dune sand is half a mm across and weighs about 180 micrograms (µg). 180 µg is 180 billionths of a kg, the unit we need to calculate energy. Silt particles are 1/100 the diameter and weigh one millionth as much, or 180 trillionths of a gram.

Let's start with a sand grain. Kinetic energy E = m*v²/2, or 0.000 000 18*(2,700,000)²/2 = 656 thousand joules; a joule is a watt-second, so this comes to 182 watt-hours. This is the energy of a 1 kg mass at a speed of 1,150 m/s, a little faster than the bullet from an AR-15 rifle, but that bullet weighs only about 4 grams. This sand grain deposits the energy of 250 rifle rounds in an area half a millimeter across. That would melt a chunk of armor plate and make a hole you can stick your finger in. The ship's pilot would feel a bit of a jerk from the impact.

A grain of silt or dust, with one-millionth the weight, has one-millionth the kinetic energy, which comes to 2/3 of a joule. It doesn't sound like much, but that's the energy of a BB dropped about a foot. You'd hear it. It would strike off a bit of material, which a BB wouldn't do. Intermediate-sized grains would do correspondingly more damage. Sand size grains are very scarce in the asteroid belt, but silt-size grains are probably abundant enough that the wear on forward armor would be significant.

So, as enjoyable as such tales are, with people bombing around the solar system as though one were driving from Idaho to Florida, there's a lot of reality in between where we are now and the technology needed to accomplish it.

Saturday, January 16, 2021

Why the Democratic Party needs illegal immigrants

kw: politics, abortion, analytical projects

I have been mulling over a curious phenomenon for about twenty years, since I began to gather threads of this idea after the amnesty for illegal immigrants enacted in 1986. At that time there were three million of them. In the past 34 years a further 11-12 million people have entered the U.S. illegally. That is the curious phenomenon: The Democratic Party has increasingly pushed for a further amnesty, and many, perhaps most of the party's national leaders even call for open borders. Open borders would eliminate national sovereignty! I wondered, "Why?"

I think I know why. The population of Democrats and potential Democrats (children born to parents who are Democrats) has not been growing as rapidly as the population of Republicans and potential Republicans. As I figure it, the primary reason behind that trend is legalized abortion, which began January 22, 1973. From that date until the end of 2001, plus the first ten months of 2002, the number of abortions reported to the CDC was a bit over 34.4 million. That is the number of persons who would nearly all be living today, and eligible to vote.

34.4 million. That is more than 10% of the current U.S. population. That is a lot of "missing Americans," who simply faded into the ashcan of history (This does not take account of any children that could have been born to babies aborted before about 1984, some of whom would also be eligible to vote this year).

Who obtained those abortions? For the entire period of about 47 years, Republicans and some Democrats who are people of faith have decried the Roe vs Wade decision, and legislatures in "red states" have enacted numerous laws to restrict abortions. All that time, Democrats, and a very few Republicans, have loudly supported "abortion on demand", and have either fought restrictive legislation or initiated lawsuits to get such laws struck down.

How many of the women who chose abortion were Democrats and how many were Republican? It is inconceivable that there is an exact 50:50 split. Millions of the women who chose abortion were Republicans, but even more were Democrats, but what is the proportion? It is certain that Democrats were the majority, whether it is a slender majority or a great majority. Republican women have the hurdle of belonging to a political party that is vocally anti-abortion, and usually also belonging to a religious establishment that opposes abortion. Fewer Democrats are religious, so in general there is no such hurdle for a Democratic woman.

Based upon my experience with many people of all political stripes, I think the proportion is between 60:40 and 55:45. It is quite possible that the real ratio is even more skewed, but being a conservative, I'll be conservative in my estimates. This table of "missing" voters shows the implications.


The column "Difference" shows the impact. I estimate that if there had been hardly any abortions, legal or otherwise, since 1973, the number of Democrats eligible to vote would be between 19 million and 20.7 million more than there are today, while the number of such Republicans would be between 13.8 million and 15.5 million. Many "purple states" would have become solidly "blue," as would the country as a whole.

The apparent "loss" of between 3.4 million and almost 7 million Democrat voters over the past forty years is tough to make up. Thus the need for illegal immigrants. It is no surprise that in border states, and to some extent in the tier of "next-to-border" states, illegal immigrants can get more "services" than retired veterans. It is a national shame that homeless veterans are living in the streets not far from nice houses filled with criminals (that's what illegal aliens are).

The cynical Democrats look upon the twelve million illegals as a gold mine. It is worth spending tons of money on them, all the while reminding them that it is the Democrats who are "caring" for them. Whenever they get amnesty, and voting rights soon after that, they will remember. If just five million of them begin to consistently vote Democratic, there will be little chance for anything resembling bipartisan politics to be found anywhere in this country. They will be free to enact whatever they want without effective opposition. This alone has a greater potential to bring an end to liberal Democracy in America than any other factor.

Monday, April 29, 2019

Tea light of another color

kw: analytical projects, lamps, spectroscopy

Recently a friend gave us a goblet she made that she calls Tree of Life. Perhaps there are 12 colors on it to match the 12 fruits mentioned in the book of Revelation (I didn't count). She also gave us a candle to put in it, but the candle was in a large jar and didn't illuminate all of the goblet. So we tried a tea light candle, which worked nicely. However, we don't usually burn candles, and we wanted something safer (the cat might knock it over). So we tried an amber-colored LED tea light. That was a poor choice! We had a different kind of LED candle, with a whitish-yellow colored light, so we tried that, with mixed results. Here is the goblet with the three lights inside in order: flame, whitish LED, and amber LED.


These are the lights in the order shown above. The flame is clearly the best all around. The whitish-yellow LED candle is too tall to illuminate the whole goblet, but it show the colors well. It also uses a moving reflector to make a flame effect, but that blocks most of the light that would go out the back. The amber LED tea light, while it illuminates the whole goblet, has no range of color! (There are blue reflections in the second and third photo from a nearby computer monitor.)

It is clear that the amber LED has a narrow spectrum. How narrow? I determined to find out. Here are the results of spectroscopy of the three lamps, and also an incandescent lantern bulb.


While the flame (second spectrum) is whiter than the whitish-yellow LED, it has a broader color spectrum, though not as broad as the incandescent lamp shown first. The bright peak at the blue end of the third spectrum is normal for an LED using phosphors to add the red through green and light blue colors. LED lamps for home use use the same principle.

The amber LED (fourth spectrum) does not use phosphors. It is a low-voltage LED that has a color peak in the orange-yellow area (near 590 nm). Its bandwidth is similar to that of the blue excitation band of the other LED that does use phosphors. There is just a trace of red and a bit of green, but they are overwhelmed by the yellow-orange peak. So all the colored blobs on the goblet just look yellowish.

The lantern bulb has a full-width spectrum, from below 400 nm to beyond 700 nm; the visible portion is 300 nm wide. The candle and the whitish LED have bandwidths nearly as broad. But the amber LED's bandwidth is a mere 75 nm, and the brightest portion is no wider than half that. It mostly just makes amber-colored light and nothing else.

I plan to carry a hand spectroscope with me the next time I go to buy LED tea lights, to find a brand with a broad spectrum that'll illuminate this goblet properly!

Thursday, April 26, 2018

Scoping out lamp spectra

kw: analytical projects, spectroscopy, photographs

Technical photography of biological subjects has its tricky aspects. An important one is the quality of the lights. This picture shows one setup I have used to avoid the use of the compact fluorescent lamps (CFL's) that were brought in to replace the incandescent flood lamps they had been using, but which burn out on a regular basis…and they are hot. CFL's have serious drawbacks for color photography, which we'll see later on.

The little blue lamps, wrapped in tissues, are "work lights" from Harbor Freight, with 18 small LED bulbs each. They have a pretty good spectrum (I'll point out a similar one below).

We have been considering a more quantitative approach, particular for photos of birds. Few mollusks have "interesting" colors, but nearly all birds do. Birds have an extra color sensor in their eyes and can see ultraviolet light, so it is also of interest to be able to photograph birds in UV light.

I decided to explore the various lamps available, not only for these reasons but a few extra ones. In recent years I used pieces cut from a page-size sample of diffraction grating, obtained from Edmund Scientific many years ago, to make two spectroscopes. One, about a foot long, is for handheld use, and another, about twice the size, is for use with a camera.

I originally made them to investigate which yellow lamp would be the best "bug light". Night-flying insects see UV even better than birds do, and many of them cannot see yellow or red light, and have low sensitivity even to green. The ideal bug light would have a cutoff in the yellow-green range, and would be rather orange. In order to keep people on your doorstep from looking too weird, all commercial bug lights include some green and look distinctly yellow.

This shows a test setup with the large spectroscope on my workbench, using a black light as the source. Not only does the camera "see" UV, it is also being overloaded by the bright blue and violet lines of mercury (Hg). That black light bulb is not nearly this bright to my eyes. The camera at the left is set back a little farther than usual; I usually use it with the front of the zoom lens about two inches from the grating, which is at the end of the white bell-shaped "front" of the spectroscope. The "slit" is currently a thin slot sawn into a PVC cap at the end where the lamp is.

Initial tests verified that the camera's sensor can record UV and that the lens passes it, and also that none of the lens elements is fluorescent (a problem with the lens of another camera I have!). I also learned that the "UV filter" I was sold with the camera does not block UV-A (longwave, or near-UV). It does block short-wave UV, that is UV-B and UV-C, pretty well. So I bought a better filter, a UV(0) filter from Hoya. Now to the recent batch of tests, summarized in this image, a screen shot from PowerPoint:


Depending on your monitor, this might be hard to read. To summarize, the top shows the spectrum of a "black light" CFL (a "party light"), at two exposures; the next 11 sets are at three exposures each. From the top, then, we have

  • two sets for different hues of fluorescent tube, 
  • two sets for incandescent bulbs, 
  • two sets for different hues of CFL, 
  • a yellow CFL "party light", 
  • two commercial "bug light" bulbs, and 
  • two sets for LED bulbs from different manufacturers; the spectrum of the work lights from Harbor Freight is a little bluer than the bottommost set.

Only the black light has a spectrum that includes a strong UV line at 365 nm. Most of the lamps have a cutoff near 420 nm, though a couple of the CFL's let through a little deeper blue and the UV line. The spectra of the CFL's show very strong lines with darkness in between, which is why these lamps have poor "color rendering", as it is called. LED's, as shown at the bottom, come the closest to mimicking the spectra of incandescent lamps.

My preliminary conclusions are (1) that for ordinary color photography, LED lamps are the best choice among the "non-incandescent" ones, and (2) to get good UV images we'll need to use black light CFL's, probably with a visible-blocking filter. It may also work to use UV LED flashlights like the ones used by TSA at airports, though they are a bit costly, because they don't produce any visible light.