```python
###サイコロの目の集合###
S_die = {1,2,3,4,5,6}
print(S_die)
```

    {1, 2, 3, 4, 5, 6}



```python
S_bag = {"R","R","R","W","W","W","W"}
print(S_bag)
```

    {'W', 'R'}



```python
S_bag = {"R_1","R_2","R_3","W_1","W_2","W_3","W_4"}
print(S_bag)
```

    {'W_2', 'R_2', 'W_3', 'W_4', 'W_1', 'R_1', 'R_3'}



```python
setR = {"R_1","R_2","R_3"}
setW = {"W_1","W_2","W_3","W_4"}
S_bag = setR.union(setW)
print(S_bag)
```

    {'W_2', 'W_1', 'R_1', 'R_2', 'W_4', 'R_3', 'W_3'}



```python
S_bag = setR | setW
print(S_bag)
```

    {'W_2', 'W_1', 'R_1', 'R_2', 'W_4', 'R_3', 'W_3'}



```python
S_die_even = set(filter(lambda x: x%2==0, S_die))
print(S_die_even)
S_die_3_or_more = set(filter(lambda x: x>=3, S_die))
print(S_die_3_or_more)
```

    {2, 4, 6}
    {3, 4, 5, 6}



```python
S_die_even <= S_die
```




    True




```python
S_die <= S_die_even
```




    False




```python
S_die <= S_die
```




    True




```python
set() <= S_die
```




    True




```python
{6,7,8} <= S_die
```




    False




```python
S_die > S_die_even
```




    True




```python
def P_dice(subset):
    return len(subset)/6
```


```python
P_dice({1,2,3,4})
```




    0.6666666666666666




```python
P_dice({5})
```




    0.16666666666666666




```python
P_dice(1)
```


```python
import sympy as sp
a = sp.FiniteSet(*S_die)
a.powerset()
```




    {EmptySet(), {1}, {2}, ..., {1, 3, 4, 5, 6}, {2, 3, 4, 5, 6}, {1, 2, 3, 4, 5, 6}}




```python

```

62dbdfea372734d37a8f24636c4a9004e6c09451
ipynb
Jupyter Notebook
math/math_set.ipynb
naokawa0609/naokawa
5547cea501259ce5b5bc8708e30760ad2f4187b2
MIT
2019-03-27T00:20:16.000Z
2022-03-30T22:34:11.000Z
math/math_set.ipynb
naokawa0609/naokawa
5547cea501259ce5b5bc8708e30760ad2f4187b2
MIT
2018-11-07T04:33:13.000Z
2018-12-31T01:35:16.000Z
math/math_set.ipynb
naokawa0609/naokawa
5547cea501259ce5b5bc8708e30760ad2f4187b2
MIT
2019-04-18T08:35:53.000Z
2022-03-24T05:17:46.000Z
Qwen/Qwen-72B
1. YES
2. YES