All timestamps are based on your local time of:

[ « Newer ][ View: List | Cloud | Calendar | Latest comments | Photo albums ][ Older » ]

I pity the fool2022-03-28 12:07:02

Over the past few years we've been reducing our direct use of fossil fuels in our household. This involved switching out three fuel-powered machines for electric equivalents: our car, water heater, and home heating.

The car was the first one we did (in late 2019), and was the one with the largest up-front cost. But given the supply chain shortages and rising gas prices, I'm glad we got that one done first. I haven't done a detailed financial analysis but I know that our insurance went up (simply because the base price of the EV was a lot higher than the ICE we had before) and all other costs went down. Overall I think financially it's a slight win in terms of operating costs, but the payback period for the up-front cost will be pretty long. However the pleasure of driving an EV counts for a lot! It just feels nice, even now 2.5 years later.

The water heater was the next one to go (in mid-2020). Previously we were renting a gas water heater; the rental company was not the best and I was eager to ditch them. After doing the math I concluded owning was strictly better than renting, so we purchased an electric water heater and had it professionally installed. The payback period on this was quite short, and we're already net positive two years later. Even if we have to replace it every 6 years (the warranty lifetime) it's still a win over renting. Plus the electric heater is new and doesn't look like it's going to explode if I look at it wrong (the old gas heater was quite old). Functionally it's equivalent or better - water is hot.

And finally, last week we replaced our nearing-end-of-life gas furnace and AC with an electric heat pump (plus a new gas furnace as an auxiliary heat source). It's only been a week but so far I'm pretty happy with the heat pump. Based on the rated capacity, I expect the backup gas furnace to only kick in a few days a year. The real test will come next winter though, so I'm going to withhold final judgement until then.

We still secondary fossil-fuel-based things like a propane BBQ and gas fireplace, but they're very infrequently used. It's quite satisfying to have all our primary energy needs met by the electrical grid. In Ontario at least most of our electricity comes from non-carbon-emitting sources, so that's a nice bonus.

I keep wondering what life would be like if things like cellphones and laptops ran on fossil fuels. Imagine having to open up a little port and pour in a thimble of oil into your phone every night instead of just plugging it in. I'm glad we live in the future.


Magical 3d printers2022-03-17 11:15:54

Imagine a 3D printer that sucked out carbon dioxide from the air, extracted the carbon atoms, and generated graphene/nanotubes in your desired configuration. Presumably with sufficient energy and some sort of catalyst this should be possible. This would be amazing! Not only does it create products with the properties of graphene (amazing strength, etc.), it fights climate change while doing so! And it's a 3D printer that doesn't require you to procure physical "raw materials" since it would suck it from the air.

A 100g print would require 100g of carbon, or ~367g of CO2. At the current atmospheric CO2 levels of ~420ppm, that requires around 873kg of air, or ~713 cubic meters of air. Assuming a 2.5m ceiling height, that's about the amount of air in a ~285 square metre house (~3068 square feet). That's a pretty big house, but a not-unreasonable order of magnitude. Hook up some giant fans and you're all set!

One day we'll probably discover that trees do exactly this.


The revenge of PGP2022-02-17 12:19:43

I recently read "Termination Shock" by Neal Stephenson. Good book for sure, although I prefer some of his other works.

There was a bit in the book that involved deepfake videos which I thought was interesting. Making a deepfake video of some authority figure (government, etc.) and spreading it as misinformation seems like a pretty bad thing, but it's also something that can be defended against. All you have to do is have authentic videos include a public-key signature that can't be faked. So e.g. the US government could have a published public key, and any official communications would be signed by the corresponding private key. Media distribution platforms could then verify the signature to authenticate that it hasn't been faked or modified.

In fact, this would be good even without the threat of deepfakes, because the signature would apply to the entire video rather than a soundbite/clip of it, and so if you extracted and shared a clip, the clip would not be verifiable. This is good because extracting a clip often loses important context and is not representative of the "whole truth". Sharing this kind of out-of-context information is in some cases equivalent to sharing blatant misinformation. Organizations that create the original video could still create shorter "approved" clips and sign them for sharing if they desire.

Same applies to any kind of digital document, really. That's why people do it for email!


What a time to be alive2022-01-02 11:01:24

I've been thinking lately about the revolutionary new technology transitions that humanity is going through. There's a few that I think will have a huge impact over the course of the next few decades:

  • artificial intelligence, which is already well under way
  • quantum computing, which is still early days, but will give humanity unprecedented ability to effectively engineer everything from materials to genomes
  • space exploration/colonization, which will be a driver for creating all sorts of new products that will benefit everybody

