I have a little question.

Let me define the function:


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:


Note that x[1] is not previously defined.

For example if I write:


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


and it is correct.

But if I define


and now I evaluate


I obtain error messages like (I post a figure for a more clear visulization): enter image description here

Thanks for any tips and helps.

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

If I understand what you are trying to do, observe that dummy variables can be anything, including indexed variables. To be concrete, if you define your h1 using "z":

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

Then for defined y, you can write:

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

and it returns a numerical value. Here the dummy variable "x[i]" in the NIntegrate is playing the role of "z" in the function definition.


Not the answer you're looking for? Browse other questions tagged or ask your own question.