Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

COMBINATORICAL PROBLEM

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51141] COMBINATORICAL PROBLEM
  • From: dumstuck at gmx.ch (dumstuck at gmx.ch)
  • Date: Wed, 6 Oct 2004 04:34:15 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

The two recursice codes below do exactly what I need. The first builds
a tree linking the branches with elements called "f", whereas the
second links the branches with elements called "h".

   BuildTree[N_, d_] := Which[
      N > 2 d,  {f, {BuildTree[N/2, d], BuildTree[N/2, d]}},
      N == 2 d, {f, {d*Delta;, d*Delta;}}];
   tree = BuildTree[32, 1] // TableForm

   BuildTree[N_, d_] := Which[
      N > 2 d,  {h, {BuildTree[N, 2d], BuildTree[2 d, d]}},
      N == 2 d, {f, {d*Delta;, d*Delta;}}];
   BuildTree[32, 1] // TableForm

What I'm desparately trying to do, without success, is to generate all
the possibile trees by alternating, using either "h" or "f". The first
idea is to simply provide the line "N>2d" with the list containing the
two possibiles:

  BuildTree[N_, d_] := Which[
      N > 2 d, {{h, {BuildTree[N, 2d],BuildTree[2 d, d]}},
                {f, {BuildTree[N/2, d], BuildTree[N/2, d]}}},
      N == 2 d, {f, {d*Delta;, d*Delta;}}];
BuildTree[32, 1] // TableForm

This provides of course all the possibilities but not in a structure
readable by humains like the two former. I'm therefore looking for a
way of either building the tree differently or a extracting the
solutions from the results of this last function.


  • Prev by Date: Re: Oddities of Plot[]
  • Next by Date: Re: Conveniently Restarting Notebooks
  • Previous by thread: Re: Re: Re: No more memory available
  • Next by thread: Graphics Symbols