There's also a few shorter-term things like cryptocurrency/web3, 3D printing, and global internet coverage which are similar in nature but smaller in their impact.

What's interesting to me is that while all of these things are in development concurrently, I'm not sure humanity has enough bandwidth to digest all of these revolutions concurrently. In isolation, each piece of tech can be developed just fine. However, there's going to be a lot of work needed to integrate it with all existing tech and with each other. The "each other" part of it is particularly expensive because for n new technologies there are O(2^n) combinations and exploring each of those possibilities requires knowledge of one or more of these new technologies (where, by definition, the knowledge is not widespread). I'm not sure we have enough people to make it happen smoothly.

It will still happen, just less smoothly than we might like. By that I mean gaps will be exposed at the intersection of technologies that can and will be abused by bad actors. Fortunes will be made and lost to these gaps.

If this all sounds very abstract here are some more concrete (although rudimentary) example questions:

  • Who will update software to move off cryptosystems like RSA that can be broken by quantum computing? What will get left unpatched and hacked?
  • As products get lighter (mass efficiency being a key factor for space colonization) delivery via drone becomes feasible for a much larger set of products. Who will have the drone delivery capability to take advantage of it?
  • How do blockchain consensus protocols deal with the scenario where a bunch of nodes are on another planet with multiple minutes of latency in communications? Is a single unified system still feasible?

These questions are pretty basic and I don't think I have enough specialized knowledge to ask better ones. But I know they're out there, and they're important to think about.

Extrapolating on this line of thinking, there's probably some ideal ratio of scientific/research activity to engineering activity such that the rate is creation of new technologies doesn't overwhelm the ability to integrate those new technologies into the world. Over time, this ratio would increase in the direction of requiring more engineering activity per unit of scientific/research activity simply because each new technology can be integrated with the increasing number of technologies that came before.


Dewey Decimal Challenge2021-12-30 21:35:31

Over the course of 2022, pick a book from every major Dewey Decimal category and read it. This probably works best if your local library uses Dewey classification rather than Library of Congress or other classification systems, and if COVID isn't preventing you from actually browsing the library in person.


On comparing rates of return2020-08-30 21:28:22

Something that has bugged me for a while is how brokerages never seem to provide an annualized rate of return for stocks/portfolios. They tell you things like the book value, market value, and closed profit/loss, but computing a rate of return from that totally discounts the time factor and incremental/partial investments, and gives you a rate of return that is not meaningfully comparable across different stocks or portfolios.

I've written my own financial tracking software (this should come as a surprise to no-one who knows me) and I figured I should build this in. It turned out to be a somewhat interesting problem to come up with something reasonable, so I thought it would be worth describing.

First we have to figure out what kind of rate of return can be meaningfully compared across different investment portfolios. Consider an easy scenario:

t=0: Buy $100 of stock A
t=1 year: Sell stock A for $110

What should be the rate of return here? The obvious answer is 10% because we sold for 10% more than we bought. But compare against this:

t=0: Buy $100 of stock B
t=1 year: Sell half of stock B for $55
t=2 years: Sell remaining stock B for $60

We can think of this as two sub-stocks, B1 and B2:

t=0: Buy $50 of B1, $50 of B2
t=1 year: Sell B1 for $55
t=2 years: Sell B2 for $60

If we want to be consistent with our calculation for stock A, then B1 got a rate of return of 10%, and B2 got 20% but over 2 years. You could treat that as equivalent to 10% per year, but... if B1 was worth $55 at t=1 year, then so was B2. Which means B2 went up from $55 to $60 over the second year, which is less than 10% per year. So that seems like a contradiction.

With a bit of thought it seemed to me that what we really want here is a "continuous compounding" rate of return rather than a "yearly compounding" (or "no compounding") rate of return. The continuous compounding formula is:

Pt = P0 * er * t, where P0 is the initial investment, r is the rate of return and t is the time.

So let's look at B1 and B2 again:

Formula for B1: 55 = 50 * er * 1 which produces r as 9.53%.
Formula for B2: 60 = 50 * er * 2 which produces r as 9.12%.

This makes sense since we know B did worse in the second year than it did in the first year, so B2's rate over 2 years should be lower than B1's rate over the first year. (Note that with this formula we also get 9.53% for stock A above, which seems consistent.)

