ho to implement Sets in matlab
古いコメントを表示
hey everybody,, how to use Matlab in the set. problem: A = {1,2}, A ^ 2 = {(1,1), (1,2), (2,2) (2,1)};
how to find A ^ 100 by using Matlab?
2 件のコメント
John BG
2017 年 9 月 1 日
In this question the operation A^2 means
% find all combinations with repetition.
Since A is defined containing 2 digits only, A^100 is the same as asking
% find all combinations with repetition of 100 bits
100 bits are 30 digits in binary.
Walter Roberson
2017 年 9 月 2 日
Slight rephrasing there: Numbers of 100 binary digits require just over 30 decimal digits.
採用された回答
その他の回答 (2 件)
How many elements will this set have? Do you want to store 2^100 * 2 elements? A double needs 8 byte and Matlab uses about 100 bytes overhead for each vector. Then you need about:
1267650600228229401496703205376 * (2 * 8 + 100) Byte
147e15 PetaByte. This will let the solar system explode due to the required energy consumption.
So please tell us, which problem you actually want to solve. It is very easy to calculate a specific element and there cannot be any use in storing such a huge array.
2 件のコメント
John D'Errico
2017 年 9 月 1 日
"how to find A^100 by using Matlab?"
Answer: you don't. You find a better (i.e., doable) way to solve the problem.
Mahi
2022 年 10 月 29 日
0 投票
If X and Y are two sets such that n ( X ) = 17, n ( Y ) = 23 and n ( X ∪ Y ) = 38,
find n ( X ∩ Y ).
1 件のコメント
Steven Lord
2022 年 10 月 29 日
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!