Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
Please read this answer (and all the nice answers to the question, if possible) mathematica.stackexchange.com/a/19804/193 –  belisarius Mar 16 '13 at 15:10
add comment

1 Answer

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.}]
share|improve this answer
    
Thank you, that's what I was thinking about. –  corey979 Mar 16 '13 at 13:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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