Tuesday, April 22, 2025

Algebraic Types

Most programming languages have definable types.  The most common algebraic types are the structure and the tagged union.  

A structure (also known as a record) is an "and" type, also known as a "product" type.  This is because it contains a list of fields, each potentially of a different type, so you have this and that and the other.  All the fields are simultaneously valid and available.

type
    andType: struct of:
        intField: int,
        floatField: float,
        stringField: string

var 
    structVar: andType

structVar.intField = 42
structVar.floatField = 3.14
structVar.stringField = "Howdy!"

assert structVar is andType               # base type
assert structVar.stringField is string    # field type


A tagged union is an "or" type, also known as a "sum" type.  This is because it can store this or that or the other.  The tag keeps track of which subtype is currently valid.  The strength of the tagged union is in allowing it to contain multiple types, to be used for different purposes.

type
    Tags: enum of:
        intTag1, intTag2, floatTag, stringTag

    OrType1: union of thisTag: Tags:
        intTag1, intTag2: int,    # shared subtype
        floatTag: float,
        stringTag: string

var 
    orVar1: OrType1

orVar1.intTag1 = 42          # int
orVar1 = 21                  # int
orVar1 = 3.14                # error!  Can't mix types
orVar1.thisTag = stringTag   # reset tag, clear data
orVar1 = "Howdy!"            # string
orVar1.intTag2 = 21          # int
orVar1 += 12                 # ok
orVar1.thisTag = intTag1     # reset tag, keep data

assert orVar1 == 33
assert orVar1 is OrType1            # base type
assert type of orVar1 is int        # subtype
assert orVar1.thisTag == Tags.intTag1


A different sort of sum type is a typed union.  You don't need an enum for the discriminator, but you can't have two or more of the same type, either.  The strength of a typed union is the simplicity of use.

type
    OrType2: union of type:
        int, float, string

var
    orVar2: OrType2

orVar2 = 42                  # int
orVar2 += 3.14               # error!  Can't mix types.
orVar2 = 6.28                # float
orVar2 = "Howdy!"            # string

assert orVar2 is OrType2           # base type
assert type of orVar2 is string    # subtype


There is also a more primitive type:  the untagged union.  An untagged union is like a typed union but without space for remembering the subtype, so you have to keep track of what it contains separately.  It is more flexible, but much more dangerous in practical use.


type
    Dangerous: union of:
        int, float

var
    intOrFloat: Dangerous

intOrFloat = 3.14            # float
intOrFloat = 42              # int
intOrFloat += 2.5            # silent error!  
    # This compiles and runs, but has unpredictable results.

assert intOrFloat is Dangerous       # base type
assert type of intOrFloat is int     # error!  
    # The subtype is not recorded.


Sunday, April 20, 2025

HE is risen!

Light returns to the world!

Hope is renewed!

HE is risen!


Happy Easter!

Friday, April 18, 2025

250 years ago

Paul Revere's Ride
Henry Wadsworth Longfellow

Listen, my children, and you shall hear
Of the midnight ride of Paul Revere,
On the eighteenth of April, in Seventy-Five:
Hardly a man is now alive
Who remembers that famous day and year.

He said to his friend, “If the British march
By land or sea from the town to-night,
Hang a lantern aloft in the belfry-arch
Of the North-Church-tower, as a signal-light,—
One if by land, and two if by sea;
And I on the opposite shore will be,
Ready to ride and spread the alarm
Through every Middlesex village and farm,
For the country-folk to be up and to arm.”

Then he said “Good night!” and with muffled oar
Silently rowed to the Charlestown shore,
Just as the moon rose over the bay,
Where swinging wide at her moorings lay
The Somerset, British man-of-war:
A phantom ship, with each mast and spar
Across the moon, like a prison-bar,
And a huge black hulk, that was magnified
By its own reflection in the tide.

Meanwhile, his friend, through alley and street
Wanders and watches with eager ears,
Till in the silence around him he hears
The muster of men at the barrack door,
The sound of arms, and the tramp of feet,
And the measured tread of the grenadiers
Marching down to their boats on the shore.

