I have a list in Mathematica for example


My question is, how I can define each element of this list be a function of t? Indeed I want something like this input


which its output is



  • 2
    $\begingroup$ you can do something like p[[1]] /. t -> .2 while this is not a function, it will give the same out you are looking for. $\endgroup$
    – Nasser
    Commented Feb 5, 2015 at 22:47
  • 1
    $\begingroup$ @Nasser Thanks a lot. Put your comment as answer. $\endgroup$
    – Qaher
    Commented Feb 5, 2015 at 22:51

2 Answers 2


There are few ways to do this. The simplest might be

   p = {1 + t, 1 + t + t^2, 1 + t + t^3};
   p[[n]] /. t -> .2

where n is the index. Or you can convert the list to actual functions like this

p = Function[t, #] & /@ p

Mathematica graphics

And now you can write p[[n]][.2] as you wanted.

Now for example, you can evaluate all these function for at some value using

  p[[#]][.1] & /@ Range[Length[p]]

Mathematica graphics

I am sure there are other ways to do this.


Try this:

p[m_, t_] := Table[Sum[t^i, {i, 0, n}], {n, 1, m}];

Then the list of three elements you gave in your question is obtained as follows:

    p[3, t]

(*   {1 + t, 1 + t + t^2, 1 + t + t^2 + t^3}   *)

and the first term of the list is

p[3, 0.2][[1]]

(*  1.2   *)

Have fun!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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