yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Laplacian computation example


4m read
·Nov 11, 2024

In the last video, I started introducing the intuition for the Laplacian operator in the context of the function with this graph and with the gradient field pictured below it, and here I'd like to go through the computation involved in that.

So, the function that I had there was defined as a two-variable function, and it's defined as ( f(x, y) = 3 + \cos\left(\frac{x}{2}\right) \cdot \sin\left(\frac{y}{2}\right) ). Then, the Laplacian, which we define with this right-side-up triangle, is an operator of ( f ), and it's defined to be the divergence – so kind of this ( \nabla \cdot ) times the gradient, which is just ( \nabla f ).

So, two different things going on: it's kind of like a second derivative. The first thing we need to do is take the gradient of ( f ). The way we do that is, we kind of imagine expanding this upside-down triangle as a vector full of partial differential operators ( \frac{\partial}{\partial x} ) and ( \frac{\partial}{\partial y} ).

With the gradient, you just kind of imagine multiplying that by the function, so if you imagine multiplying that by the function, what it looks like is just a vector full of partial derivatives. You're taking the partial of ( f ) with respect to ( x ) and the partial of ( f ) with respect to ( y ). Those are the two different components of this vector-valued function that is the gradient.

In our specific example, when we take the partial derivative of ( f ) with respect to ( x ), what we get is: so we look over here, ( 3 ) just looks like a constant, so nothing happens. The cosine of ( \frac{x}{2} ) has the derivative of that with respect to ( x ); we kind of take out that ( \frac{1}{2} ), so it's ( \frac{1}{2} ), and the derivative of cosine is negative sine, so that's ( -\sin\left(\frac{x}{2}\right) ).

As for ( \sin\left(\frac{y}{2}\right) ), well, ( y ) just looks like a constant, so ( \sin\left(\frac{y}{2}\right) ) is just some other constant, so in our derivative, we just keep that constant in there that ( \sin\left(\frac{y}{2}\right) ).

Then for the second component, the partial derivative of ( f ) with respect to ( y ): ( 3 ) still looks like a constant because it is a constant. Now ( \cos\left(\frac{x}{2}\right) ) looks like a constant as far as ( y ) is concerned since ( x ) is a constant. So, cosine of ( \frac{x}{2} ) is a constant.

But then, the ( \sin\left(\frac{y}{2}\right) ) has a derivative of cosine, and we also take out that ( \frac{1}{2} ); so you take out that ( \frac{1}{2} ) when you take the derivative of the inside, and then the derivative of the outside is cosine of whatever was in there, so in this case ( \frac{y}{2} ).

And we're multiplying it by that original constant ( \cos\left(\frac{x}{2}\right) ). So, still, we have our ( \cos\left(\frac{x}{2}\right) ) since it was a constant times a certain variable thing ( \frac{x}{2} ).

So that's the gradient. The next step here is to take the divergence of that. With that divergence, we're going to imagine taking that differential operator and dot-producting with this vector.

So, if I scroll down to give some room here, we're going to take that vector that’s kind of the same: the ( \frac{\partial}{\partial x} ) and I say "vector," but it is a thing ( \frac{\partial}{\partial y} ), and now we're going to take the dot product with this entire gradient.

I'll go ahead and just copy it over here. Let’s see, so we'll need a little bit more room to evaluate this. So here, when you imagine taking the dot product, you kind of multiply these top components together.

So, we're taking the partial derivative with respect to ( x ) of this whole guy, and when you do that, what you get is: you still have that ( \frac{1}{2} ), and then the derivative of ( -\sin\left(\frac{x}{2}\right) ). So that ( \frac{1}{2} ) gets pulled out when you're kind of taking the derivative of the inside, and the derivative of negative sine is negative cosine.

So, it's ( -\cos\left(\frac{x}{2}\right) ) multiplied by this constant ( \sin\left(\frac{y}{2}\right) ).

Then we add that because it’s kind of like a dot product; you add that to what it looks like when you multiply these next two components. So we're going to add. You have that ( \frac{1}{2} ), and then ( \cos\left(\frac{y}{2}\right) ).

When we differentiate that, you also pull out the ( \frac{1}{2} ), so again you have that pulled out ( \frac{1}{2} ). The derivative of cosine is negative sine, so now we're taking negative sine of that stuff on the inside ( \frac{y}{2} ), and we continue multiplying by the constant.

As far as ( y ) is concerned, ( \cos\left(\frac{x}{2}\right) ) is a constant, so we multiply it by that ( \cos\left(\frac{x}{2}\right) ).

So that is the divergence of that gradient field. The divergence of the gradient of our original function gives us the Laplacian. In fact, we could simplify this further because both of these terms kind of look identical.

But the main point of this video is kind of how you go through that process where you imagine taking the gradient of your function, and then the divergence of that, and that's what the Laplacian is.

See you in the next video.

More Articles

View All
The Alternative Vote Explained
Queen Lion of the Animal Kingdom is displeased. She recently introduced elections for the office of king using the first-past-the-post voting system. While her realm started out as a healthy democracy with many parties running candidates for king, it quic…
Warren Buffett Buys GOLD?
Well, it’s that time again. The 13Fs are out. Uh, so we as the little investors get to have a look at what the big money managers of the world are buying and selling. And definitely the most watched 13F filing is definitely that of Mr. Warren Buffett. Uh…
The FASTEST Way To $ 1 Million Dollars | Grant Cardone
I live off the yield and the dividends. I never touch the investment. I know exactly what I’m going to bring in, and I have the discipline not to spend more than I’m bringing in every month. That’s it. It’s a very simple philosophy in life. The more you m…
Eliminate | Vocabulary | Khan Academy
What’s up, wordsmiths? This video is about the word eliminate. [Music] It’s a verb. It means to remove or get rid of something. The word comes to us from Latin, and it’s a combination of two parts: “ex,” which means out or away (think exit), and “limit,”…
Why Don't We Shoot Nuclear Waste Into Space?
Here in the Kotart Labs, we test very important ideas to see what happens when you blow things up or play with black holes. Many of you suggested that we look into an idea that sounds reasonable: shooting nuclear waste into space. It’s one of those concep…
Gaining the Trust of the Gorillas | Dian Fossey: Secrets in the Mist
KELLY STEWART: Dian Fossey was definitely a pioneer. I do not think that word has been overused. Before that, nobody had done a long-term study of gorillas. Nobody had studied them month after month and year after year. IAN REDMOND: She wanted to be the …