Then he climbed to the tower of the church,
Up the wooden stairs, with stealthy tread,
To the belfry-chamber overhead,
And startled the pigeons from their perch
On the sombre rafters, that round him made
Masses and moving shapes of shade,—
By the trembling ladder, steep and tall,
To the highest window in the wall,
Where he paused to listen and look down
A moment on the roofs of the town,
And the moonlight flowing over all.

Beneath, in the churchyard, lay the dead,
In their night-encampment on the hill,
Wrapped in silence so deep and still
That he could hear, like a sentinel’s tread,
The watchful night-wind, as it went
Creeping along from tent to tent,
And seeming to whisper, “All is well!”
A moment only he feels the spell
Of the place and the hour, and the secret dread
Of the lonely belfry and the dead;
For suddenly all his thoughts are bent
On a shadowy something far away,
Where the river widens to meet the bay,—
A line of black, that bends and floats
On the rising tide, like a bridge of boats.

Meanwhile, impatient to mount and ride,
Booted and spurred, with a heavy stride,
On the opposite shore walked Paul Revere.
Now he patted his horse’s side,
Now gazed on the landscape far and near,
Then impetuous stamped the earth,
And turned and tightened his saddle-girth;
But mostly he watched with eager search
The belfry-tower of the old North Church,
As it rose above the graves on the hill,
Lonely and spectral and sombre and still.
And lo! as he looks, on the belfry’s height,
A glimmer, and then a gleam of light!
He springs to the saddle, the bridle he turns,
But lingers and gazes, till full on his sight
A second lamp in the belfry burns!

A hurry of hoofs in a village-street,
A shape in the moonlight, a bulk in the dark,
And beneath from the pebbles, in passing, a spark
Struck out by a steed that flies fearless and fleet:
That was all! And yet, through the gloom and the light,
The fate of a nation was riding that night;
And the spark struck out by that steed, in his flight,
Kindled the land into flame with its heat.

He has left the village and mounted the steep,
And beneath him, tranquil and broad and deep,
Is the Mystic, meeting the ocean tides;
And under the alders, that skirt its edge,
Now soft on the sand, now loud on the ledge,
Is heard the tramp of his steed as he rides.

It was twelve by the village clock
When he crossed the bridge into Medford town.
He heard the crowing of the cock,
And the barking of the farmer’s dog,
And felt the damp of the river-fog,
That rises when the sun goes down.

It was one by the village clock,
When he galloped into Lexington.
He saw the gilded weathercock
Swim in the moonlight as he passed,
And the meeting-house windows, blank and bare,
Gaze at him with a spectral glare,
As if they already stood aghast
At the bloody work they would look upon.

It was two by the village clock,
When he came to the bridge in Concord town.
He heard the bleating of the flock,
And the twitter of birds among the trees,
And felt the breath of the morning breeze
Blowing over the meadows brown.
And one was safe and asleep in his bed
Who at the bridge would be first to fall,
Who that day would be lying dead,
Pierced by a British musket-ball.

You know the rest. In the books you have read,
How the British Regulars fired and fled,—
How the farmers gave them ball for ball,
From behind each fence and farmyard-wall,
Chasing the red-coats down the lane,
Then crossing the fields to emerge again
Under the trees at the turn of the road,
And only pausing to fire and load.

So through the night rode Paul Revere;
And so through the night went his cry of alarm
To every Middlesex village and farm,—
A cry of defiance, and not of fear,
A voice in the darkness, a knock at the door,
And a word that shall echo forevermore!
For, borne on the night-wind of the Past,
Through all our history, to the last,
In the hour of darkness and peril and need,
The people will waken and listen to hear
The hurrying hoof-beats of that steed,
And the midnight message of Paul Revere.





Saturday, April 12, 2025

The three geometries and you

There are three different but consistent geometries, each arising from a different writing of the parallel postulate. Given a line and a point not on that line (in a common plane), how many lines can be constructed through the point that do not intersect the line?

