Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)CH
Posts
12
Comments
148
Joined
1 yr. ago

  • Always have been, DB is technically a for profit open capital company, but 100% of its shares are owned by the government (thats why its called Deutsche Bahn A.G., the ag stands for "share company"). It used to be a normal governmental body but was made that to privatize it later, something that never happened. Most Germans I know would rather take DB back than privatize it.

  • I will try to guess how that works!

    keep in mind that I have no clue on how BASIC sintax works lol

    1 -> function declared
    \ 2 -> variable x and y initiated to values 0 and 1.
    \ 3 -> for loop created that goes from 1 to 26 (updating variable N)
    \ 4 -> Variable R is created, its value is the square root of (x2 + y2). Xs and Ys values are set to be themselves divided by R.
    \ 5 -> P variable created (it stores the value of PI), and set to (2 ^ N) * square root of (x - 1) ^ 2 + y ^ 2. Lastly X is increased by one
    \ 6 -> Proceed only after for loop is done
    \ 7 -> return the variable P

    (I do recognize I just transcribed the code, and I also made an implementation in python of it, lol)

    now for why that works ill figure another time, its 12:30 pm here and I am eepy :). But I have recognized that X tends to 2 and Y to 0.

    and I am pretty sure this implements the algorithm of creating higher and higher "resolution" circles so starting with a triangle and adding more and more vertices (vertex?). Ill edit in the full explanation late :)

    here is my implementation:

     from math import sqrt
        
    
    def CalcPi():
        X = 0
        Y = 1
        P = 0
    
        for i in range(1,26):
            R = sqrt(X**2 + Y**2)
            
            X = X/R
            Y = Y/R
    
            P = (2**i) * sqrt((X-1)**2 + Y**2)
            X += 1
        return P