Skip to content

Instantly share code, notes, and snippets.

@XerxesZorgon
XerxesZorgon / rotating_squares.m
Created May 18, 2026 00:55
Generates a video of rotating squares with a trace of the path of the smallest square
function rotating_squares(n_squares)
%ROTATING_SQUARES Animate a chain of N squares linked at corners.
%
% Geometry
% --------
% Each child square has sides 1/3 of its parent. One corner of the child
% is pinned to the top-right corner of the parent and rotates about that
% pivot. The child's angular speed is 3× the parent's, matching the
% 1:3 perimeter ratio (rolling-contact analogy for squares).
%
@XerxesZorgon
XerxesZorgon / model.jl
Created May 1, 2026 00:20
System Dynamics model of the effects of the Hormuz Strait closure.
using ModelingToolkit, OrdinaryDiffEq
include(joinpath(@__DIR__, "parameters.jl"))
# Independent variable
@independent_variableusing ModelingToolkit, OrdinaryDiffEq
include(joinpath(@__DIR__, "parameters.jl"))
# Independent variable
@independent_variables t
@XerxesZorgon
XerxesZorgon / circular_equations.jl
Created April 20, 2026 18:28
Validates the solution found in the article "Circular Functions" describing Viete's method.
# circular_equations.jl
# Numerical verification for "Circular Functions" — Wild Peaches
# Requires: Pkg.add("Polynomials")
using Polynomials
# ── 1. Cubic 3z³ − 9z² + 6z − 1 = 0, z = x² ──────────────────
p = Polynomial([-1.0, 6.0, -9.0, 3.0]) # coefficients constant-first
z_poly = sort(real.(roots(p)))
@XerxesZorgon
XerxesZorgon / Riemann_zeta.ipynb
Created October 23, 2025 19:33
Mathematica exploration of the Riemann Zeta function
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@XerxesZorgon
XerxesZorgon / MainActivity.kt
Created April 7, 2025 15:00
Buckaroo Time app for Android. Calculates solar time based on phone's GPS location and UTC time.
package com.example.buckarootime
import android.Manifest
import android.content.pm.PackageManager
import android.os.Bundle
import android.os.Looper
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.*
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@XerxesZorgon
XerxesZorgon / redflag.jl
Created September 28, 2024 01:21
Solves a geometry problem using linear algebra and Heron's formula
#=
Solves a geometry problem using linear algebra and Heron's formula
See: Red Flag Day Geometry
using Revise
Load with: includet("redflag.jl")
=#
using LinearAlgebra
/*
The PI License
Finds a four digit prime number n such that n is
- Balanced: A prime equidistant from the previous and subsequent prime numbers.
- Odious: A number is odious if the binary representation of the number as an odd number of 1's, and is evil if the number of 1's is even.
- Happy: Add the squares of the digits to get a new number. Continue the process and if you ever get to $1$, the original number is happy.
- Apocalyptic: If 2^n contains the sequence 666, then n is apocalyptic.
Author: John Peach
@XerxesZorgon
XerxesZorgon / shock_tube.geo
Created June 18, 2024 19:48
Simple 2D Gmsh shock tube model
// Gmsh project created on Mon Jun 17, 2024
SetFactory("OpenCASCADE");
// Define points
L = 0.5; // Tube length
H = 0.05; // Tube width
N = 10; // Number of rectangles along length of the tube
Point(1) = {0, 0, 0, 1.0};
Point(2) = {L, 0, 0, 1.0};
Point(3) = {L, H, 0, 1.0};
@XerxesZorgon
XerxesZorgon / CSG_example.scad
Created June 18, 2024 19:46
OpenSCAD model of CSG tree
// Shape parameters
sphereRadius = 0.65;
cylinderRadius = 0.3;
cylinderHeight = 1.1;
// Top level difference operation
difference(){
// Intersection of cube and sphere
intersection(){