error: too large number in context
古いコメントを表示
Hi there When I run my m file program, I have the following error. My program has a symbol called 'n' which I evaluate numerically. My program has functions I wrote before like 'gain_call'
??? Error using ==> sym.sym>char2sym Error, integer too large in context
Error in ==> sym.sym at 92 S = char2sym(x);
Error in ==> sym.maple at 92 result = sym(result);
Error in ==> sym.exp at 7 Y = maple('map','exp',X);
Error in ==> gain_call at 18 fc=(exp((Ea-Efc)/(K*T))+1)^-1;
Error in ==> gain_input at 45 g3=gain_call(Efc,Efv,freq_j,Eg);
Can anybody help me with this problem. I thought my laptop is not powerful enough to run this program as the error says 'too large number in context'. Is this true??
回答 (1 件)
Walter Roberson
2012 年 2 月 2 日
0 投票
exp((Ea-Efc)/(K*T)) would produce such a large result that Maple is not able to represent it.
I do not recall what the limit is for Maple; above 10^(10^8) and below 10^(10^9)
12 件のコメント
omnia
2012 年 2 月 3 日
Walter Roberson
2012 年 2 月 3 日
At the point it stops, what is the value of (Ea-Efc)/(K*T) ?
omnia
2012 年 2 月 4 日
Walter Roberson
2012 年 2 月 4 日
I do not see any 'n' in that expression. Are some or all of the variables symbolic in your gain_input routine? Do you subs() anything in to them before the fc= assignment?
In any case, if you command
dbstop if error
at the MATLAB command line, and you run the program, then when it stops in sym.sym, use the command line command
dbup
until it shows you that you are positioned in gain_call . At that point you should be able to examine the individual variables Ea, Efc, K, and T, and you should be able to evaluate (Ea-Efc)/(K*T)
I speculate that either K or T will be 0 at that point.
omnia
2012 年 2 月 4 日
Walter Roberson
2012 年 2 月 4 日
What does
(Ea-Efc)/(K*T)
calculate out to when the problem occurs?
Possibly vpa() of the expression might turn out to be suggestive.
omnia
2012 年 2 月 4 日
Walter Roberson
2012 年 2 月 4 日
Ah... it _might_ be the case that exp() is having trouble with those large numerators and denominators in rational form, as rational form always tries to work with exact solutions.
Perhaps if you inserted vpa() around the (Ea-Efc)/(K*T) it might work. Just be sure you use enough Digits to be meaningful for your purposes.
omnia
2012 年 2 月 6 日
Walter Roberson
2012 年 2 月 6 日
Ah, and what is vpa((Ea-Efc)/(K*T)) at that point?
omnia
2012 年 2 月 6 日
omnia
2012 年 2 月 6 日
カテゴリ
ヘルプ センター および File Exchange で Common Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!