is there an algebraic formula I can use to determine compression ratio?

Aha, some engineering calculations. This is my forte

The answer is yes. But only if you know what the CR was before you put the thicker gasket or shorter rod in. Otherwise you need to go back to first principles and measure the combustion chamber volume as Vince described.

To make a formula, we need to set a few variables, so let's say:

CR

_{1} = the original compression ratio

CR

_{2} = the compression ratio after you've added the gasket (or shortened the rod)

D = cylinder displacement in cc (ie. 1/3 of engine displacement if it's a triple cylinder engine, half if it's a twin)

π = Pi = 3.14159

b = cylinder bore in mm

d = the distance in mm by which you increase the cylinder head-piston clearance (the 0.5 or 0.4mm you're talking about).

Note, it doesn't matter whether the extra combustion chamber space is achieved by shortening the rod or using a thicker head or base gasket.

The piston stroke and engine displacement remain the same.

Then the formula will be (I hope this comes out looking ok with denominators in the right place)

CR

_{2} =

1 1 +

π x b^{2} x d CR

_{1} 4000 x D

I can go through the algebraic steps I used to derive the above formula if you're interested.

PS. I just added a little Excel sheet to do the calculation for you.