search
Saturday, 2014 May 10, 16:30 — curve-fitting, neep-neep

naming is hard

I often have trouble giving meaningful concise names to variables in the programs I write, perhaps because, until I reach for the keyboard, my thinking is largely nonverbal. I suspect that it would be less of a problem for someone more exposed to the accumulated lore of programmer culture; though perhaps not in this case:

I’m thinking of breaking up this process into multiple rounds, to obtain increasing degrees of geometric continuity. The initial nodes would coincide with the input dots but have no defined theta (tangent angle) or kappa (curvature); the first round of replacements determines theta for G¹ continuity, the next round determines kappa (the first derivative of theta) for G² continuity — and subsequent rounds may seek higher degrees of continuity by matching further derivatives.

This means that the node object, instead of exactly two fields called theta and kappa, should have a list of theta and its known derivatives (one more than the current replacement-round needs), and I’m at a loss for a good name for this list.

Tuesday, 2014 April 1, 01:44 — curve-fitting

relax

This curve-fitting thingy is one of several projects on which I’ve made progress in rare fits over several years. It ran into two big snags. I haven’t found how to determine which gridpoints are within the pen-width of a blending arc; two methods that ought to work don’t. (What would help: tutoring in drawing pictures in a MacOS display, so that I might have a better idea where they go wrong. And a pony.)

The other snag is this: For each pair of arcs, there is an infinite family of blending arcs; how to choose the osculation points to minimize rapid changes in curvature, while meeting the gridpoint constraints? ( . . more . . )

Saturday, 2014 February 1, 18:32 — mathematics, neep-neep

FCC cube generator

I could have used this a week ago.

def fccstack():
	newlimit = 0
	while True:
		oldlimit = newlimit
		newlimit += 1
		# extend z
		for x in xrange(oldlimit):
			for y in xrange((x+oldlimit)&1, oldlimit, 2):
				yield (x,y,oldlimit)

		# extend y
		for x in xrange(oldlimit):
			for z in xrange((x+oldlimit)&1, newlimit, 2):
				yield (x,oldlimit,z)

		# extend x
		for y in xrange(newlimit):
			for z in xrange((y+oldlimit)&1, newlimit, 2):
				yield (oldlimit,y,z)

g = fccstack()
for dummy in xrange(512):
	p,q,r = g.next()
	print "%d %d %d\t%d" % (p,q,r, p+q+r)

This lists coordinates of sites in a face-centred cubic lattice, filling the smallest cube that contains the number of sites required.

Monday, 2014 January 27, 16:28 — mathematics

some thoughts about packing

My bundle of 19 fullerenes is arranged in a face-centred cubic lattice, each ball occupying one of the 24 even-numbered cells of a 4×4×3 array (and parts of the adjacent cells). The spacing of the grid planes is determined by the sums of the radii of the circumspheres of nearest-neighbor balls.

There appears to be much more ‘daylight’ between balls than necessary. That’s not a problem here, as the size of the bounding box is not near the limits of the process; but still it got me thinking about how to tighten the packing. ( . . more . . )

Saturday, 2013 November 16, 18:09 — Cascadia, eye-candy, mathematics

as many as it takes

allRGB: images in which each of 16 million colors occurs exactly once. (Found at MathPuzzle.) I see I’m not the only one to think of the Hilbert curve idea, but I’ll post two others.

In unrelated news, I was surprised today to find some late blackberries, bland but wholesome.

Saturday, 2013 August 31, 20:21 — curve-fitting

it’s all connected

My old calculus book gives a formula for the curvature of a parametric arc in the plane — that is, an arc defined by two functions (x(t),y(t)) of one variable. For thirty years I didn’t think about the derivation of that formula. Just now it hit me (and I did the algebra to confirm) that, in terms of the complex plane (z=x+iy), the curvature formula is equivalent to

Im(z″/z′) / |z′|

This should improve my cubic approximations to transcendental curves.

Sunday, 2013 March 10, 15:44 — mathematics

better my computer than me

My computer ran for eight solid days to extend this table from six rows — (2 3 7), (2 4 5), (3 3 4), (2 3 ∞), (2 ∞ ∞), (∞ ∞ ∞), each of which is (in some sense) minimal — to 106, by request. I don’t know why anyone would want all those others; I see no qualitative difference between any of them and one or more of the six.

Now that the run is done, I look again at my code and see where it could be made more efficient, by changing from complex to real arithmetic; I’ve already done that in my other hyperbolic programs, the ones that generate the ribbon patterns.

« Previous PageNext Page »