Skip to main content

Zhouyi 6-Bit Combinatorial State Matrix & True Solar Time Engine (2^6 = 64)

An open, zero-dependency Python & TypeScript reference specification mapping the classical 64 hexagrams of the Zhouyi (I Ching / Book of Changes) onto a 6-bit binary hypercube (Q₆ = {0, 1}⁶), paired with exact line-generation probability distributions (1:3:3:1 vs 1:3:5:7) and astronomical Equation-of-Time True Solar Time calibration.

Installation (PyPI & npm)

Zero runtime dependencies across both Python (>=3.8) and Node.js / TypeScript (ESM + CommonJS + .d.ts):

# Python (PyPI)
pip install zhouyi-6bit

# CLI usage
zhouyi-6bit --method yarrow
zhouyi-6bit --shao-yong 16 85
zhouyi-6bit --hex 16

# Node.js / TypeScript (npm)
npm install zhouyi-6bit

Live Interactive Workbenches & Reference Modules

Open-Source 64-State JSON Dataset (hexagrams_64_binary.json)

This repository ships a machine-readable MIT-licensed dataset at hexagrams_64_binary.json containing all 64 King Wen states (#1–#64) with Unicode symbols (U+4DC0–U+4DFF), Pinyin, English titles, upper/lower trigrams, bottom-to-top bits_L1_to_L6 vectors, Shao Yong decimal indices (0–63), nuclear (Hu Gua), opposite (Cuo Gua), and inverted (Zong Gua) bitstrings, and canonical hexsage.ai/hexagrams/... reference URLs.


1. Combinatorial Geometry on the 6-Bit Hypercube (Q₆)

Each hexagram state is represented from bottom line (L₁) to top line (L₆) as a 6-bit binary vector s ∈ {0, 1}⁶:

  • 0 = Broken line (Yin)
  • 1 = Solid line (Yang)

When k ∈ {0, …, 6} lines are marked as moving (6 Old Yin 0 → 1, or 9 Old Yang 1 → 0), the primary state s transitions via bitwise XOR with mask m ∈ {0, 1}⁶ (s' = s ⊕ m), traversing a Hamming distance d_H(s, s') = k across the 64 × 64 = 4,096 directed transition graph.


2. Exact Line Probability Distributions (3-Coin vs 50-Stalk)

Line Value Classical Name Transition Operator 3-Coin Binomial (P) 50-Stalk Yarrow (P)
6 Old Yin (Lao Yin) Moving Yin (0 → 1) 2 / 16 (12.50%) 1 / 16 (6.25%)
7 Young Yang (Shao Yang) Stable Yang (1 → 1) 6 / 16 (37.50%) 5 / 16 (31.25%)
8 Young Yin (Shao Yin) Stable Yin (0 → 0) 6 / 16 (37.50%) 7 / 16 (43.75%)
9 Old Yang (Lao Yang) Moving Yang (1 → 0) 2 / 16 (12.50%) 3 / 16 (18.75%)

Notice that under the classical 50-stalk protocol (49 active stalks after setting aside the Taiji stalk), Old Yang (9, 18.75%) occurs three times as frequently as Old Yin (6, 6.25%), whereas total moving-line probability remains invariant at P(6) + P(9) = 4/16 = 25.0% under both protocols.


3. Shao Yong Deterministic Modulo Coordinate Mapping

Given two positive integers (N₁, N₂):

  • Upper Trigram Index (1 … 8): U = ((N₁ − 1) mod 8) + 1
  • Lower Trigram Index (1 … 8): L = ((N₂ − 1) mod 8) + 1
  • Moving Line Coordinate (L₁ … L₆): M = ((N₁ + N₂ − 1) mod 6) + 1

Quickstart (Python & TypeScript)

from zhouyi_6bit_engine import shao_yong_cast, true_solar_time_offset_minutes

state = shao_yong_cast(16, 85)
# {'upper_trigram': 'Kun', 'lower_trigram': 'Xun', 'moving_line': 5,
#  'primary_bits_L1_to_L6': '011000', 'resulting_bits_L1_to_L6': '011010'}

offset_min = true_solar_time_offset_minutes(longitude_deg=114.1694, std_meridian_deg=120.0, day_of_year=307)
import { shaoYongCast, trueSolarTimeOffsetMinutes } from "./zhouyi_6bit_engine";

const transition = shaoYongCast(16, 85);
const solarOffset = trueSolarTimeOffsetMinutes(114.1694, 120.0, 307);

4. Astronomical True Solar Time Calibration

Standard civil timezones quantize longitude into 15° bands, introducing up to ±30+ minutes of solar phase error combined with orbital eccentricity. True Solar Time applies both observer longitude λ_local and the Equation of Time:

Δt_solar(min) = 4 × (λ_local − λ_zone) + 9.87 sin(2B) − 7.53 cos(B) − 1.5 sin(B)
where B = (360° / 365) × (d − 81), for day-of-year d ∈ [1, 365]

5. 2K Mathematical Video Visualizations

Companion 2K UltraHD mathematical lectures published on the official HexSage YouTube Channel:


License

MIT License · Maintained by the HexSage Classical Systems Research Team (hexsage.ai · Consult the I Ching).

Metadata

Release files for zhouyi-6bit 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zhouyi-6bit 1.1.0
File Size Uploaded Provenance Actions
zhouyi_6bit-1.1.0.tar.gz 16.9 kB Without provenance Details for zhouyi_6bit-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zhouyi-6bit 1.1.0
File Interpreter ABI Platform Actions
zhouyi_6bit-1.1.0-py3-none-any.whl Python 3 none any Details for zhouyi_6bit-1.1.0-py3-none-any.whl

Total release size: 30.3 kB

Release files / zhouyi_6bit-1.1.0.tar.gz

Download URL zhouyi_6bit-1.1.0.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
499f8aad2ec721953633cd8eda321285047ef4527bae328006641dd598abce2b
BLAKE2b-256 checksum
How to use checksums
84a3d25de455e7ef93c2e0f478199fcb36e6b7cc7538cc76820090dc48283879
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / zhouyi_6bit-1.1.0-py3-none-any.whl

Download URL zhouyi_6bit-1.1.0-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03acdec9740b726482b0f73c5631bb91a40e4eab75fdcc27f566f36a0a0cb21d
BLAKE2b-256 checksum
How to use checksums
c854f830b2a8b32cc144b68787f38a8c466d8ec86d0bb98e3aac850c20aab7fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for zhouyi-6bit 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page