What about combining B1 and B2 back into a single rate of return for B? They're over different time periods so just taking the arithmetic mean doesn't seem right. I realized instead that we can think of the investments as putting money into and taking money out of an imaginary savings account with continuous compounding. That's similar to the stock market (or other investment vehicles) with the difference that the stock market fluctuates a lot and the instantaneous value at any given time is pretty meaningless, so we want to avoid using that anywhere in our calculations. We want to get away with just using the cash flows in and out of the investment.

So to compute the return for B, we could do something like this:

(((100 * er * 1) - 55) * er * 1) - 60 = 0

This says the $100 grew at continuously-compounded rate r for one year, at which point we removed $55 and let the rest grow for another year at the same r, and then removed $60 and ended up with $0 left. And here solving for r gives us 9.25% which seems like a reasonable number given our values for B1 and B2 above.

This solution can be extended for all sorts of complex scenarios spanning different time periods and with many cash flows in and out. I don't know if there's a closed-form solution to this but I ended up writing some code that did a binary search to converge on r.

Another interesting factor to consider is related transactions that don't actually affect the "stored value" in the investment. This includes things like dividend payouts (excluding reinvested dividends) or transaction commissions taken by the broker. I wasn't quite sure how to fit these in, but eventually decided that they should just be treated as non-compounding. So, for example, if we have this scenario:

t=0: Buy $100 of stock C
t=1 year: Receive $10 dividend from C
t=2 years: Sell all of C for $130

We'd use this formula:

(100 * er * 2) - 130 = 10

The left side is what we'd normally put in for the buy/sell transactions, but the right side is the net result of all the related transactions (in this case, a $10 dividend payout). In this case, it gives us a 16.82% rate of return, versus a 13.12% return without the dividend. So again, seems reasonable since the net value at the end is $40, versus $30 without the dividend.

Accounting for dividends this way makes it so that the time at which we receive the dividend doesn't make a difference to the overall rate of return - we could receive the dividend right at the beginning, or even after we sell the stock, and our rate of return will be the same. I considered the argument that dividends that arrive sooner are better, because we have access to the money earlier. Upon further reflection, I think that's only true if we actually invest that money in something. If that something is part of the portfolio we're evaluating, that dividend is effectively a reinvested dividend and shouldn't get counted as a dividend at all. And if that something is outside the portfolio we're evaluating, then it should get counted towards that other portfolio. I'm not totally sold on this bit yet but even with this caveat the overall approach seems to work well enough.


Puzzle solution2020-03-17 20:45:35