Euclidean (flat): Exactly one.
Hyperbolic: Infinitely many.
Spherical: None.

Each geometry also has a different answer to the question, “How many degrees do the interior angles of a triangle sum to?”

Euclidean (flat): Exactly 180 degrees.
Hyperbolic: Less than 180 degrees.
Spherical: More than 180 degrees.

Cosmologists have been trying to experimentally verify which sort of geometry our universe obeys. The answer they have found is: both Euclidean and hyperbolic, depending on how you measure things. (Non-accelerating objects follow straight paths. Accelerating objects follow hyperbolic paths.) This troubles them deeply. They consider this a contradiction.

I say there are no contradictions, and that they are missing the spherical aspect of the particle. Embrace the healing power of AND!



Space itself is flat and euclidean. Accelerated motion is necessarily hyperbolic (inverse), because it is the sum (integral) of an inverse square force. Particles are ellipsoids with an inside and an outside. The properties of the inside of a particle do not necessarily translate, either directly or indirectly, to a force outside the particle.

Take quantum spin as an example. Despite what many physicists have been taught to believe, it really is spin. (If it looks like a duck, walks like a duck, quacks like a duck, and lays eggs that hatch into ducklings, then denying it is a duck is a religious belief.) But it is a sort of spin that has little effect outside the boundaries of the particle itself. It doesn’t bend spacetime. It doesn’t generally cause the particle to exhibit curved motion. It “merely” prevents two similar half-integer spin particles from occupying the same space. Which is a profound effect - but only on the behaviors of the particles, not on the field which they inhabit. Oh, and it helps differentiate particles with identical electric charge. (It also gives them slightly different energy levels depending upon the direction of spin, and doesn’t that put the cat among the canaries?)

No matter our frame of reference, we always measure the rate of spin as identical.
No matter our frame of reference, we always measure electric charge as identical.
No matter our frame of reference, we always measure rest mass as identical.

This is not a coincidence. It is an effect. What’s going on inside those particles is operating in a different geometry from the fields they influence and are influenced by.

The space and time we experience in everyday life is flat and Euclidean.
The potential energy (gravity) and electromagnetic fields are inherently hyperbolic.
Particles are ellipsoids (spherical geometry) with a distinct inside and outside.

The difference between hyperbolic gravity and Euclidean space and time causes the strange effects of relativity.  The difference between spherical particles and hyperbolic fields causes the strange effects of quantum mechanics.

Particles and fields are separate but intertwined.  Everything is made of geometry, but not everything is made of the same geometry.

New Familiars tales!

Alma Boykins' latest Familiars book is out now! Enjoy several stories of mages, their familiars, and other workers of magic doing their thing.  Mostly, they just try to do their jobs without any fuss, muss or bother.  Alas, there's always That One Guy who just can't behave himself or leave things well enough alone.

Highly recommended.  You don't have to be familiar with the other works in the series to enjoy this one.  It's a stand-alone series of shorts about a variety of people, places, and Things.




Wednesday, April 9, 2025

There are no gravitons

There are no gravitons. There is no “need” for gravitons. There is only the potential energy field (spacetime), and the curves (waves) in that field created by and acting upon particles.

The field deforms as e/x^2 - the inverse square law of most forces. The cumulative effect upon another particle is as e/x - hyperbolic motion. Relativistic effects come from projecting the curved reality of the 4D field upon flat 3D space.

Feynman diagrams use an infinite regression of ever more complex arrangements of “virtual” particles to explain interactions. These diagrams have shown themselves to be useful shorthand for preparing the mathematics of quantum interactions. But what scientists continually forget is that the map is not the territory. “Virtual” means “not real”. There are no virtual particles. What exists is the entire rest of the universe, a vast array of particles creating and reacting to waves over unimaginable time periods. This results in a wide variety of waves interacting with each other, the particles under observation, and everything else they encounter, creating yet more waves through these interactions. It’s a chaotic (not just in the mathematical sense) mess.

