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!