In a a previous post I described a puzzle. A couple of people I've talked to since have mentioned that they thought about it but couldn't figure out the answer, so here it is. (If you don't want spoilers, stop reading now!)

The "magic square" chosen by the Devil is one of 64 possibilities. Or, in information theory terms, it's 6 bits of information (since each bit encodes one of two possibilities, and 2^6 is 64). So we need to somehow convey 6 bits of information to our friend, yet do so by flipping at most one token on the board.

The way to do this is to define 6 "parity sets" such that each parity set gives you 1 bit of information, and overlap them such that with a single token flip you can control the bit produced by each parity set. A parity set is simply an area of the board where you count up the number of "up" tokens. The parity (even or odd) of that number produces the bit of information.

So for example, consider a parity set that is the top half of the board (the first four rows). If there are an odd number of "up" tokens in that half of the board, the bit produced by that parity set is a 1. If there are an even number, the bit produced is a 0. By flipping any token in the top half of the board, you can change the bit produced from 1 to a 0 or vice-versa. And now consider a second parity set that is the left half of the board (the first four columns). Likewise that parity set produces a 1 or a 0. Importantly, if you flip a token in the top-left quarter of the board, you will change the bits produced by both parity sets. If you flip a token in the top-right quarter of the board, you will change the bit of only the first parity set and not the second. Flipping a bit in the bottom-left quarter will change the bit of only the second parity set and not the first.

We can extend this concept to create the following six parity sets:
- rows 1,2,3,4
- rows 1,2,5,6
- rows 1,3,5,7
- columns 1,2,3,4
- columns 1,2,5,6
- columns 1,3,5,7

Flipping the token in row 1, column 1 will change the parity of all six sets, while (for example) changing the token in row 5, column 6 will change the parity of sets 2, 3, and 5.

So the complete solution is like so: with your friend beforehand, you decide on the 6 parity sets (the above is one possibility) and their interpretation. One interpretation is that you take a 1 for an odd number of "up" tokens in the set, or a 0 for an even number, and glue together those six bits into a 6-bit number (e.g. 011001). That number then encodes the position of the "magic square", as it can represent 64 different values. Then, when you are in the room with the Devil, and he selects the "magic square", you work backwards to figure out the 6-bit number you want to encode, and flip the appropriate token so that the six parity sets produce the bits you need. Ta-da!


Prompts with ANSI escape sequences2014-10-19 21:35:15

Tip of the day: If your shell uses the readline library (e.g. bash), and you have ANSI escape sequences in your prompt, you should surround the ANSI escape sequences with \001 and \002 so that readline knows they are "invisible characters". If you don't, readline can end up mis-positioning your cursor and generally screwing up the display.

For example, I used to have this in my bashrc file:

export PS1='\u@\033[01;31m\h\033[m \W$ '

and that caused problems if for example I had a long command and used ctrl+a to get to the start of it.

Now I have this:

export PS1='\u@\001\033[01;31m\002\h\001\033[m\002 \W$ '

and all is well.

The \001 and \002 are defined as RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE in readline.h.


Devil's advocate on solar2014-10-15 22:17:55

Sometimes I wonder if solar panels really are better than fossil fuels. One the one hand, yay renewable energy. On the other hand, aren't we trying to reflect away more of the sun's energy to avoid amplifying global warming? Solar panels seem to work counter to that goal - they capture more and more of the sun's energy and trap it here.

Arguably that energy ends up mostly dissipated as heat (e.g. in the case of a solar-powered data center), and that would be the same if the data center were powered by fossil fuels. But I can't help thinking of our planet as a mostly-closed system that ordinarily emits about the same amount of energy that it takes in (that may not be right). Solar panels seem like they would upset that balance.

I wonder if anybody has done studies to measure this sort of thing.


More books2014-02-11 21:58:38

It's been a while since I've posted, but I've been getting through a lot of books that have been queued up on my reading list for a while. Quick rundown:

  • The old way (Elizabeth Marshall Thomas) - An account of the Kalahari bushmen, written by one of the first outsiders to live/interact with them. At a high level the book is similar to The World Until Yesterday, in that it relates how a pre-agricultural civilization used to live. I found it pretty interesting but probably not everybody's cup of tea. Books like these always make me more aware of how so many things we assume are "normal" really aren't.
  • Nothing to Envy (Barbara Demic) - The book follows the lives of a few people who lived in and escaped from North Korea. Quite well written. There were definitely some parts that took me by surprise - one of those "fact is stranger than fiction" things. If anybody ever does a detailed psychoanalysis of Kim Jong Il I would like to read it.
  • Mindset: The New Psychology of Success (Carol Dweck) - This is one of those books everybody should read, ideally before they have children. Life-changing in some ways. I think this book has been popular enough that some of its messages have seeped out into "general knowledge" but there's still a lot of stuff there that I hadn't encountered before.
  • Moonwalking with Einstein (Joshua Foer) - Ehh. It was certainly an entertaining read, but of little practical value. He describes how to create memory palaces so that you can rapidly memorize things like decks of cards, but that sort of stuff doesn't help me with being absent-minded and forgetting where I left my phone. There's some good discussion in the book about the pros and cons (and history of) of developing your memory which I found interesting.
  • Revelation Space (Alastair Reynolds) - Science fiction book. Pretty good overall although I was unsatisfied with the ending.
  • Your Money or Your Life (Vicki Robin, Joe Dominguez) - Pretty comprehensive book on personal finance management. I only skimmed this because there wasn't much in here that I didn't already know, either from reading The Wealthy Barber or my own experiments. But a good book if you're looking for something in this category.
  • Influence: The Psychology of Persuasion (Robert Cialdini) - Another must-read book. All about the subtle ways people exert influence on you, and what you can do to defend against it. What surprises me here is how easy it is to drastically improve the odds that somebody will agree to do something they fundamentally don't want to just by using a few of these tricks. (You can also use this knowledge to influence others, although the book is not written from that standpoint.)
  • Drawing on the Right Side of the Brain (Betty Edwards) - This book teaches you how to draw, and more importantly, how to see things differently. I haven't finished this book yet but I have gotten through enough to know it's good. If you're looking for a hobby I suggest picking up this book. Note that my best drawings prior to starting this book are in the form of stick figures, but I'm already confident that I will be able to draw well after finishing this book and practicing some.
  • Dogfight (Fred Vogelstein) - I started this book recently but abandoned it. I don't know why I even started to read it, but it wasn't worth the time.

That is all.


[ « Newer ][ View: List | Cloud | Calendar | Latest comments | Photo albums ][ Older » ]

(c) Kartikaya Gupta, 2004-2024. User comments owned by their respective posters. All rights reserved.
You are accessing this website via IPv4. Consider upgrading to IPv6!