error: too large number in context
Show older comments
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??
Answers (1)
Walter Roberson
on 2 Feb 2012
0 votes
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 Comments
omnia
on 3 Feb 2012
Walter Roberson
on 3 Feb 2012
At the point it stops, what is the value of (Ea-Efc)/(K*T) ?
omnia
on 4 Feb 2012
Walter Roberson
on 4 Feb 2012
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
on 4 Feb 2012
Walter Roberson
on 4 Feb 2012
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
on 4 Feb 2012
Walter Roberson
on 4 Feb 2012
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
on 6 Feb 2012
Walter Roberson
on 6 Feb 2012
Ah, and what is vpa((Ea-Efc)/(K*T)) at that point?
omnia
on 6 Feb 2012
omnia
on 6 Feb 2012
Categories
Find more on Common Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!