hp
jblog
toc

Factoids #0

2019-06-15, post № 216

mathematics, #algebra, #rings

I) Unit polynomials with non-vanishing degree

2t+1\in\mathbb{Z}_4[t] is its own multiplicative inverse, showing that R[t]^*=R^* does not hold in a general commutative Ring with one.

This phenomenon is uniquely characterized by the following equivalence:

R[t]^*=R^*\iff\nexists\,0\neq a,b\in R:a\cdot b=0=a+b
Proof. Negated replication. Let R\not\owns f=\sum_{i=0}^n\alpha_it^i\in R[t]^*,\alpha_n\neq 0 be a unit polynomial of non-vanishing degree n\geq 1. Let g=\sum_{j=0}^m\beta_jt^j\in R[t]^*,\beta_m\neq 0 denote its multiplicative inverse, i. e. f\cdot g=1.
Claim. The polynomial g has non-vanishing degree m\geq 1.
Proof. Suppose g\in R. Since f\cdot g=\sum_{i=0}^n(\alpha_i\cdot g)t^i, it follows from \alpha_n\cdot g=0 that g is a zero divisor. However, at the same time a_0\cdot g=1 implies that g is a unit, arriving at a contradiction.
Since both n,m\geq 1, one concludes \exists 1\leq k\leq m as well as \alpha_n\cdot\beta_m=0.
Existence of the desired ring elements a,b is assured by the following construction.
  • Let k=1\nearrow m rise discretely.
  • If a:=\alpha_n\beta_{m-k}\neq 0, implying b:=\sum_{i=1}^k\alpha_{n-i}\beta_{m-k+i}\neq 0, holds, since the construction arrived at this point, one finds
    a\cdot b=\alpha_n\beta_{m-k}\cdot \sum_{i=1}^k\alpha_{n-i}\beta_{m-k+i}=\sum_{i=1}^k \underbrace{\alpha_n\beta_{m-k+i}}_{=0}\cdot \alpha_{n-i}\beta_{m-k}=0.
  • The above condition is met for at least one 1\leq k\leq m, since otherwise k=m would imply \alpha_n\beta_{m-m}=0, which is impossible since \alpha_n\neq 0 and \beta_0 is a unit element.
By construction, 0\neq a,b as well as a+b=0 are given.
Negated implication. Setting  f:=at+1, g:=bt+1, one calculates
f\cdot g=(at+1)\cdot (bt+1)=abt^2+(a+b)\cdot t+1=0t^2+0t+1=1,
showing R\not\owns f,g\in R[t]^*.

Mostly Misaligned Mirrors

2019-05-18, post № 215

mathematics, PIL, programming, Python, #paths, #random, #simulation, #stochastic

Recently, my stochastic professor introduced me to a problem he has been pondering for over two decades: on the two-dimensional integer lattice \mathbb{Z}^2 one shall flip a three-sided coin for each point and uniformly place one of three mirrors, \{\diagup,\,\cdot\,,\diagdown\}, where \,\cdot\, denotes not placing a mirror. After having populated the world, one picks their favorite integer tuple and points a beam of light in one of the four cardinal directions. With what probability does the light fall into a loop, never fully escaping?

mostly-misaligned-mirrors-5_scaled.png
A cycle which includes the origin.

krrp

2019-04-20, post № 214

C, krrp, programming, #2018

A project of epic proportions has come to a close. Yesterday, the 19th of April 2019, saw the first public release of my new programming language, krrp.

As of the 24th of April 2019, krrp is kindly included in the TIO language collection, making krrp interpretation available from within the web. Great thanks go out to TIO for providing this service.

krrp is a functional, dynamic, interpreted and (theoretically) Turing-complete esolang implemented only using standard C. As such, on top of designing the actual language, any data structures, memory management and general auxiliary functionality deviating from the lacking capabilities offered by C had to be home-brewed and hand-crafted. A time-consuming task — I have been working on this language for the past year. However, it gives the language a certain purity, as its high-level functional approach rests firmly and closely on the state-changing, mutable and segmentation-faulting depths that are the C language.

Sudoku Generation

2019-03-23, post № 213

games, Haskell, programming, #generator, #puzzle

Over two years ago, I wrote a basic 𝟥 ⨉ 𝟥-sudoku solver which uses both fundamental rule-based elimination and guessing to arrive at the solution. Revisiting the topic of computer-aided sudoku manipulation, I wrote a generalized sudoku generator (sudoku-generation.hs).

    | 4  
  3 |    
---------
  2 | 1  
  4 |    

./sudoku 5 2

Pi Day MMXIX

2019-03-14, post № 212

C, programming, #cyclic quine, #iteration quine

