About the Scheme code

This is about this Scheme code that I use to ferret my abundant algebra errors. Numerical differentiation and integration confirm stuff at a higher level. Thank Wolfram too. I don’t load all these definitions into a Scheme REPL at once although I suppose that I could. I load those that I need, most often because the interpreter identifies free variables in other expressions I enter.

Down thru “functions f and g should be near” is merely to check Wofram’s indefinite integral. This is the integral necessary to express the potential field of a stick. All’s well.

In the following I use the term ‘field’ to refer to a function that takes three real arguments which locate a point and returns the scalar value of some gravitational potential field at that point. Two letter identifiers beginning with ‘c’ denote fields.

p1 is perhaps the simplest field for the unit stick (the 1-simplex). See px, pu and pd later for possible improvements as a double stick.

p0 is the 0-simplex used occasionally to corroborate things like poi.

poi numerically computes the poisson function ∂2p/∂x2 + ∂2p/∂y2 + ∂2p/∂z2 for a potential field p.

pv composes the field of the unit stick from two half sticks. pu is merely the field associated with two unit sticks joined to make a double length stick. This variation confirms out intuition as to how fields scale, which is reified in routines mm and siz below.

Confirming scaling notions we form the double stick field by scaling (px) and by abutting two sticks (pu). Four equivalent variations on pd follow stressing symmetry or efficiency.

(pg u d) generates the field of some stick on the X-axis running from u to d. It has not been tested much.

(ni l u f) performs a simple numerical integration of a function f between two limits l and u.

(brick L B D) is the field of a brick with corners (±L, ±B, ±D). br1 is like brick but avoids division by 0. br2 = br1. (stke L B) potential at center of square face of an L by B by B brick.

Given a field p, ((tran x y z) p) produces a congruent field translated by the vector (x, y, z).

Given a field p, ((siz z) p) produces a similar field scaled by z. This corresponds to geometrically scaling the producing mass but retaining the mass magnitude.

Given a field p, ((mm z) p) produces a field whose magnitude at each point is z times the magnitude of p.

With functions tran, siz and mm I understand the definition of p2c which is transformed in a few steps to the equivalent function pqc, q.v. which is closer to being integrable.

Any triangle is similar, for some x' and y', to the triangle whose vertices are at (0, 0, 0), (1, 0, 0), (1, x', y'). (pqc x' y') produces the field of the latter triangle with mass ½. The mass is distributed uniformly in the triangle. This function relies on numerical integration.

We now define away the function p1 the pqc relies on. We derive several successive definitions of prc: The last amounts to:
prc(x', y')(X Y Z) =
I(L2 − 2x' + 1, L1 + 2(X + x') − 2, L0 − 2X + 1, x'−1, 1−x) − I(L2, L1, L0, x', −X)
L2 = x'2 + y'2
L1 = −2(Xx' + Yy')
L0 = X2 + Y2 + Z2
I(a, b, c, d, e) = Integtal from 0 to 1 of log (√(ax2 + bx + c) + dx + e)

Wolfram gives this or this as the indefinite integral. Ouch!

Perhaps the ascii text form is machinable. Perhaps I should buy Mathematica.