How Do You Resolve Negative Indices in Convolution Calculations?

  • Thread starter Thread starter AlecYates
  • Start date Start date
  • Tags Tags
    Sigma Summation
AI Thread Summary
The discussion centers on resolving negative indices encountered during convolution calculations in a geophysical context. The user struggles with the convolution formula and provides an example where they derive a shifted output compared to the textbook. The response clarifies that linear convolution involves flipping one function and shifting it to compute the output values correctly. An error in the textbook's formula is suggested, proposing an adjustment to the index to achieve the expected results. The conversation highlights the importance of understanding the convolution process and indexing to avoid confusion.
AlecYates
Messages
12
Reaction score
0
Hey,

I've begun going through a book called "An introduction to geophysical exploration" by Phillip Kearey and Michael Brooks and I've come across a problem I can't for the life of me see how they got their answer.

Essentially, given an input function gi (i = 1,2... m), and a convolution operator fj (j = 1,2 ...n) the convolution output is given by:

yk = \Sigmagifk - i (k = 1,2 ... m + n - 1)

(with Sigma index counter starting at i = 1 and going up to m).

Their example is with an input of g(2,0,1) and operator of f(4,3,2,1) the output is y(8,6,8,5,2,1).

If I'm trying to find y1 I end up with negative index of fj as I perform fk - i as i increases from 1 to 3 with the largest index being f0 (from f1 - 1 where k = 1 and i = 1). How can this be correct?

Either way, based on my own understanding and setting impossible indexes as 0, I get:

y1 = 0
y2 = 8
y3 = 6
y4 = 8
y5 = 5
y6 = 2

so my solution is y(0,8,6,8,5,2). Similar to theirs but shifted one place to the right (with 0 occupying the initial y1).

Any help with where I've gone wrong would be appreciated.
 
Last edited:
Physics news on Phys.org
AlecYates said:
Hey,

I've begun going through a book called "An introduction to geophysical exploration" by Phillip Kearey and Michael Brooks and I've come across a problem I can't for the life of me see how they got their answer.

Essentially, given an input function gi (i = 1,2... m), and a convolution operator fj (j = 1,2 ...n) the convolution output is given by:

yk = \Sigmagifk - i (k = 1,2 ... m + n - 1)

(with Sigma index counter starting at i = 1 and going up to m).

Their example is with an input of g(2,0,1) and operator of f(4,3,2,1) the output is y(8,6,8,5,2,1).

If I'm trying to find y1 I end up with negative index of fj as I perform fk - i as i increases from 1 to 3 with the largest index being f0 (from f1 - 1 where k = 1 and i = 1). How can this be correct?

Either way, based on my own understanding and setting impossible indexes as 0, I get:

y1 = 0
y2 = 8
y3 = 6
y4 = 8
y5 = 5
y6 = 2

so my solution is y(0,8,6,8,5,2). Similar to theirs but shifted one place to the right (with 0 occupying the initial y1).

Any help with where I've gone wrong would be appreciated.
Yup, their answer is straightforward, linear convolution.

Linear convolution happens all the time in nature, and one needs to deal with it all the time in all sorts of aspects of engineering and physics. [Edit: and statistics too.]

It's not so bad once you get used to it. At the risk of giving "too much help" on this, let me walk you through the beginning. I don't think I'm doing you a disservice by walking you through this, because you'll be doing this same sort of thing over and over again on your own eventually. I'll just try to get you started.

When convolving two functions, you need to take one of the functions and "flip" it. It turns out, it doesn't matter which one you flip, but you need to flip one (and only one) of them, around the first data point (for a continuous, time varying function the flip rotates the function around t = 0. But for this discrete function, we flip at i = 1, the first data point). Traditionally, the second function is flipped, but it really doesn't matter. So let's try this

Original functions:
Code:
            2   0   1
            4   3   2   1

Flipping the second function around the first point.
Code:
            2   0   1
1   2   3   4

Now to find the first output: we multiply each column, and add the results.
Code:
            2   0   1
1   2   3   4
--------------------
            8

So our first output value is 8.

Next, we shift the second function up by 1.
Code:
          2   0   1
  1   2   3   4
--------------------
          6 + 0
The second value is 6.


Shifting again for the third output,
Code:
          2   0   1
      1   2   3   4
--------------------
          4 + 0 + 4
Which gives 8 for the third value.

And you just keep on shifting,
Code:
          2   0   1
          1   2   3   4
------------------------------
          2 + 0 + 3
which gives 5,

And so on (you can finish up the rest). And you just keep on shifting and shifting until there is no more overlap. And that's linear convolution. :smile: Flip and shift as you multiply the two functions, summing the results of the multiplication (if it were a continuous function, you'd be integrating rather than summing). And that's all there is to linear convolution.

Now as an exercise, make sense of that with the i and k indexes and your original formula to make sure you understand what the formula is saying.

Edit: As another exercise, flip the first function instead of the second, and make sure you get the same results.
 
Last edited:
"Now as an exercise, make sense of that with the i and k indexes and your original formula to make sure you understand what the formula is saying."

Awesome feedback. It's actually the 'exercise' I was having the most issue with, though I appreciate the strong explanation of the method of convolution as it's new to me. I decided I wanted to use the sigma summation method as first point of call as having a mathematical background it seemed quite simple. I'm pretty sure at this stage there is an error in the textbook where...

yk = \Sigmagifk - i (k = 1,2 ... m + n - 1)

should be...

yk = \Sigmagifk - i + 1 (k = 1,2 ... m + n - 1)

This would give me the desired outcome. With the original y(1) = 0 in all cases, the issue I found.
 
AlecYates said:
"Now as an exercise, make sense of that with the i and k indexes and your original formula to make sure you understand what the formula is saying."

Awesome feedback. It's actually the 'exercise' I was having the most issue with, though I appreciate the strong explanation of the method of convolution as it's new to me. I decided I wanted to use the sigma summation method as first point of call as having a mathematical background it seemed quite simple. I'm pretty sure at this stage there is an error in the textbook where...

yk = \Sigmagifk - i (k = 1,2 ... m + n - 1)

should be...

yk = \Sigmagifk - i + 1 (k = 1,2 ... m + n - 1)

This would give me the desired outcome. With the original y(1) = 0 in all cases, the issue I found.

This is one of the reasons I like to index things starting the 0 instead of 1. It avoids issues like this. :biggrin:
 
Thread 'Collision of a bullet on a rod-string system: query'
In this question, I have a question. I am NOT trying to solve it, but it is just a conceptual question. Consider the point on the rod, which connects the string and the rod. My question: just before and after the collision, is ANGULAR momentum CONSERVED about this point? Lets call the point which connects the string and rod as P. Why am I asking this? : it is clear from the scenario that the point of concern, which connects the string and the rod, moves in a circular path due to the string...
Back
Top