My task is something like this:

PrependTo[Evaluate[Table[{x, Sin[x]}, {x, 0.1, 2 \[Pi], 0.1}], {0., 1.}]]

where I tried also skipping the

Evaluate

and I get a

PrependTo::rvalue:

error.

If I do:

a = Table[{x, Sin[x]}, {x, 0.1, 2 \[Pi], 0.1}];

b = PrependTo[b, {0., 0.}];

everything works fine. I want it to be a part of a big code, so doing it in one line without defining the first list separately would speed up the program. And I don’t need the first list, only the second one, so why should I store both?

How can I deal with this problem?

Edit: The case is to make

Join[{{0., 0.}}, Table[{x, Sin[x]}, {x, 0.1, 2 \[Pi], 0.1}], 1]

but are there other, maybe better, solutions?

=================

Please read this answer (and all the nice answers to the question, if possible) mathematica.stackexchange.com/a/19804/193

– Dr. belisarius

Mar 16 ’13 at 15:10

=================

1 Answer

1

=================

PrependTo is probably not what you are seeking for, because it needs a variabl which is assigned. I guess you want Prepend

Prepend[Table[{x, Sin[x]}, {x, 0.1, 2 \[Pi], 0.1}], {0., 1.}]

Thank you, that’s what I was thinking about.

– corey979

Mar 16 ’13 at 13:07