Message Boards Message Boards

0
|
16503 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Problems with 'Recursion depth of 1024 exceeded during evaluation of '.

Posted 8 years ago

Problems with 'Recursion depth of 1024 exceeded during evaluation of '. Hi ! I don't understand why I receive these error messages.

In[1]:= nmax = 3

Out[1]= 3

In[2]:= L = 1

Out[2]= 1

In[3]:= V = 387

Out[3]= 387



In[4]:= sigma[n_] := (n*Pi/L)

In[5]:= G[x_][t_][nmax_] := \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 
    1\), \(nmax\)]\(\((a[n]*Sin[sigma[n]*V*t] + 
     b[n]*Cos[sigma[n]*V*t])\)*Sin[sigma[n]*x]\)\)

In[6]:= a[n_] := (2/(sigma[n]*L*V))*\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(L\)]\ \(\((D[\(\(G[x]\)[
         t]\)[nmax], t] /. t -> 0)\)*
    Sin[sigma[n]*x] \[DifferentialD]x\)\)

In[7]:= b[n_] := (2/L)*\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(L\)]\(\(\(G[x]\)[0]\)[
     nmax]*Sin[sigma[n]*x] \[DifferentialD]x\)\)

In[8]:= a[1]

During evaluation of In[8]:= $RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of 2/(sigma[1] L V). >>

During evaluation of In[8]:= $RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of 2/(sigma[2] L V). >>

During evaluation of In[8]:= $RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of 2/(sigma[3] L V). >>

During evaluation of In[8]:= General::stop: Further output of $RecursionLimit::reclim2 will be suppressed during this calculation. >>
POSTED BY: Alexandre AZIER
2 Replies

Hello Alexandre,

Could you make the code easier to read, or attach a notebook to your post?

Also, I am curious, why G[x][t][nmax], rather than G[x, t, nmax]? Anyway, I doubt this could be the reason for the error.

OL.

POSTED BY: Otto Linsuain

G depends on a and b, and a and b both depend on G. Am I missing an edge case that makes this a valid recursive definition? Otherwise, the recursion error seems to make sense.

POSTED BY: Bianca Eifert
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract