How can I do Mathematica-style
a = Table[2^(2 k) + 1, {k, 1, 3}]
Last[a], First[a]
Append[a,3]
in Octave?
How can I do Mathematica-style
a = Table[2^(2 k) + 1, {k, 1, 3}]
Last[a], First[a]
Append[a,3]
in Octave?
I'd do this as
2 .^ (2 * [1:3]) + 1
Here, [1:3]
stands for the vector [1,2,3]
and .^
denotes entry-wise exponentiation.
Added after question was edited:
These are rather basic questions. I think you need to spend some time learning Octave; for instance, read through this tutorial.