% ****************************************************************
% Cubic exponent example
% Revised to make the solution look Pythagorean, i.e. has the
%  same eigenvector properties as per the exponent n=2.
% R J Miller 07/01/2021, richard@urmt.org, www.urmt.org

% All equations display zero to the command window

% It all started around 2009 with the following 
%  Diophantine equation termed the 'Coordinate Equation'
%
%  0 = x^n + y^n - z^n + k.x.y.z, all in integers, n>=2
%
% Note that taking residues mod x,y,z gives the same congruences
%  as per FLT, except for K<>0, n>2, (Wiles/Taylor 1995). There are 
%  an infinite set of solutions for all exponents, odd, even, 
%  including Pythagoras (n=2), where k can, of course, be zero 
%  (but not necessarily).

% An example cubic solution x,y,z to the Coordinate Equation
x = 9;
y = 31;
z = 70;
k = 16; % the 'k-value'

% The Coordinate Equation - FLT with an extra term
x^3 + y^3 - z^3 + k*x*y*z

% A proof of K<>0 would give a direct proof of FLT - and no,
%  I do not have such a proof (I wish I did, but I don't).
%  Fortunately, Wiles/Taylor did the job for us!

% Whilst this solution has been shown many times before, it 
%  has not been shown with unity roots (P,Q,R below) obtained 
%  by local variations such that the eigenvector solution 
%  has identical properties to the Pythagorean solution, e.g.
%  a zero Potential energy term V=0, 
%  symmetric eigenvalues +/-C (=1) and zero,
%  plus an extensive set of conservation equations that hinge
%  upon the fact that eigenvalue C is constant for every solution
%  to the coordinate equation.

% The vector [x,y,z] is also an eigenvector to the unity root 
%  matrix 'A' defined further below

% unity roots relating to x,y,z
P = -155;
Q = 273;
R = -11;

% cubic unity roots mod x,y,z
mod(P^3,x) - 1
mod(Q^3,y) - 1
mod( mod(R^3,z) + 1, z )

% conjugate unity roots mod x,y,z, Pb ~ 'P-bar' etc.
Pb = -77;
Qb = 5;
Rb = 1209;

% cubic conjugate unity roots mod x,y,z
mod(Pb^3,x) - 1
mod(Qb^3,y) - 1
mod( mod(Rb^3,z) + 1, z )

% Unity eigenvalue 'C' to matrix A, further below.
% This eigenvalue is intentionally scaled to 
% unity ('natural units'), but need not be.
C = 1;

% Scale (divisibility) factors
a =-1326;
b = -44;
c = 190;

% Divisibility equations relating (x,y,z) (a,b,c) and
% six unity roots (P,Q,R,Pb,Qb,Rb)
(C^2 - P*Pb) - a*x
(C^2 - Q*Qb) - b*y
(C^2 - R*Rb) - c*z

% 3x3 unity root matrix
A = [0, R, Qb; Rb, 0 P; Q, Pb, 0];

Aeigs = eigs(A); % eigenvalues are +/-C,0 where C=1, unity

Xp = [x;y;z]; % col eigenvector, eigenvalue C=1
pX = [a,b,c]; % row eigenvector, eigenvalue C=1

% Eigenvector equations for unity eigenvalue
A*Xp - C*Xp % eigenvalue C
pX*A - C*pX % eigenvalue C

% Other eigenvectors - not solutions to the coordinate equation
%  but all in integers
Xm = [17;62;133]; % col eigenvector to eigenvalue -C
mX = [-702,-22,100]; % row eigenvector to eigenvalue -C
X0 = [55;195;429]; % col eigenvector to eigenvalue 0
oX = [217,7,-31]; % col eigenvector to eigenvalue 0

% the other eigenvector equations for -C and 0
A*X0 % col eigenvector to eigenvalue zero
oX*A % row eigenvector to eigenvalue zero

A*Xm + C*Xm % col eigenvector to eigenvalue -C
mX*A + C*mX % row eigenvector to eigenvalue -C

% Some physical terms, with conservation equations - valid
%  for all solutions, all exponents, with a zero potential energy
%  (gauged to zero here by local variational methods not shown, 
%   see web site papers)

% Note that the coordinate equation is also a conservation equation
K = (P*Pb + Q*Qb + R*Rb); % kinetic term
K - C^2; % Kinetic term = C^2

% Potential term V = 0, gauged to zero
V = P*Q*R + Pb*Qb*Rb
(K + V) - C^2 % conservation equation - total energy
a*x + b*y + c*z - (2*C^2 + V) % another conservation equation
pX*Xp - 2*C^2 % etc
mX*Xm - 2*C^2 % etc
oX*X0 - C^2

% Orthogonality
mX*Xp
mX*X0
oX*Xp
oX*Xm

% The above is just a snapshot...
% The constancy of the eigenvalue C and related scale invariance,
%  the curved geometry of the eigenvector space with temporal variation;
%  the natural extension to 4D, 5D and beyond, plus relativity;
%  the local and global variational methods used;
%  the numerous integer conservation equations;
%  the parametric evolution of the eigenvectors with time/freq.;
%  physical commutation equations and a quark flavour model;
%  are just some reasons why it all starts to look like Physics
% Whilst we are a long way from QG, you have to ask why
% nature would be any more complicated than basic integer arithmetic

% The rest is history...
% see the web site www.urmt.org for free PDFs
