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
How to Make Fresh Sprouts | Live Free or Die: How to Homestead
I would like to show you how to make fresh clover sprouts. It’s one of the things that Tony and I have a hard time getting in the winter: our fresh vegetables. One solution to that is to make sprouts. Here I have a whole bunch of clover seeds. Just take a…
Inside the Paris Climate Conference | Years of Living Dangerously
This is the Olympics of climate change. If you’re not here, you’re not in the game, and the game is to do something urgently. We have the political will to change, and it really is the seminal meeting of leaders to determine what we do to combat this prob…
Two Minutes to Midnight
First, you’ll have to know what happens when an atomic bomb explodes. You will know when it comes. We hope it never comes. Ready, it looks something like this. Today, when discussing the destructive power of nuclear weapons or asteroids or any large-scal…
Finding zeros of polynomials (1 of 2) | Mathematics III | High School Math | Khan Academy
[Voiceover] So, we have a fifth-degree polynomial here, p of x, and we’re asked to do several things. First, find the real roots. And let’s sort of remind ourselves what roots are. So root is the same thing as a zero, and they’re the x-values that make th…
The Deutsch Files IV
I can only start with what understanding I want, right? And I know I’ve asked you this before, but I want to be pedantically exhaustive about connecting the four theories of the fabric of reality. The reason I bring that up is because I think most people …
How Bad Is Your Cognitive Dissonance?
All right, let’s try this little experiment. Yeah, don’t worry, that’s not gonna be the intro. Okay, so cognitive dissonance. Is there seriously another helicopter? It’s a plane this time. What do you want me to do? Wait, the shelf is right next to me. …