Maximum variable size allowed by the program is exceeded.

Hi my code is below
clc
format long g
a=588545.909;
b=10167.688;
c=150;
ox=302;
oy=192;
for oz= 1800:1:2313
oev=a.*ox+b.*oy+c.*oz ;
oce=oev+500000;
less=round(oce.*0.9,3);
x1=250:.001:1550;
y2=150:.001:1450;
z3=1200:.001:2500;
x=perms(x1)
y=perms(x1)
z=perms(x1)
then the error come
Maximum variable size allowed by the program is exceeded for x=perms(x1)
need to overcome the error. How can I?

 채택된 답변

Steven Lord
Steven Lord 2020년 4월 10일
You can't.
The output of perms(x) has factorial(n) rows, where n is the number of elements in x. How big is that?
>> x1=250:.001:1550;
>> vpa(factorial(sym(numel(x1))))
ans =
1.2633683274814429271576127065521e+7383553
The number of hydrogen atoms in the observable universe is estimated to be around 1e80.

댓글 수: 5

dear Steven,
actually my total code is given below-
clc
format long g
a=588545.909;
b=10167.688;
c=150;
ox=302;
oy=192;
for oz= 1800:1:2313
oev=a.*ox+b.*oy+c.*oz ;
oce=oev+500000;
less=round(oce.*0.9,3);
x=250:.001:1550;
y=150:.001:1450;
z=1200:.001:2500;
o=((a.*x+b.*y+c.*z));
t=o+500000;
v=0.9.*(t);
hvp=((t-less).*100)./t;
hvptrunc=round(hvp,3);
qp=round(t-(t.*(hvptrunc./100)),3);
qpwod= round(t,3);
difwod=round(abs(qpwod-less),3);
dif=round(abs(qp-less),3);
[m,ind]=mink(dif,1);
[mwod,indwod]=mink(difwod,3);
% disp([oz x(ind(1)) y(ind(1)) z(ind(1)) dif(ind(1))]);
T = table(oz,x(ind(1)),y(ind(1)),z(ind(1)),hvptrunc(ind(1)),less,qp(ind(1)),dif(ind(1)))
T1= table(oz,x(indwod(1)),y(indwod(1)),z(indwod(1)),less,qpwod(indwod(1)),dif(indwod(1)))
end
I want to know all the possible combination of the values of x, y and z for whose value will give qp-less= 0.
Brute force isn't going to work.
Let's take a step back. What's the main problem you're trying to solve? If you explain your goal in words (not equations and not code) we may be able to offer suggestions for other ways to achieve your goal without trying to create such a huge array. Explain like you were explaining to someone with knowledge of mathematics but little or no knowledge of your specific application.
At the very least, once you have a fixed value for x and y that likely severely restricts the possible values z can have. Requiring the expression you round to form qp to be within a certain distance of less (so qp, the rounded form of that expression, is equal to less) will put some limits on what t can be and so what z can be.
MD.MASHRAVI SHAMS
MD.MASHRAVI SHAMS 2020년 4월 11일
편집: MD.MASHRAVI SHAMS 2020년 4월 11일
thank you very much for your kind advice dear Steven.
ax+by+cz= T
i need to get solution for x,y and z where
  1. a,b and c is constant
  2. T is known
  3. i know the value ranges of x,y and z
  4. the value of the 3rd digit after point(.) can not be zero for x,y and z. for example x= 1200.001 or x=1200.005 or x= 1200.009 , but it can not be 1200.000.
  5. all the calculations has to be done upto 3rd digit after point(.)
  6. i can apply percentage on (ax+by+cz) to achive the value of T. for example you can apply 1%-99.999% to achive the exact value of T.
  7. i need to get all the possible solutions of x,y,and z toachive the value T.
dear brother is it a bit clear for you to understand my problem? i need the solution Steven,please help.
If you multiply both sides of the equation by 1000 (so x, y, and z are integers) you may be able to use some of the techniques for Diophantine equations to obtain your solutions.
dear steven, i have write another code for Diophantine equation. but it runs for last 7 hrs
a=588545.909;
b=10167.688;
c=150;
x=250:.001:1550;
y=150:.001:1450;
z=1200:.001:2500;
o=(a.*x+b.*y+c.*z);
t=o+500000==162486009.553;
[xSol, ySol, zsol] = solve(t,[x y z])
is there any wrong in this code?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by