Ask Your Question

parkjr's profile - activity

2022-08-03 20:07:59 +0200 received badge  Famous Question (source)
2020-04-22 08:05:17 +0200 received badge  Scholar (source)
2020-04-22 08:05:03 +0200 commented answer dividing range by combinations

You showed me the perfect answer!!! Thanks:)

2020-04-22 08:03:59 +0200 answered a question dividing range by combinations

You showed me the perfect answer!!! Thanks:)

2020-04-03 15:22:09 +0200 asked a question dividing range by combinations

The following is an example:

temp = range(5)
L = [2,1,2]

Then we know that

$_5\rm C_2 \times _3\rm C_1 \times _2\rm C_2 = 30$

We can get every combinations as following:

result = []
for A in Combinations(temp, L[0]):
    temp = list(set(temp) - set(A))
    for B in Combinations(temp, L[1]):
        temp = list(set(temp) - set(B))
        result += [[A,B, temp]]
        temp = list(set(range(5))- set(A))
    temp = range(5)

Then result is

[[[0, 1], [2], [3, 4]], [[0, 1], [3], [2, 4]], [[0, 1], [4], [2, 3]], [[0, 2], [1], [3, 4]], [[0, 2], [3], [1, 4]], [[0, 2], [4], [1, 3]], [[0, 3], [1], [2, 4]], [[0, 3], [2], [1, 4]], [[0, 3], [4], [1, 2]], [[0, 4], [1], [2, 3]], [[0, 4], [2], [1, 3]], [[0, 4], [3], [1, 2]], [[1, 2], [0], [3, 4]], [[1, 2], [3], [0, 4]], [[1, 2], [4], [0, 3]], [[1, 3], [0], [2, 4]], [[1, 3], [2], [0, 4]], [[1, 3], [4], [0, 2]], [[1, 4], [0], [2, 3]], [[1, 4], [2], [0, 3]], [[1, 4], [3], [0, 2]], [[2, 3], [0], [1, 4]], [[2, 3], [1], [0, 4]], [[2, 3], [4], [0, 1]], [[2, 4], [0], [1, 3]], [[2, 4], [1], [0, 3]], [[2, 4], [3], [0, 1]], [[3, 4], [0], [1, 2]], [[3, 4], [1], [0, 2]],[[3, 4], [2], [0, 1]]]

The problem is that 'How can I get the general case?'

temp = range(k)

L = [$e_1$, $e_2$, $\cdots$, $e_n$ ], where $\sum_{i=1} ^n e_i = k$

I don't know the size of list L.

2020-04-02 14:49:17 +0200 received badge  Popular Question (source)
2020-04-02 14:49:17 +0200 received badge  Notable Question (source)
2017-07-10 16:45:38 +0200 commented answer symbolic functions and bool

Acturally, I have so many equations, which similar to f(d). So, I can not adjust each equation by human sense. But I'm really appreciate for your advice:)

2017-07-05 17:54:31 +0200 received badge  Student (source)
2017-07-05 15:11:56 +0200 asked a question symbolic functions and bool

d=var('d') $d$ is integer and $d>4$

f(d)=1/6*(d^2 - sqrt(d^2 + 8*d - 8)*d + 23*d - sqrt(d^2 + 8*d - 8) - 26)*(d - sqrt(d^2 + 8*d - 8) + 4)/(d + 1)

How can I show that $f(d)\ge 0$

bool(f(d)>=0) and bool(f(d)<0) return false