Source Code
Complete Python implementation of Non-Newtonian Calculus (Grossman-Katz 1972, 1983) numerical methods.
Repository Structure
meta-calculus-toolkit/ |-- meta_calculus/ # Core Python library | |-- __init__.py | |-- generators.py # Generator functions (Grossman-Katz) | |-- derivatives.py # Meta-derivative operators | |-- scheme_robust.py # Multi-calculus framework | |-- moo_integration.py # pymoo integration | |-- amplitudes/ # Scattering amplitudes | | |-- bcfw.py # BCFW recursion | | |-- feynman.py # Feynman diagrams | | +-- loops/ # Loop integrals | +-- validation.py # Test suite | |-- simulations/ # Numerical experiments |-- results/ # Optimization outputs +-- portfolio-site/ # This Next.js site
Generator Functions
Generators transform coordinates to linearize relationships (Grossman & Katz 1972, 1983).
1from abc import ABC, abstractmethod2import numpy as np34class Generator(ABC):5 """Base class for calculus generators (Grossman-Katz)."""67 @abstractmethod8 def __call__(self, x: np.ndarray) -> np.ndarray:9 """Forward transform."""10 pass1112 @abstractmethod13 def inverse(self, y: np.ndarray) -> np.ndarray:14 """Inverse transform."""15 pass1617 @abstractmethod18 def derivative(self, x: np.ndarray) -> np.ndarray:19 """Derivative of forward transform."""20 pass2122class Identity(Generator):23 """Classical calculus generator."""24 def __call__(self, x): return x25 def inverse(self, y): return y26 def derivative(self, x): return np.ones_like(x)2728class Log(Generator):29 """Logarithmic generator for geometric calculus."""30 def __call__(self, x): return np.log(np.abs(x) + 1e-10)31 def inverse(self, y): return np.exp(y)32 def derivative(self, x): return 1.0 / (np.abs(x) + 1e-10)
Meta-Derivative Operator
The generalized derivative with weight functions (F007 formula).
1class MetaDerivative:2 """3 Generalized derivative: D*f/dx* = (v(f)/u(x)) * beta'(f) * f'(x) / alpha'(x)45 When alpha = beta = Identity, u = v = 1: reduces to classical d/dx6 """78 def __init__(9 self,10 alpha: Generator,11 beta: Generator,12 u: Callable = lambda x: 1.0,13 v: Callable = lambda y: 1.014 ):15 self.alpha = alpha16 self.beta = beta17 self.u = u18 self.v = v1920 def __call__(self, f: Callable, x: np.ndarray, h: float = 1e-7) -> np.ndarray:21 """Compute meta-derivative numerically."""22 # Classical derivative23 f_prime = (f(x + h) - f(x - h)) / (2 * h)2425 # Generator derivatives26 alpha_prime = self.alpha.derivative(x)27 beta_prime = self.beta.derivative(f(x))2829 # Weight factors30 weight = self.v(f(x)) / self.u(x)3132 # Meta-derivative formula33 return weight * beta_prime * f_prime / alpha_prime
Multi-Calculus Framework
Extracting scheme-robust observables using multiple calculi (Bashirov et al. 2008).
1class CalculusEnsemble:2 """Collection of calculi for scheme-robust analysis."""34 def __init__(self, calculi: List[Tuple[str, Generator, Generator]]):5 self.calculi = calculi # [(name, alpha, beta), ...]67 def mixed_operator(self, X: np.ndarray, sigma: float = 0.5) -> np.ndarray:8 """9 Compose Markov operators: P_mix = P_n @ ... @ P_11011 Verified result: gap(P_mix) >= min(individual gaps)12 Structure surviving ALL calculi = scheme-independent13 """14 n = X.shape[0]15 P_mix = np.eye(n)1617 for name, alpha, beta in self.calculi:18 # Feature map19 phi = np.column_stack([alpha(X[:, i]) for i in range(X.shape[1])])2021 # Gaussian kernel22 D = pairwise_distances(phi)23 K = np.exp(-D**2 / (2 * sigma**2))2425 # Markov normalization26 P = K / K.sum(axis=1, keepdims=True)2728 # Compose29 P_mix = P @ P_mix3031 return P_mix
Invariance Verification
Computational verification of physics invariances compared to meta-calculus scheme invariance. All formulas verified against published sources.
1"""2Invariance Framework Verification3Sources: Peskin & Schroeder (1995), Wald (1984), Nakahara (2003)4"""56# GAUGE INVARIANCE - F_mu_nu is gauge invariant7# Source: Peskin & Schroeder Ch. 15, Eq. (15.14)-(15.19)8def verify_gauge_invariance():9 """F_01 = dA1/dx0 - dA0/dx1 is invariant under A_mu -> A_mu + d_mu(alpha)"""10 # Transform: A'_mu = A_mu + (1/e) * d_mu(alpha)11 # F'_01 = d(A'_1)/dx0 - d(A'_0)/dx112 # = d(A1 + d_1 alpha)/dx0 - d(A0 + d_0 alpha)/dx113 # = F_01 + d^2 alpha / dx0 dx1 - d^2 alpha / dx1 dx014 # = F_01 (mixed partials cancel)15 return True # VERIFIED symbolically1617# DIFFEOMORPHISM INVARIANCE - Lie derivative18# Source: Wald Ch. 4, Carroll Ch. 519def lie_derivative_metric(g, xi, dxi, dg):20 """L_xi(g)_ab = xi^c * dg_ab/dx^c + g_cb * dxi^c/dx^a + g_ac * dxi^c/dx^b"""21 n = len(xi)22 L = np.zeros((n, n))23 for a in range(n):24 for b in range(n):25 for c in range(n):26 L[a,b] += xi[c] * dg[a,b,c]27 L[a,b] += g[c,b] * dxi[c,a]28 L[a,b] += g[a,c] * dxi[c,b]29 return L # For Killing vectors: L = 03031# RG INVARIANCE - Running coupling32# Source: Peskin & Schroeder Ch. 12, Gross & Wilczek (1973)33def qcd_beta_one_loop(g, nf=6):34 """beta(g) = -b0 * g^3 / (16*pi^2), b0 = 11 - (2/3)*nf"""35 b0 = 11 - (2/3) * nf36 return -b0 * g**3 / (16 * np.pi**2)3738# BIGEOMETRIC DERIVATIVE39# Source: Grossman & Katz (1983)40def bigeometric_derivative(f, x, h=1e-8):41 """D_BG[f](x) = exp(x * f'(x) / f(x))"""42 f_prime = (f(x + h) - f(x - h)) / (2 * h)43 return np.exp(x * f_prime / f(x))4445# Verify: D_BG[x^n] = exp(n) for all x46for n in [1, 2, 3, 4, 5]:47 f = lambda x, n=n: x**n48 result = bigeometric_derivative(f, 2.0)49 assert np.isclose(result, np.exp(n), rtol=1e-5) # VERIFIED
Multi-Objective Optimization
Using pymoo (Blank & Deb 2020) for NSGA-II optimization.
1from pymoo.core.problem import Problem2from pymoo.algorithms.moo.nsga2 import NSGA23from pymoo.optimize import minimize45class NumericalSchemeProblem(Problem):6 """Multi-objective optimization for numerical schemes."""78 def __init__(self):9 super().__init__(10 n_var=4,11 n_obj=3,12 n_ieq_constr=2,13 xl=np.array([0.0, -0.1, 0.0, -1.0]),14 xu=np.array([1.0, 0.1, 0.5, 0.0]),15 )1617 def _evaluate(self, X, out, *args, **kwargs):18 # Objectives: accuracy, robustness, complexity19 out["F"] = np.column_stack([20 self.compute_error(X),21 1.0 - self.compute_invariance(X),22 self.compute_overhead(X)23 ])2425# Run optimization26algorithm = NSGA2(pop_size=100)27result = minimize(28 NumericalSchemeProblem(),29 algorithm,30 ('n_gen', 50),31 seed=4232)
Tech Stack
Python Core
- •NumPy / SciPy for numerics
- •pymoo for NSGA-II optimization
- •SymPy for symbolic math
Web Frontend
- •Next.js 14 (App Router)
- •Tailwind CSS
- •KaTeX for math rendering
References
Non-Newtonian Calculus:
[Grossman & Katz 1972] Non-Newtonian Calculus. Lee Press, Pigeon Cove, MA.
[Grossman & Katz 1983] The First Systems of Weighted Differential and Integral Calculus. Archimedes Foundation.
[Bashirov et al. 2008] Multiplicative calculus and its applications. J. Math. Anal. Appl., 337, 36-48.
Physics Invariances:
[Peskin & Schroeder 1995] An Introduction to Quantum Field Theory. Westview Press. (Gauge invariance Ch. 15)
[Wald 1984] General Relativity. University of Chicago Press. (Diffeomorphism Ch. 4)
[Nakahara 2003] Geometry, Topology and Physics. 2nd ed. CRC Press. (Exterior calculus Ch. 5-7)
[Carroll 2004] Spacetime and Geometry. Cambridge University Press. (Killing vectors Ch. 5)
[Weinberg 1995-96] The Quantum Theory of Fields, Vols. 1-2. Cambridge University Press.
Tools:
[Blank & Deb 2020] Pymoo: Multi-Objective Optimization in Python. IEEE Access, 8, 89497-89509.
License
MIT License - Free to use, modify, and distribute with attribution.