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
Common denominators: 3/5 and 7/2 | Math | 4th grade | Khan Academy
Rewrite each fraction with a denominator of 10. We have two fractions: 3 fifths and 7 halves, and we want to take their denominators of five and two and change them to be a common denominator of 10. Let’s start with 3 fifths. We can look at this visuall…
15 Practical Advice for People Under 30
You’re young, and everyone is trying to point you in different directions. The problem is most of them are idiots. A society collapses when the wise listen and the idiots give advice. Those who haven’t walked the path can’t tell you what the journey is li…
Privacy Policy
Last Updated: 2024-11-07T15:51:10Z Thank you for choosing https://yego.me for your web service needs. We are committed to protecting your privacy and ensuring transparency about how we collect, use, and share your information. This Privacy Policy outline…
2005 Entrepreneurship Conference - Taking on the Challenge: Jeffrey Bezos, Amazon
I want to talk a little bit about how we think about innovation at Amazon.com and, uh, give you a couple of examples from the world. This is the whiffle ball and the guy, his name is David Nelson Malany, and in 1953 he took a Cody perfume package and, ou…
What Genetic Thread Do These Six Strangers Have in Common? | National Geographic
People have always asked me, kind of like where I’m from, what my race is, and I was not totally sure. [Music] I identify as mixed: white, black, and Native American African-American. But my mom would say, “You’re black, but you’re also white.” I didn’t u…
The truth behind jet lag...
The thing that everybody thinks is jet lag. People think it’s because of the time zone change; it really is not the time zone change. It’s the cabin altitude of the plane. If you ever go skiing and you go to a place that’s at 2500 or 3,000 M, and the fir…