Re: Re: How to calculate a union

• To: mathgroup at smc.vnet.net
• Subject: [mg104607] Re: [mg104533] Re: How to calculate a union
• From: DrMajorBob <btreat1 at austin.rr.com>
• Date: Wed, 4 Nov 2009 01:41:42 -0500 (EST)
• References: <hcgmv6\$d16\$1@smc.vnet.net> <hcjiph\$ji9\$1@smc.vnet.net>
• Reply-to: drmajorbob at yahoo.com

```I haven't found the whole thread, or maybe you're not being specific
enough.

Could the sum you're talking about be StirlingS2? (look it up in Help)

{1, 3, 4, 8, 9, 273} // Total

298

If you want to know how many ways 298 objects divide into 6 non-empty
sets, the answer is

six = StirlingS2[298, 6]

1075821248827096561510600533061021312147292178470709061394244250242240\
4204344618445256417817622689352182506360801499420973972117501295752112\
7858761331082536332833271473290414868861248314974063061884865879515098\
26099869741728596859

or... the number of ways 298 divides into UP TO 6 non-empty sets:

upTo6 = Total@StirlingS2[298, Range@6]

1075821248827096561510616896705905637902469164377225682313054167627282\
0852663455496893658655311541729640462357823813462486418083469381491114\
7144460089469673867410642929568451368797860156877490757740974231983345\
77877398619316408371

Both numbers agree in the first 23 digits:

-1 + Min@Position[IntegerDigits@upTo6 - IntegerDigits@six, _?Positive]

23

That's from a total 230 digits:

Ceiling@Log[10., {upTo6, six, upTo6 - six}]

{230, 230, 207}

If that's off-topic... never mind!

Bobby

On Tue, 03 Nov 2009 01:54:57 -0600, Ramiro <ramiro.barrantes at gmail.com>
wrote:

> Hi,
>
> Thanks so much for this, I was thinking how one could calculate it.
> Yes, if n=273 you get some serious amounts of numbers that I need to
> add.  I don't think that it is even possible to store such large
> amounts.  The thing is, for each possible k-tuple, say {1,3,4,8,9,273}
> I can calculate the corresponding probability very easily, and I then
> need to add all the probabilities of all the k-tuples and add/subtract
> as necessary for a grand number that would correspond to the
> probability of the union, the entire calculation is trivial, but there
> are just too many numbers!!!  For n=273, the number of 140-tuples are
> 699577983584109258531043307610450240451701311502431378368296040472451355165796880
>
> Any suggestions?
>
> Ramiro
>
> On Nov 1, 4:01 am, ADL <alberto.dilu... at tiscali.it> wrote:
>> I do not know why Export seems to behave as you say, but you can
>> compute in advance the number of terms in each file with this formula:
>>
>> filelengths = Reverse@CoefficientList[Expand[(x + 1)^n], x]
>>
>> where the first value (always 1) is for index 0, and so on.
>> The total Total[filelengths] is of course equal to 2^n.
>>
>> With this, you might compute in advance the memory required for your
>> operation and establish when it is too much.
>>
>> ADL
>>
>> On Oct 31, 7:54 am, Ramiro <ramiro.barran... at gmail.com> wrote:
>>
>> > Hi,
>>
>> > I am trying to compute the probability of a union, the formula
>> > requires to sum and subtract all possible combinations of
>> > intersections for all pairs, triplets, etc.  When n is big, getting
>> > all the terms is a challenge.
>> > ...
>>
>>
>
>

--
DrMajorBob at yahoo.com

```

• Prev by Date: Re: Characteristic Function of Pareto distribution
• Next by Date: Re: Set::setps error? Twitter.m's OOP-like approach?
• Previous by thread: Re: How to calculate a union
• Next by thread: Re: Multiply 2 matrices where one contains differential operators with one that contains functions of x and y