2

How to obtain a huge amount of data solved in FrobeniusSolve more systematically?

I am interested in obtaining these two sets of data from FrobeniusSolve:

sol = FrobeniusSolve[Table[1, {i,1,36}], 8]    -- (command 1)

and

sol = FrobeniusSolve[Table[1, {i,1,70}], 16]  -- (command 2)

But running either of each of these two commands -- I run out of memory and the Mathematica quit its kernel after 3 days or so.

Question: Do you have any way to obtain such a data sol defined above?


What I can do at my best is running

sol = FrobeniusSolve[Table[1, {i,1,20}], 8] -- (command 0)

using Timing[sol = FrobeniusSolve[Table[i, {i,1,20}], 8];]

It shows {508.029, Null} that it costs 508.029 secs, about 8 minutes 20 secs.

For given n and b, I know the meaning of

FrobeniusSolve[Table[1, {i,1,n}], b]

means that solving the set of all possible equations of the Frobenius equation $$ x_1+\dots+x_n=b,$$ where the coefficients all are positive integer 1, while $b$ is an integer, and a solution $$(x_1, \dots, x_n)$$ must consist of non-negative integers, i.e. $$ x_j \in \mathbb{N} $$ as Natural numbers. See https://mathoverflow.net/q/352331/27004

It turns out that the number of solutions $f(n,b)$ is given by

$$ f(n,b)= \binom{b+n-1}{n-1}. $$

So (command 0), (command 1) and (command 2) requires these numbers of solutions: $$ f(n=20,b=8)= \binom{8+20-1}{20-1}=2220075. $$ $$ f(n=36,b=8)= \binom{8+36-1}{36-1}=145008513. $$ $$ f(n=70,b=16)= \binom{16+70-1}{70-1}=78682166288559225. $$ So the rough estimation of time to run (command 1) in my computer is: $$ f(n=36,b=8)/f(n=20,b=8) \times 500 sec \simeq 65 \times 500 sec. $$ The rough estimation of time to run (command 2) in my computer is: $$ f(n=70,b=16)/f(n=20,b=8) \times 500 sec \simeq 3.5 \times 10^{10} \times 500 sec. $$ These are literally impossible! (Using a Laptop.)

  • Are there any simple ways to obtain these data of (command 1) and (command 2) easily? (perhaps without running the commands?) It is also possible to simplify the math equations by reiteration, etc.

See the math: (https://mathoverflow.net/q/352331/27004)

NOTE add: To @yarchik (see comments), NO, I do not just need the number of solutions. I need the long strings of such data as sol above. I need the sol as the basis/bases for solving some nonlinear algebraic equations.

wonderich
  • 923
  • 1
  • 8
  • 14

1 Answers1

2

As long as $n\ge b$, the number of solutions of FrobeniusSolve[Range[n], b] is PartitionsP[b], which is not all that large.

For example, your command 1

FrobeniusSolve[Range[36], 8]

has PartitionsP[8] == 22 solutions:

{{0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {2,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 [...]
 {13,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {14,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 {16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}
Roman
  • 47,322
  • 2
  • 55
  • 121
  • thanks +1, I like your input – wonderich Feb 18 '20 at 19:27
  • However, I want to say that $ f(n=20,b=8)= \binom{8+20-1}{20-1}=2220075 $ is a correct statement --- they contain a large set of these solutions. Perhaps you do not consider all the permutations among your answer. – wonderich Feb 18 '20 at 19:28
  • @wonderich please show me a solution I didn't consider. Permutations aren't allowed here as the solutions are position-dependent. Are you sure you understand what FrobeniusSolve does? – Roman Feb 18 '20 at 19:51
  • I am sure I understand: this is what I need FrobeniusSolve[Table[i, {i,1,n}], b] – wonderich Feb 18 '20 at 22:57
  • I need the output of FrobeniusSolve[Table[i, {i,1,36}], 8], FrobeniusSolve[Table[i, {i,1,70}], 16] and FrobeniusSolve[Table[i, {i,1,20}], 8] – wonderich Feb 18 '20 at 22:58
  • @wonderich that's precisely what I gave you. I simply used Range[n] instead of your Table[i, {i,1,n}], which is the same thing. I am baffled by your reactions. – Roman Feb 19 '20 at 06:27
  • Can you simply run this to know the difference of mine and yours? FrobeniusSolve[Table[i, {i,1,20}], 8] – wonderich Feb 19 '20 at 19:35
  • Sorry I was wrong it should be FrobeniusSolve[Table[1, {i,1,20}], 8] – wonderich Feb 19 '20 at 19:37
  • I found my typos in the original post: "Table[i, {i,1,n}]" corrected to "Table[1, {i,1,n}]" thanks! – wonderich Feb 19 '20 at 19:39
  • It's always a good idea to try out the code you post. – Roman Feb 20 '20 at 06:49