Initial commit.
This commit is contained in:
commit
9505a92e45
209
Manifest.toml
Normal file
209
Manifest.toml
Normal file
|
@ -0,0 +1,209 @@
|
|||
# This file is machine-generated - editing it directly is not advised
|
||||
|
||||
julia_version = "1.10.0"
|
||||
manifest_format = "2.0"
|
||||
project_hash = "330ae72911c5e15b75d63a69bc945ccbce1e0db0"
|
||||
|
||||
[[deps.ArgTools]]
|
||||
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
|
||||
version = "1.1.1"
|
||||
|
||||
[[deps.Artifacts]]
|
||||
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
|
||||
|
||||
[[deps.Base64]]
|
||||
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
|
||||
|
||||
[[deps.CodeTracking]]
|
||||
deps = ["InteractiveUtils", "UUIDs"]
|
||||
git-tree-sha1 = "c0216e792f518b39b22212127d4a84dc31e4e386"
|
||||
uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
|
||||
version = "1.3.5"
|
||||
|
||||
[[deps.CompilerSupportLibraries_jll]]
|
||||
deps = ["Artifacts", "Libdl"]
|
||||
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
|
||||
version = "1.0.5+1"
|
||||
|
||||
[[deps.Dates]]
|
||||
deps = ["Printf"]
|
||||
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
|
||||
|
||||
[[deps.Distributed]]
|
||||
deps = ["Random", "Serialization", "Sockets"]
|
||||
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
|
||||
|
||||
[[deps.Downloads]]
|
||||
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
|
||||
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
|
||||
version = "1.6.0"
|
||||
|
||||
[[deps.FileWatching]]
|
||||
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
|
||||
|
||||
[[deps.InteractiveUtils]]
|
||||
deps = ["Markdown"]
|
||||
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
|
||||
|
||||
[[deps.JuliaInterpreter]]
|
||||
deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"]
|
||||
git-tree-sha1 = "7b762d81887160169ddfc93a47e5fd7a6a3e78ef"
|
||||
uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a"
|
||||
version = "0.9.29"
|
||||
|
||||
[[deps.LibCURL]]
|
||||
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
|
||||
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
|
||||
version = "0.6.4"
|
||||
|
||||
[[deps.LibCURL_jll]]
|
||||
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
|
||||
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
|
||||
version = "8.4.0+0"
|
||||
|
||||
[[deps.LibGit2]]
|
||||
deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"]
|
||||
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
|
||||
|
||||
[[deps.LibGit2_jll]]
|
||||
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"]
|
||||
uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5"
|
||||
version = "1.6.4+0"
|
||||
|
||||
[[deps.LibSSH2_jll]]
|
||||
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
|
||||
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
|
||||
version = "1.11.0+1"
|
||||
|
||||
[[deps.Libdl]]
|
||||
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
|
||||
|
||||
[[deps.LinearAlgebra]]
|
||||
deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"]
|
||||
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
||||
|
||||
[[deps.Logging]]
|
||||
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
|
||||
|
||||
[[deps.LoweredCodeUtils]]
|
||||
deps = ["JuliaInterpreter"]
|
||||
git-tree-sha1 = "31e27f0b0bf0df3e3e951bfcc43fe8c730a219f6"
|
||||
uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
|
||||
version = "2.4.5"
|
||||
|
||||
[[deps.Markdown]]
|
||||
deps = ["Base64"]
|
||||
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
|
||||
|
||||
[[deps.MbedTLS_jll]]
|
||||
deps = ["Artifacts", "Libdl"]
|
||||
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
|
||||
version = "2.28.2+1"
|
||||
|
||||
[[deps.MozillaCACerts_jll]]
|
||||
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
|
||||
version = "2023.1.10"
|
||||
|
||||
[[deps.NetworkOptions]]
|
||||
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
|
||||
version = "1.2.0"
|
||||
|
||||
[[deps.OpenBLAS_jll]]
|
||||
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
|
||||
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
|
||||
version = "0.3.23+2"
|
||||
|
||||
[[deps.OrderedCollections]]
|
||||
git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5"
|
||||
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
|
||||
version = "1.6.3"
|
||||
|
||||
[[deps.Pkg]]
|
||||
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
|
||||
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
|
||||
version = "1.10.0"
|
||||
|
||||
[[deps.Printf]]
|
||||
deps = ["Unicode"]
|
||||
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
|
||||
|
||||
[[deps.REPL]]
|
||||
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
|
||||
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
|
||||
|
||||
[[deps.Random]]
|
||||
deps = ["SHA"]
|
||||
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
|
||||
|
||||
[[deps.Requires]]
|
||||
deps = ["UUIDs"]
|
||||
git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7"
|
||||
uuid = "ae029012-a4dd-5104-9daa-d747884805df"
|
||||
version = "1.3.0"
|
||||
|
||||
[[deps.Revise]]
|
||||
deps = ["CodeTracking", "Distributed", "FileWatching", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "Pkg", "REPL", "Requires", "UUIDs", "Unicode"]
|
||||
git-tree-sha1 = "12aa2d7593df490c407a3bbd8b86b8b515017f3e"
|
||||
uuid = "295af30f-e4ad-537b-8983-00126c2a3abe"
|
||||
version = "3.5.14"
|
||||
|
||||
[[deps.SHA]]
|
||||
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
|
||||
version = "0.7.0"
|
||||
|
||||
[[deps.Serialization]]
|
||||
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
|
||||
|
||||
[[deps.Sockets]]
|
||||
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
|
||||
|
||||
[[deps.TOML]]
|
||||
deps = ["Dates"]
|
||||
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
|
||||
version = "1.0.3"
|
||||
|
||||
[[deps.Tar]]
|
||||
deps = ["ArgTools", "SHA"]
|
||||
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
|
||||
version = "1.10.0"
|
||||
|
||||
[[deps.UUIDs]]
|
||||
deps = ["Random", "SHA"]
|
||||
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
|
||||
|
||||
[[deps.Unicode]]
|
||||
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
|
||||
|
||||
[[deps.Unitful]]
|
||||
deps = ["Dates", "LinearAlgebra", "Random"]
|
||||
git-tree-sha1 = "3c793be6df9dd77a0cf49d80984ef9ff996948fa"
|
||||
uuid = "1986cc42-f94f-5a68-af5c-568840ba703d"
|
||||
version = "1.19.0"
|
||||
|
||||
[deps.Unitful.extensions]
|
||||
ConstructionBaseUnitfulExt = "ConstructionBase"
|
||||
InverseFunctionsUnitfulExt = "InverseFunctions"
|
||||
|
||||
[deps.Unitful.weakdeps]
|
||||
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
|
||||
InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112"
|
||||
|
||||
[[deps.Zlib_jll]]
|
||||
deps = ["Libdl"]
|
||||
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
|
||||
version = "1.2.13+1"
|
||||
|
||||
[[deps.libblastrampoline_jll]]
|
||||
deps = ["Artifacts", "Libdl"]
|
||||
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
|
||||
version = "5.8.0+1"
|
||||
|
||||
[[deps.nghttp2_jll]]
|
||||
deps = ["Artifacts", "Libdl"]
|
||||
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
|
||||
version = "1.52.0+1"
|
||||
|
||||
[[deps.p7zip_jll]]
|
||||
deps = ["Artifacts", "Libdl"]
|
||||
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
|
||||
version = "17.4.0+2"
|
8
Project.toml
Normal file
8
Project.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
name = "IIPAU"
|
||||
uuid = "213df8b5-502b-4410-90c7-22a71c9caf95"
|
||||
authors = ["Louis Burke <lburke@labprogramming.net>"]
|
||||
version = "0.1.0"
|
||||
|
||||
[deps]
|
||||
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
|
||||
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
|
194
src/IIPAU.jl
Normal file
194
src/IIPAU.jl
Normal file
|
@ -0,0 +1,194 @@
|
|||
# Useful information:
|
||||
#
|
||||
# https://en.wikipedia.org/wiki/List_of_physical_quantities
|
||||
# https://www.themeasureofthings.com/
|
||||
#
|
||||
# "free" Unitful units: efijno r v xzDEIOQUXZ |
|
||||
# "used" Unitful units: e i p t w |
|
||||
module IIPAU
|
||||
|
||||
import Unitful
|
||||
using Unitful: @unit, @affineunit, @u_str
|
||||
export item
|
||||
export @b6_str
|
||||
export yocte, zepte, atte, femte, pice, nane, micre, mille, cente, dice
|
||||
export yotte, zette, exe, pete, tere, gige, mege, kile, hecte, dece
|
||||
|
||||
export pace, tick, egg
|
||||
|
||||
|
||||
function __init__()
|
||||
Unitful.register(IIPAU)
|
||||
end
|
||||
#Unitful.register(IIPAU)
|
||||
|
||||
# Additional Constants
|
||||
kₑ = 8987551792u"N*m^2/C^2"
|
||||
mₑ = 9.109e-31u"kg"
|
||||
mᵤ = 1.6605390666e-27u"kg"
|
||||
mₙ = 1.674927498e-27u"kg"
|
||||
kb = 1.380649e-23u"J/K"
|
||||
ϵ₀ = 8.854e-12u"F/m"
|
||||
|
||||
# Natural Units
|
||||
@unit lₛ "lₛ" StoneyLength (sqrt(Unitful.G * kₑ * Unitful.q^2 / Unitful.c^4) |> Unitful.upreferred) false
|
||||
@unit mₛ "mₛ" StoneyMass (sqrt(kₑ * Unitful.q^2 / Unitful.G) |> Unitful.upreferred) false
|
||||
@unit tₛ "tₛ" StoneyTime (sqrt(Unitful.G * kₑ * Unitful.q^2 / Unitful.c^6) |> Unitful.upreferred) false
|
||||
|
||||
@unit lₚ "lₚ" PlanckLength sqrt(Unitful.ħ * Unitful.G / Unitful.c^3) false
|
||||
@unit mₚ "mₚ" PlanckMass sqrt(Unitful.ħ * Unitful.c / Unitful.G) false
|
||||
@unit tₚ "tₚ" PlanckTime sqrt(Unitful.ħ * Unitful.G / Unitful.c^5) false
|
||||
@unit Tₚ "Tₚ" PlanckTemperature sqrt(Unitful.ħ * Unitful.c ^ 5 / (Unitful.G * Unitful.k ^ 2)) false
|
||||
@unit qₚ "qₚ" Planckcharge sqrt(4π * Unitful.ϵ0 * Unitful.ħ * Unitful.c) false
|
||||
@unit Qₚ "Qₚ" PlanckCharge sqrt(Unitful.ϵ0 * Unitful.ħ * Unitful.c) false
|
||||
item = @unit count "count" Count (1 / Unitful.Na) false
|
||||
|
||||
# Senary prefixes
|
||||
function base6(number::AbstractString)
|
||||
if occursin('e', number)
|
||||
(digits, exponent) = split(number, 'e')
|
||||
else
|
||||
(digits, exponent) = (number, "0")
|
||||
end
|
||||
|
||||
if occursin('.', digits)
|
||||
value = parse(BigFloat, digits, base=6)
|
||||
else
|
||||
value = parse(BigInt, digits, base=6)
|
||||
end
|
||||
|
||||
expval = parse(Int, exponent, base=6)
|
||||
|
||||
if expval < 0
|
||||
return 1 // (value * BigInt(6) ^ (-expval))
|
||||
else
|
||||
return value * BigInt(6) ^ expval
|
||||
end
|
||||
end
|
||||
|
||||
macro b6_str(digits)
|
||||
value = base6(digits)
|
||||
|
||||
return :( $value )
|
||||
end
|
||||
|
||||
yocte = b6"1e-52" # y |
|
||||
zepte = b6"1e-44" # z |
|
||||
atte = b6"1e-40" # a |
|
||||
femte = b6"1e-32" # f |
|
||||
pice = b6"1e-24" # p |
|
||||
nane = b6"1e-20" # n |
|
||||
micre = b6"1e-12" # μ |
|
||||
mille = b6"1e-4" # m |
|
||||
cente = b6"1e-2" # c |
|
||||
dice = b6"1e-1" # d |
|
||||
dece = b6"1e1" # de |
|
||||
hecte = b6"1e2" # h |
|
||||
kile = b6"1e4" # k |
|
||||
mege = b6"1e12" # M |
|
||||
gige = b6"1e20" # G |
|
||||
tere = b6"1e24" # T |
|
||||
pete = b6"1e32" # P |
|
||||
exe = b6"1e40" # E |
|
||||
zette = b6"1e44" # Z |
|
||||
yotte = b6"1e52" # Y |
|
||||
|
||||
# TODO: consider scaling instants up, using moment for the base unit at a more
|
||||
# human timescale
|
||||
|
||||
# Base Units
|
||||
pace = 1@unit p "p" Pace (lₛ * b6"1e114") false # ~86cm
|
||||
tick = 1@unit t "t" Tick (tₛ * b6"3e132") false # ~0.52s = 300₆ instants (1/tick ~115bpm)
|
||||
egg = 1@unit e "e" Egg (mₛ * b6"1e14") false # ~112g
|
||||
jolt = 1@unit j "j" Jolt (b6"1e34" * Unitful.q / tick) false # ~40mA painful jolt (https://electronics.stackexchange.com/questions/19103/how-much-voltage-current-is-dangerous)
|
||||
|
||||
# Convenience Units
|
||||
instant = 1@unit i "i" Instant (tₛ * b6"1e130") false # ~5ms (1000₆ instants is about a second)
|
||||
# TODO: larger chunks of meaningful time (akin to minutes/hours)
|
||||
# TODO: name ~0.5L which is a mille pace^3?
|
||||
|
||||
# Derived Units
|
||||
walk = 1@unit w "w" Walk (1 * pace / tick) false # ~6km/h (pretty quick walk)
|
||||
touch = 1@unit ṫ "ṫ" Touch (1 * egg * pace / tick ^ 2) false # ~0.36N (half what it takes to press a key on a keyboard)
|
||||
|
||||
#= Useful Constants ============================================================
|
||||
Earth's gravitational constant: gₑ ≈ 3₆p/t²
|
||||
Speed of light: c ≡ 3e14₆p/t
|
||||
===============================================================================#
|
||||
|
||||
#=
|
||||
export stride, skip, bed, gulp
|
||||
export moment, instant, wait
|
||||
export amble, shot
|
||||
export ball
|
||||
export brr
|
||||
export press, bite, snack
|
||||
export jolt
|
||||
export lotta, alotta
|
||||
|
||||
# Lengths (root unit: skip)
|
||||
skip = 1@unit sk "sk" Skip (lₚ * b6"1e112") false # ~28cm
|
||||
stride = 1@unit st "st" Stride (dece * skip) false # ~1.7m
|
||||
sprint = 1@unit sp "sp" Sprint (kile * skip) false # ~360m
|
||||
# Note: a kile stride is about 1 nautical mile
|
||||
|
||||
# Areas (root unit: paper)
|
||||
paper = 1@unit pa "pa" Paper (skip * skip) false # ~0.08m²
|
||||
bed = 1@unit bd "bd" Bed (stride * stride) false # ~2.8m²
|
||||
|
||||
# Volumes (root unit: gulp)
|
||||
gulp = 1@unit gu "gu" Gulp ((dice * IIPAU.skip) ^ 3) false # ~100 mL
|
||||
|
||||
# Durations (root unit: instant)
|
||||
instant = 1@unit in "in" Instant (tₚ * b6"1e131") false # ~1/3s
|
||||
moment = 1@unit mo "mo" Moment (dece * instant) false # ~2s
|
||||
wait = 1@unit w "w" Wait (kile * moment) false # ~43.9 minutes
|
||||
|
||||
# Speed (root unit: amble)
|
||||
amble = 1@unit amb "amb" Amble (skip / instant) false # ~3km/h
|
||||
shot = 1@unit sh "sh" Shot (kile * amble) false # ~1km/s (bullet speed)
|
||||
|
||||
# Mass (root unit: ball)
|
||||
ball = 1@unit bl "bl" Ball (mₚ * b6"1.0e13") false # ~200g (note: Float to fix Int64 overflow)
|
||||
|
||||
# Temperate (root unit: brr, base unit degree of comfort)
|
||||
brr = 1@unit br "br" Brr (Tₚ * b6"1e-110") false # ~0.3K
|
||||
@affineunit °c "°c" (Int(b6"4400") * brr) # ~13°C -> 0°c
|
||||
# This sets up that 0 is uncomfortably cold, 100₆ is comfortable, and 200₆ is
|
||||
# uncomfortably warm (13, 23.5, 34)°C respectively
|
||||
|
||||
# Force (root unit: press)
|
||||
press = 1@unit pr "pr" Press (ball * skip / instant^2) false # ~0.5N (key press on keyboard)
|
||||
|
||||
# NOTE: 1bi / Mto = 1st, aka a bite is one megatouch stride (or a kileshove stride)
|
||||
# NOTE: 1sn / Mpr = 1sk, aka a snack is one megepress skip
|
||||
|
||||
# Energy (root unit: snack)
|
||||
snack = 1@unit sn "sn" Snack (b6"1.0e12" * press * skip) false # ~60cal
|
||||
bite = 1@unit bi "bi" Bite (dice * snack) false # ~10cal
|
||||
|
||||
# Electricity, based on a common static shock
|
||||
# ~0-2mJ / ~1-5KV = ~5e-8 to 5e-7C
|
||||
|
||||
# Charge (root unit: jolt)
|
||||
jolt = 1@unit jo "jo" Jolt (b6"1e23" * Unitful.q) false # ~7.5e-8C (a moderate static shock of charge)
|
||||
|
||||
# TODO: Voltage and consider charge in lotta electron charges (q in Unitful
|
||||
# [leads to about 2e7C, which is a lot, but might make cleaner 'volts'])
|
||||
# or consider using resistivity or conductivity of something common?
|
||||
temp = 1@unit tmp "tmp" Temp (jolt / moment) false
|
||||
|
||||
# "Count" (root unit: lotta [mole equivalent]) ~1.32e26
|
||||
lotta = 1@unit lo "lo" Lotta (1u"mol" * 1u"bl" / 1u"g") false # ~220mol
|
||||
alotta = (1u"lo" |> item).val # ~1.32e26
|
||||
|
||||
function prefer_iipau()
|
||||
Unitful.preferunits(u"sk,mo,bl,br,lo,tmp"...)
|
||||
end
|
||||
|
||||
function prefer_natural()
|
||||
Unitful.preferunits(u"lₚ,mₚ,tₚ,Tₚ,qₚ,Qₚ,count"...)
|
||||
end
|
||||
=#
|
||||
|
||||
end # module IIPAU
|
Loading…
Reference in a new issue