How can I fit the curve to the distribution of the histogram?

Someone asked me an email question about entire sections the other day (since I released the Perl module, Integer :: Partition, to generate them) that I could not answer.

Background: entire sections of 7 are represented here (the sum of each line is 7).

7
6 1
5 2
5 1 1
4 3
4 2 1
4 1 1 1
3 3 1
3 2 2
3 2 1 1
3 1 1 1 1
2 2 2 1
2 2 1 1 1
2 1 1 1 1 1
1 1 1 1 1 1 1

Now, if we look at the lengths of each section and calculate how long they are:

1 1
2 3
3 4
4 3
5 2
6 1
7 1

... we see that one section has a length of 1 (7), one has a length of 7 (1 1 1 1 1 1 1 1). There are 4 sections, the length of which is 3: (5 1 1), (4 2 1), (3 3 1), (3 2 2).

For large numbers N, if you draw the distribution of the section lengths, an asymmetric curve appears, distorted in the direction of the origin. If you're interested, draw a section length calculation for N = 40.

1 20 133 478 1115 1945 2738 3319 3589 3590 3370 3036 2637 2241 1861 1530 1236 995 790 627 490 385 297 231 176 135 101 77 56 42 30 22 15 11 7 5 3 2 1 1

, , :

#! /usr/local/bin/perl

use strict;
use warnings;

use Integer::Partition;

my $n = shift || 1;

while (1) {
    my $start = time;
    my $i = Integer::Partition->new($n);
    my %size;
    while (my $p = $i->next) {
        $size{scalar @$p}++;
    }

    open my $out, '>>', "bucket-count.out";
    for my $s (sort {$a <=> $b} keys %size) {
        print $out "$n\t$s\t$size{$s}\n";
    }
    close $out;
    my $delta = time - $start;
    print "$n\t$delta secs\n";
    ++$n;
}

( : N = 90 10 ).

, : ? ( ?) , - ?

? , , , 0. ? , , , - . :)

+5
1

, . , fnding , k, N. , :

(k), ( ), .

python numpy scipy-: -)

+2

All Articles