Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Null in variable output' topicStudent Support Forum > General > "Null in variable output"

Next Comment >Help | Reply To Topic
Author Comment/Response
Otto Murphy
03/30/09 7:29pm

Hi, I have the following code which will be used with TreePlot to create a diagram like this:
http://en.wikipedia.org/wiki/File:Poset6.jpg

poset[n_] :=
Module[{a, i, z, subsets, b, subsub, w},
a = List @@ Table[FromCharacterCode[96 + i], {i, n}];
b = {};
For[i = n, i > 0, i--,
subsets = Subsets[a, {i}];
For[z = 1, z <= Binomial[n, i], z++,
Print[
b = Join[
b, (subsets[[z]] -> #) & /@ Subsets[subsets[[z]], {i - 1}]]
];
]]
b
]
poset[2]

The output looks like this:

During evaluation of In[91]:= {{a,b}->{a},{a,b}->{b}}

During evaluation of In[91]:= {{a,b}->{a},{a,b}->{b},{a}->{}}

During evaluation of In[91]:= {{a,b}->{a},{a,b}->{b},{a}->{},{b}->{}}

Out[92]= {Null ({"a", "b"} -> {"a"}), Null ({"a", "b"} -> {"b"}),
Null ({"a"} -> {}), Null ({"b"} -> {})}


My question is: what is that Null doing there? Why is it there?

URL: ,

Subject (listing for 'Null in variable output')
Author Date Posted
Null in variable output Otto Murphy 03/30/09 7:29pm
Re: Null in variable output yehuda ben-s... 04/01/09 06:54am
Re: Re: Null in variable output Otto Murphy 04/02/09 05:51am
Next Comment >Help | Reply To Topic