Could anyone help me how to execute array of larger size.
조회 수: 2 (최근 30일)
이전 댓글 표시
I want to execute the following line
A=partitions(100)
When i execute the code I am getting the following error
Error using cell
Maximum variable size allowed by the program is exceeded.
Error in partitions (line 64)
C = cell(S,1); % Main Cell.
Error in test (line 1)
A=partitions(100)
In the same line when i used
A=partitions(10)
It executes.
Could anyone help me is there any other way to execute it for 100.
댓글 수: 6
Walter Roberson
2021년 11월 10일
Imagine you have a 64 core machine, with each of the cores operating at 5 gigahertz clock rate. Imagine further that you could fully evaluate based on one of the subsets in 1 clock instruction (which is obviously not enough for real work, but perhaps would be enough for the simple task of counting the state.) Under this imaginary scenario, you could count
format long g
max_per_second = 5*10^9 * 64
bell100 = bell_number(100)
seconds_required = seconds(double(bell100) / max_per_second)
years(seconds_required)
That is over 10^96 years -- 4.7 yotta yotta yotta yotta years.
To put it another way, if you had started at the time the universe formed,
universe_age_seconds = str2sym('436117076900000000')
operations_per_second_needed = vpa(bell100 / universe_age_seconds)
If the universe is in the upper limit of how large it is estimated to be, and if every elementary particle in the universe had been calculating at about 10^12 operations per second since the time the universe began just to count the subsets, then it would be about ready now.
When I say "upper limit", I mean that the generally accepted size is about a factor of 10^10 smaller, but a few people have speculated that if one of the modified gravity theory holds, and there are extensions to the Standard Model, that there might be a lot more to the Universe than has been calculated.
All of which is to say that the probability that you would be able to successfully do an exhaustive search over the desired domain is ZERO.
function B = bell_number(nfinal)
if nfinal == 100
B = str2sym('47585391276764833658790768841387207826363669686825611466616334637559114497892442622672724044217756306953557882560751');
return
end
b = zeros(1, nfinal+1, 'sym');
b(1) = 1;
for i = 2:nfinal+1
b(i) = sym(0);
for j = 0:i-2
b(i) = b(i)+nchoosek(sym(i-2),sym(j))*b(j+1);
end
end
B = b(end);
end
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Number Theory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!