Skip to content

Instantly share code, notes, and snippets.

@XerxesZorgon
XerxesZorgon / sqrt2.lean
Created July 25, 2026 18:47
Proof the square root of two is irrational using Lean Theorem Prover.
import Mathlib
theorem sqrt_two_core {m n : ℕ} (h : m.Coprime n) : m ^ 22 * n ^ 2 := by
intro hmn
-- 2 ∣ m², and 2 is prime, so 2 ∣ m
have hm : 2 ∣ m := Nat.Prime.dvd_of_dvd_pow Nat.prime_two ⟨n ^ 2, hmn⟩
obtain ⟨k, hk⟩ := hm
-- substitute m = 2k and cancel a factor of 2
have hk2 : 2 * k ^ 2 = n ^ 2 := by
have : 2 * (2 * k ^ 2) = 2 * n ^ 2 := by rw [← hmn, hk]; ring
@XerxesZorgon
XerxesZorgon / bessel.wb
Created July 25, 2026 18:44
A Wolfram notebook describing the Bessel function.
{
"cells": [
{
"kind": 1,
"value": "## Bessel Functions in Three Dimensions",
"languageId": "markdown",
"outputs": [],
"metadata": {}
},
{
@XerxesZorgon
XerxesZorgon / lorenz.jl
Created July 25, 2026 18:41
A Pluto notebook demonstrating interactivity using the Lorenz attractor as an example
### A Pluto.jl notebook ###
# v1.0.3
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
#! format: off
return quote
@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