A particle, if traveling quickly enough, does not necessarily follow the path of the waves it makes. (There are exceptions, like electron orbitals.) It can’t, as these waves propagate at finite speed, barely preceding the particle itself. It instead predominately follows the paths created by the waves generated from every other particle in existence - which we cannot with any real accuracy know. A slowly moving particle follows the path of these other waves, plus those created by its own waves propagating at the speed of causality and interacting with every other wave and particle they encounter. This looks an awful lot like a random assortment of chaos, with less and less predictable results for the particle under examination the longer it goes between observations. And thus, the semi-mystical randomness of traditional quantum physics.

The fundamental error of particle physics is to focus on just a few particles in an interaction and ignore the entire rest of the universe. They do this because it simplifies the math. This then produces nonsensical results like the measurement problem, the insistence that particles travel every infinite path on their way from here to there (violating every other known law of physics on the way), the observer effect and wave function collapse, and so forth. If the theory is not mathematically consistent (and quantum dynamics is not), if the calculations regularly result in infinities and singularities, if the calculations require renormalization (periodically throwing out your results and replacing them with experimentally determined values), then the theory is wrong.

The quantum wave equation is a measure of our necessary ignorance of conditions, not of some bizarre, inherent “unknowableness” of the laws of nature themselves. It would be laughable were it not so sad that those entrusted to study the most base layers of the laws of reality are taught to believe that reality has no inherent laws.

Copenhagen interpretation delenda est!

Thursday, April 3, 2025

The stress-energy tensor and you

No, this is not a cheesy filmstrip.  Although there is an element of nostalgia about those sorts of things.  This is an updated version of the previous post, which got borked by Blogger.

The stress-energy tensor.  It sounds scary, and it looks intimidating.  It's a mathematical tool to represent geometry with numbers, and that seldom is easy or clean.

By Maschen, based on File:StressEnergyTensor.svg created by Bamse - Own work, CC0, https://commons.wikimedia.org/w/index.php?curid=24940142


The stress-energy tensor is a measure of the potential energy field (AKA spacetime) and how it moves matter. It pushes, it rotates, it stretches and contracts. It’s really all about these red “force” curves.  And it's not all that hard to understand once you have a picture to guide you.


The stress-energy tensor applies to every point in spacetime, here simplified to a single horizontal space axis and vertical time/potential energy axis. Read the indices as “a in the direction of b”. The coordinate scheme is as follows:
0 = time
1 = x axis
2 = y axis
3 = z axis


Energy density (value) is the depth of the red “force” curves. It’s how far the “force” curve (red, inverse square) is below the horizontal axis at any given point. This only requires a single number. (For the particle itself, it’s the green energy line.) Remember, this is the potential energy field. A lack of energy here is the existence of energy in some other form in some other field. Yes, this component is time in the direction of time. Time is, after all, the source and measure of potential energy.


Momentum density (gradient) is the slope of the red “force” curve. This takes three numbers, one for each direction through space, as modified by time. That’s how you show velocity through spacetime (four-momentum) and the Lorentz factor of relativity. (For the particle itself, it’s the slope of the internal green energy line. In this case, a stationary particle has a slope of 0.)


Shear stress (curl) is the rotation of the “force” curve in the three possible planes - xy, xz, yz. It’s curved motion, and is the reason why the Earth is attracted to where the sun is, not where it was 8 minutes ago. I can’t draw well enough to show that. Use your imagination. You’ve seen water forming a whirlpool as it goes down a drain. (See also frame dragging.)


Pressure (divergence) is deformation, or the sink effect of the particle in the middle.  There are no sources, because the potential energy field is maxed out when their are no other influences.


You may have noticed the diagonal symmetry of the stress-energy tensor. For my purposes, the bottom-left "flux" portion represents the actions of the force curve (red lines), and the upper portion represents the actions of the particle itself.  The usual way of formatting the spacetime stress energy tensor has the two sides symmetric across the diagonal.