Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm doing a presentation and I have to include this in it:

for j in 1..j_max
    b_offset = copy(b)
    b_offset[j] = b_offset[j] + 1

I can't do b_offset = b + 1, but I don't know how else to describe that just the jth index should increase by one.

share|cite|improve this question
Just keep in mind that if you are too concise you risk confusing your audience. – chazisop Apr 13 '11 at 3:51
I'll explain what it means too. – user9525 Apr 13 '11 at 4:10
Can you give a small example? Even though at this point you've accepted an answer, it is unclear what it is you want. The code you give doesn't seem to match the words '...just the $j$th index should increase by 1.". Why wouldn't you just say b[j] = b[j]+1, without all the looping? – Mitch Apr 13 '11 at 13:58
up vote 1 down vote accepted

Treating them as vectors, you could say

$$\mathbf{b\_offset} = \mathbf{b} + \mathbf{e_j}$$

where $\displaystyle \mathbf{e_j}$ is the unit vector with all zeroes except the $j^{th}$ co-ordinate.

share|cite|improve this answer
That's not what I'm doing. It isn't a vector of ones. Only the kth element is one, so it would be something like [0, 0, 0, 0, 0, 1, 0, 0, 0], for example. – user9525 Apr 13 '11 at 3:49
@mr banana : See edit. I believe $e_j$ is standard notation. – Aryabhata Apr 13 '11 at 4:01
Not that I don't believe you, but could you tell me why is it e_j? I thought it would be something like 1_j. But thanks anyway. – user9525 Apr 13 '11 at 4:05
@mr banana: I am not sure. Perhaps for Euclidean. See this: under section for Symbols for Vectors. The wiki pages and seem to be using it too. – Aryabhata Apr 13 '11 at 4:18

Your Answer


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