MATHEMATICS

Rabu, 26 Januari 2011

M381-ML#3

M381-Logic

Worked on the URM-emulator today. I have added function composition.

Example:

The following URM code represents the function f: n->n^2
{
{j, 1, 4, 10},
{c, 1, 4},
{s, 2},
{j, 1, 2, 10},
{z, 3},
{s, 3},
{s, 4},
{j, 1, 3, 3},
{j, 1, 1, 6},
{c, 4, 1}
}

The following URM code represents the function g: n->3n
{
{c, 1, 3},
{j, 2, 3, 10},
{s, 2},
{s, 1},
{s, 1},
{j, 1, 1, 2}
}

The URM then generates ( i.e. my Mathematica code ) for (f*g): n->9n^2
{
{c, 1, 3},
{j, 2, 3, 7},
{s, 2},
{s, 1},
{s, 1},
{j, 1, 1, 2},
{z,2},
{z, 3},
{z, 4},
{j, 1, 4, 19},
{c, 1, 4},
{s, 2},
{j, 1, 2, 19},
{z, 3},
{s, 3},
{s, 4},
{j, 1, 3, 12},
{j, 1, 1, 15},
{c, 4, 1}
}

and for (g*f) n:=n->3n^2
{
{j, 1, 4, 10},
{c, 1, 4},
{s, 2},
{j, 1, 2, 10},
{z, 3},
{s, 3},
{s, 4},
{j, 1, 3, 3},
{j, 1, 1, 6},
{c, 4, 1},
{z, 2},
{z, 3},
{z, 4},
{c, 1, 3},
{j, 2, 3, 23},
{s, 2},
{s, 1},
{s, 1},
{j, 1, 1, 15}
}

Low level hacking indeed.

Tidak ada komentar:

Posting Komentar