wolframscience.com

A New Kind of Science: The NKS Forum : Powered by vBulletin version 2.3.0 A New Kind of Science: The NKS Forum > Pure NKS > Generalizing the pairing function to enumerate parameter space
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
Jesse Nochella
WRI

Registered: Mar 2004
Posts: 132

Generalizing the pairing function to enumerate parameter space

At the Midwest NKS conference this year in Bloomington, Indiana, Matthew Szudzik introduced in his keynote speech a function from mathematical logic that is extremely useful, called the pairing function.

The pairing function lets you take two numbers and create a unique number with them. There is also an inverse function he gave, that takes a number and creates the original two numbers.

He also said that there are other functions and ideas from mathematical logic that are highly relevant to NKS study, but not well known because they were never really used in computer science, which is a field of study that originates from mathematical logic.

These functions are incredibly useful for anyone wanting to set up enumeration schemes, and in general give a single number for every coordinate in an infinite space.

They follow as:

pair[x_, y_] := (x^2 + x + 2x y + 3y + y^2)/2

this number can be transformed back into the original two numbers by:

unpair[z_] := With[{i = Floor[-1/2 + (Sqrt[1 + 8 z])/2]}, {1/2 i (3 + i) - z, -1/2 i (1 + i) + z}]

This can be used to enumerate all state configurations of multiple infinitely growing paramaters. You can think of it as a way of growing towers so that every configuration of tower height is visited and has a unique number for it.

this function is only designed for two parameters but one can imagine a kind folding that pairs many parameters together by successively combining your set of numbers. Such a function can be constructed. One implementation of this is as follows:

Combine[sequence__] := Fold[pair[#2, #1] &, First@{sequence}, Rest@{sequence}]

To uncombine a number into a set of other numbers, the number of parameters must be specified. Here is the code for that:

Uncombine[number_, numParams_] := Reverse[Nest[Flatten[{Most@Flatten@{#}, unpair[Last[Flatten@{#}]]}] &, Last@{number}, numParams - 1]]

Attached is a notebook containing these functions. They are useful when you want a number for every kind of thing x. Enjoy.

Attachment: enumspace-5.nb
This has been downloaded 1113 time(s).

Last edited by Jesse Nochella on 11-08-2005 at 05:21 PM

Report this post to a moderator | IP: Logged

Old Post 11-05-2005 03:07 AM
Jesse Nochella is offline Click Here to See the Profile for Jesse Nochella Click here to Send Jesse Nochella a Private Message Edit/Delete Message Reply w/Quote
Seth J. Chandler
University of Houston Law Center
Houston, Texas, USA

Registered: Oct 2003
Posts: 20

Enumerating networks using the pairing and unpairing functions

I suppose it may be obvious, but in concept one can enumerate directed networks in this fashion. Here's a notebook illustrating the concept.

Attachment: enumerating directed networks using the pairing function.nb
This has been downloaded 1097 time(s).

__________________
Seth J. Chandler
Foundation Professor of Law
University of Houston Law Center
Houston, Texas 77204

Report this post to a moderator | IP: Logged

Old Post 11-08-2005 08:27 PM
Seth J. Chandler is offline Click Here to See the Profile for Seth J. Chandler Click here to Send Seth J. Chandler a Private Message Click Here to Email Seth J. Chandler Visit Seth J. Chandler's homepage! Edit/Delete Message Reply w/Quote
Jason Cawley
Wolfram Science Group
Phoenix, AZ USA

Registered: Aug 2003
Posts: 712

I think it is fair to point out the unpairing function was first shown by Matthew Szudzik in his opening talk at the NKS Midwest conference in Bloomington, around the end of October. Quite useful. Jesse noted above that Matthew showed the pairing function, which is rather better known. Matthew also showed the unpairing function, which isn't as widely known.

Report this post to a moderator | IP: Logged

Old Post 11-10-2005 07:04 PM
Jason Cawley is offline Click Here to See the Profile for Jason Cawley Click here to Send Jason Cawley a Private Message Edit/Delete Message Reply w/Quote
Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread


 

wolframscience.com  |  wolfram atlas  |  NKS online  |  web resources  |  contact us

Forum Sponsored by Wolfram Research

© 2004-10 Wolfram Research, Inc. | Powered by vBulletin 2.3.0 © 2000-2002 Jelsoft Enterprises, Ltd. | Disclaimer | Archives