Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Book 1D or: How Cells Stopped Worrying and Learned to Love the Reproduction

books/1d.livemd

Book 1D or: How Cells Stopped Worrying and Learned to Love the Reproduction

⛩️

input = Kino.Input.text("Your name")
defmodule Start do
  def run(input) do
    name = Kino.Input.read(input)

    name =
      cond do
        String.length(name) > 0 -> name
        true -> raise "Enter your name"
      end

    {:ok, class} = Dojo.Class.join(self(), "book1", %Dojo.Disciple{name: name, action: "online"})
    {"Welcome " <> name <> "!", class}
  end
end
# This is a book that runs code and talks to the Dojo at the same time
{_, class} = Start.run(input)

Where it started

2 questions:

  • How can reliable systems be constructed from unreliable components?
  • What kind of logical organisation is sufficient for an automaton to be able to reproduce itself?

Create your 1D world

We begin with a

  • World. The simplest world would be one-dimensional: a line of cells that stretch for as long as you need them to
  • State. Cells then a state. The simplest set of states (beyond a homogenous dead ass world of one state) would be 2 states: 0 (dead) or 1 (alive).

# init condition goes here Liv
# build a list
Dojo.World.create("10101", %{class: class})
|> Dojo.World.print(book: true)
# DojoKino.Animate.new(1..10, fn index ->
#   Kino.Markdown.new(Dojo.World.create("blinker", 10, index, coordinate))
# end)

Dojo.Room.get_leaderboard!("class1")
# Dojo.Room._leaderboard!("class1", name)

Its reproduction time

> What kind of logical organization is sufficient for an automaton to be able to reproduce itself?

Here come the rules:

  • Take a look at the neighborhood states: left, middle, right.
  • Look up the new value for the cell state according to some ruleset.
  • Set the cell’s state to that new value.

This may lead you to write some code like this:

# Define the rule set
rule_set =
  %{
    "000" => "0",
    "001" => "1",
    "010" => "1",
    "011" => "1",
    "100" => "1",
    "101" => "0",
    "110" => "0",
    "111" => "0"
  }

rule_set
|> Dojo.World.print(book: true)
Dojo.World.create("010")
|> Dojo.World.next(20, 15, %{class: class})
|> Dojo.World.print(animate: true)

What is the total number of kernel rules you can create?

Activity: Create your family tree

Elementary rule 90

str =
  Dojo.World.create("010")
  |> Dojo.World.next(20, 5)
  |> Dojo.World.print(spacetime: true)

Activity: Present your Rule

str = Dojo.World.run("010", rule_set, 30, %{class: class})
# |> Dojo.World.print([book: true])

Universal Computation

What if it was

initial configuration of a cellular automaton represents a “program” and “initial data,” processed by cellular automaton time evolution to give a configuration correspond- ing to the “output” or “result” of the “computation.” The cellular automaton rules represent the basic mechanism of the computer; different programs may be “run” (or different “functions evaluated”) by giving different initial or “input” configura- tions. This process is analogous to the “evolution” of the sequence of symbols on the tape of a Turing machine (Turing, 1936). However, instead of considering a single “head” which modifies one square of the tape at each time step, the cellular automaton evolution simultaneously affects all sites at each time step. There exist “universal” cellular automata analogous to universal Turing machines, for which changes in the initial configuration alone allow any computable (or “recursive”) function to be evaluated. A universal Turing machine may simu- late any other Turing machine using an “interpreter program” which describes the machine to be simulated. Each “instruction” of the simulated machine is simulated by running the appropriate part of the interpreter program on the universal machine. Universal cellular automata may similarly simulate any other cellular automata. The interpreter consists of an encoding of the configurations for the cellular automaton to be simulated on the universal automaton.

Reflection

> “Feynman took me aside, rather conspiratorially, and said, “Look, I just want to ask you one thing: how did you know rule __ would do all this crazy stuff?” “You know me,” I said. “I didn’t. I just had a computer try all the possible rules. And I found it.” “Ah,” he said, “now I feel much better. I was worried you had some way to figure it out.”

  1. What does “computation” mean to you?
  2. In your own words, how does one use computation to understand math or vice versa?
  3. Is there anything you like about the class?
  4. Is there anything you dont like about the class?
  5. If we did another extension course, would you come again?

Is this different from how your teachers teach in the cohort class? How so?

Appendix I

reinforce -> why we decide do this

where can you find materials to go beyond the class

Here be dragons

Heres where you find more materials to go beyond the class: