$IterationLimit
Usage
Notes
Further Examples
This gives the current value of the $IterationLimit variable and uses old$IterationLimit to store its value.
In[1]:=
|
Out[1]=
|
This defines the function f.
In[2]:=
|
The definition can lead to infinite iteration.
In[3]:=
|
Out[3]=
|
Add a termination rule.
In[4]:=
|
Now the calculation will finish.
In[5]:=
|
Out[5]=
|
The calculation may still fail if the number of required iterations exceeds the value of $IterationLimit.
In[6]:=
|
Out[6]=
|
You can reset the value of $IterationLimit to a large value or to Infinity.
In[7]:=
|
Out[7]=
|
Now the calculation will finish within the allowed number of iterations.
In[8]:=
|
Out[8]=
|
This restores the original value of $IterationLimit.
In[9]:=
|
Out[9]=
|
In[10]:=
|
|