w=0;b(){w>27&&puts("",w=0);}
p(c){b();putchar(c),b(++w);}
main(){int/**/N=0,D[][85]={{
0,1048320,4194272,8372472,1,
16646172,33030158,33030150,1
,33030144,16252928,16252928,
3932160,1,1966080,983040,1,1
,229376,57344,14336,7168,1,1
,134219520,1,1,1,1,67109312,
133169264,1,67108860,1,1,1,1
,33554431,-1},{3670016,1,1,1
,3932160,1835008,917504,1,1,
917504,458752,491520,229376,
114688,122880,57344,28672,1,
28672,14336,15360,7168,7680,
3840,1792,1920,960,448,-1},{
0,134217712,134217720,1,1,1,
62914620,31457294,31457286,1
,15728640,7340032,7864320,1,
3932160,1966080,1966080,1,1,
983040,1015808,491520,245760
,245760,122880,61440,61440,1
,30720,15360,-1},{0,0,0,0,0,
0,0,0,0,0,2097088,2097088,0,
0,0,0,0,0,0,0,0,0,-1},{0,0,0
,0,0,1048064,8259552,1,1,1,1
,16515576,15729144,504,504,1
,985024,1048320,1008,504,252
,25166332,29360632,7342064,1
,2097024,0,0,-1},},*d,C[]={1
,119,61,48,59,98,40,41,123,1
,119,62,50,55,38,38,112,117,
116,115,40,34,34,44,119,61,1
,48,41,59,125,112,40,99,41,1
,123,98,40,41,59,112,117,116
,99,104,97,114,40,99,41,44,1
,98,40,43,43,119,41,59,125,1
,109,97,105,110,40,41,123,1,
105,110,116,47,42,42,47,78,1
,61,48,44,68,91,93,91,56,53,
93,61,123,2,125,44,42,100,44
,67,91,93,61,123,3,48,125,44
,42,99,61,67,44,106,59,67,91
,56,48,93,61,40,67,91,56,48,
93,45,52,55,41,37,55,43,52,1
,56,59,105,102,40,78,60,54,1
,41,102,111,114,40,100,61,68
,91,78,63,78,45,49,58,48,93,
59,42,100,43,49,59,42,100,43
,43,45,49,38,38,112,117,116,
115,40,34,34,41,41,105,102,1
,40,42,100,45,49,41,102,111,
114,40,106,61,42,100,59,106,
59,106,47,61,50,41,112,117,1
,116,99,104,97,114,40,51,50,
43,106,37,50,42,49,53,41,59,
59,59,102,111,114,40,59,42,1
,99,59,99,43,43,41,123,105,1
,102,40,42,99,61,61,50,41,1,
102,111,114,40,106,61,48,59,
106,60,53,59,106,43,43,41,1,
123,112,40,49,50,51,41,59,59
,59,102,111,114,40,100,61,68
,91,106,93,59,42,100,43,1,49
,59,112,40,52,52,41,41,1,119
,43,61,112,114,105,110,1,116
,102,40,34,37,100,34,44,1,42
,100,43,43,41,59,112,40,1,52
,53,41,59,112,40,52,57,41,59
,112,40,49,50,53,41,59,1,112
,40,52,52,41,59,125,101,108,
115,101,32,105,102,40,1,42,1
,99,61,61,51,41,102,111,1,1,
114,40,100,61,67,59,42,100,1
,59,112,40,52,52,41,41,119,1
,43,61,112,114,105,110,116,1
,102,40,34,37,100,34,44,42,1
,100,43,43,41,59,1,101,108,1
,115,101,32,105,102,40,42,99
,62,49,41,112,40,42,99,41,59
,125,102,111,114,40,106,61,1
,53,59,45,1,45,106,59,112,40
,53,57,41,1,41,59,1,1,1,125,
0},*c=C,j;C[80]=(C[80]-47)%7
+48;if(N<6)for(d=D[N?N-1:0];
*d+1;*d++-1&&puts(""))if(*d-
1)for(j=*d;j;j/=2)putchar(32
+j%2*15);;;for(;*c;c++){if(*
c==2)for(j=0;j<5;j++){p(123)
;;;for(d=D[j];*d+1;p(44))w+=
printf("%d",*d++);p(45);p(49
);p(125);p(44);}else if(*c==
3)for(d=C;*d;p(44))w+=printf
("%d",*d++);else if(*c>1)p(*
c);}for(j=5;--j;p(59));};;;;

Try it online. Happy pi day.

Lichen, Extraterrestrials, Diodes #1

2019-02-23, post № 211

art, #LED, #photography

lichen-extraterrestrials-diodes-1.jpg

Kickboy #0

2019-01-26, post № 210

art, #stop motion

kickboy-0.gif
Kickboy.

Foam Cube Puzzle

2018-12-29, post № 209

programming, Python, #brute-force, #solver

After having solved the puzzle shown below a few times by combining six foam pieces to construct a hollow cube, I wondered if it had a unique solution. A simple brute-force search reveals it does.
Source code: foam-cube-puzzle.py

foam-cube-puzzle.jpg
All six foam pieces.

As a first step, I digitalized all pieces seen above. Having an internal representation, I wrote a script which tries all possible rotations and reflections (as three-dimensional rotations can imply two-dimensional reflection) to try and construct a three-dimensional cube from the given pieces. Using short-circuit evaluation to not bother with already impossible solutions, the search space is narrow enough to not require any considerable computing time. The resulting unique solution modulo rotation is shown above; the top face is placed on the bottom right.

Jonathan Frech's blog; built 2021/09/06 04:50:48 CEST