Do
Do[expr, {imax}] evaluates expr imax times.
Do[expr, {i, imax}] evaluates expr with the variable i successively taking on the values 1 through imax (in steps of 1).
Do[expr, {i, imin, imax}] starts with i = imin.
Do[expr, {i, imin, imax, di}] uses steps di.
Do[expr, {i, imin, imax}, {j, jmin, jmax}, ... ] evaluates expr looping over different values of j, etc., for each i.
See also: For, Table, While.
Examples
Using InstantCalculators
Here are the InstantCalculators for the Do function. Enter the parameters for your calculation and click Calculate to see the result.
In[1]:=
In[2]:=
In[3]:=
Entering Commands Directly
You can paste a template for this command via the Text Input button on the Do Function Controller.
Here is a Do loop that adds the first 1000 integers.
In[4]:=
In[5]:=
In[6]:=
Out[6]=
Clear the variable definition.
In[7]:=
|