From 26118be87f0a9b4001c88c3bca7832b3693cf6aa Mon Sep 17 00:00:00 2001 From: Jan-Niclas Loosen Date: Thu, 17 Apr 2025 18:08:18 +0200 Subject: [PATCH] optimize ux --- .idea/.gitignore | 8 ++++++ .idea/Computational-Analysis.iml | 10 +++++++ .idea/inspectionProfiles/Project_Default.xml | 27 ++++++++++++++++++ .../inspectionProfiles/profiles_settings.xml | 6 ++++ .idea/misc.xml | 7 +++++ .idea/modules.xml | 8 ++++++ .idea/vcs.xml | 6 ++++ chapter-03/binseq/binseq.py | 11 +++++++ chapter-03/binseq/main.py | 20 +++++++++++++ .../__pycache__/dedekint.cpython-313.pyc | Bin 0 -> 682 bytes chapter-03/dedekint/dedekint.py | 6 ++++ chapter-03/dedekint/main.py | 26 +++++++++++++++++ 12 files changed, 135 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/Computational-Analysis.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 chapter-03/binseq/binseq.py create mode 100644 chapter-03/binseq/main.py create mode 100644 chapter-03/dedekint/__pycache__/dedekint.cpython-313.pyc create mode 100644 chapter-03/dedekint/dedekint.py create mode 100644 chapter-03/dedekint/main.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/Computational-Analysis.iml b/.idea/Computational-Analysis.iml new file mode 100644 index 0000000..8c69470 --- /dev/null +++ b/.idea/Computational-Analysis.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..e084a03 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,27 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..045fd63 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3ae40bc --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/chapter-03/binseq/binseq.py b/chapter-03/binseq/binseq.py new file mode 100644 index 0000000..dea2445 --- /dev/null +++ b/chapter-03/binseq/binseq.py @@ -0,0 +1,11 @@ +from collections.abc import Callable + +class REAL: + def __init__(self, f: Callable[[int], str]) -> None: + self.binseq = f + + def as_string(self, w: int) -> str: + s = "" + for n in range(w): + s += self.binseq(n) + return s \ No newline at end of file diff --git a/chapter-03/binseq/main.py b/chapter-03/binseq/main.py new file mode 100644 index 0000000..b068190 --- /dev/null +++ b/chapter-03/binseq/main.py @@ -0,0 +1,20 @@ +from binseq import REAL +from math import isqrt # integer sqrt + + +def one_third(n): + if n == 1: return "." + if n % 2 == 0: return "0" + return "1" + + +def irrational(n): + if n == 1: return "." + if n != isqrt(n) * isqrt(n): return "1" + return "0" + + +x = REAL(one_third) +y = REAL(irrational) + +print("x: " + x.as_string(50) + "\ny: " + y.as_string(50)) \ No newline at end of file diff --git a/chapter-03/dedekint/__pycache__/dedekint.cpython-313.pyc b/chapter-03/dedekint/__pycache__/dedekint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ab87018385cba1efcd4352bb60d415141ca3904 GIT binary patch literal 682 zcmX|8F>ljA6uz@Bsi_F<5`i*Br~{TrT+wy{p+*r)i&BIahDfK2b4i_^?c|*^WMe|& z2Sj4bNPhqle}f5hQYWTvhzuR!o}K2T`}{q>_wM`d-MUuWC3dxz|Hhx~_csRji*3mI z(2^wyNl4Gh83o!z?wmVkF1Stdgghmo+aMu3amo&0k6gBKuOEpWIBt= zq7t_nZ5uC1p8yRBI3Wc$bo#7c32481>{M*_*g=&EgPo9phYE(hf75w;i%COA(MG*E z7`bcrdf&p5eArjTZ-lWm)w`x>p1m7`COEm(|CN(xTo8}_8%n}()M4HBt5;}MX z*+gFDGU#T>be@Ym&QhUT9SaK`>ma%m(_BL9@F*C{p}dOId`sHXh4DC#(>Ukc)X;SM zKCGfB!bkFb_U-xFG6MJ}J^ukVr6Q5GX_xaP8_pH-hn&ymLTxg8oR4DAxr$SnW}E|F z8*r|M4YEwZBcyfCHJXmN$a9DX^IU4quL>_wTKVT9ArZ83-nbyFE9)5VLzM0xCEJbNo;yjSIAUPHqssNEVX X{UUL2JM=F>EE@j