# Part of array as a blank variable [duplicate]

I have a little question.

Let me define the function:

f[k_]:=k


So 'k' in the argument of 'f' is a blank variable.

Is there a way to define a part of array as a blank variable like:

g[x[1]_]:=x[1]


Note that x[1] is not previously defined.

For example if I write:

g[x_[i_]]:=x[i]


and if I write g[x[1]] the output is

x[1]


and it is correct.

But if I define

h1[x_[i_]?NumericQ]:=NIntegrate[y,{y,0,x[i]}]


and now I evaluate

NIntegrate[h1[x[1]],{x[1],0,1}]


I obtain error messages like (I post a figure for a more clear visulization):

Thanks for any tips and helps.

• This will not work. But could you elaborate a bit more your problem? Jan 14, 2022 at 11:21
• @DanielHuber, I'm going to edit my question and I'll add more details Jan 14, 2022 at 15:55
• @DanielHuber, I edit my answer, this is what I need. Jan 14, 2022 at 16:16
• You have not explained why you want dummy variables, in the function definition or the integral, to be indexed variables. Jan 14, 2022 at 16:34

h1[z_?NumericQ] := NIntegrate[y, {y, 0, z}];

NIntegrate[h1[x[i]], {x[i], 0, 1}]