# how to set initial conditions when solving recursive equation with tables

I am solving a recursive expression with ParallelTable. Here is a MWE showing how I do it, and how I set the initial condition:

SetSharedVariable[vals]
t[n_] := t[n - 1]*i*NIntegrate[Exp[-i*x^2], {x, -Infinity, Infinity}];

t[0] = 1;

vals = ParallelTable[{i, t[3]}, {i, 1, 500}];


The expression t depends on i implicitly. Now I want to make this dependency explicit, as shown here (note, it is not a functioning example!):

SetSharedVariable[vals]
t[d_, n_] :=
t[n - 1]*d*NIntegrate[Exp[-d*x^2], {x, -Infinity, Infinity}];

(* WHAT TO DO WITH THIS, THE INITIAL CONDITION? *)
t[i, 0] = 1;

vals = ParallelTable[{i, t[i, 3]}, {i, 1, 500}];


My concern is regarding the initial condition. When I am dealing with tables, is there an easy way to implement initial conditions, or do I have to use a For-loop for that (where i is the variable)?

-

Is this what you're looking for?

Clear[t]
SetSharedVariable[vals]
t[d_, n_] :=
t[d, n - 1]*d*NIntegrate[Exp[-d*x^2], {x, -Infinity, Infinity}]; (*missing d*)

t[_, 0] := 1;

vals = ParallelTable[{i, t[i, 3]}, {i, 1, 500}]


To check:

Table[t[i, 0], {i, 10}]

{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}

-