We have an assignment which is due on Tuesday, week after next.
It involves downloading a piece of software which, as I say this,
I realise I haven't quite put on the website yet, but I'll do it right after this lecture called PFO.
It stands for Brute Force Optimisation. And it's a nice example of a serious piece of software for not large scale optimisation.
It's for maybe 1 to 10 variables. But if you have a problem with 1 to 10 variables, PFO is a very remarkable, convenient piece of work.
It's all in MATLAB, freely available. I have a few miscellaneous things.
One is actually section 3.6 of our outline is to mention nails and coin O.R.
Now, last lecture. We already took a look at Neovasc briefly, which is the network enabled optimisation software.
Let's briefly now look at the other one. Just so you're aware of this coin.
Zero Hour is a funny name. Anyway, it stands for Computational Infrastructure for Operations Research.
This is another portal to a great deal of information about optimisation.
I'm not going to explore it now, but one reason I wanted to mention it to you is a reminder that operations research or in Britain,
we would say operational research has been a key source of optimisation technology.
In the early years, more or less during and after the war. This was where optimisation came from.
Now optimisation is much broader in its impact, but this is the classical root of it.
It's even connected with Soviet history.
The planned economy was one of the early, great examples in which people attempted to use optimisation to achieve good things.
It didn't work very well, but it was a noble effort and indeed one of the great early figures in optimisation, Kontorovich was from the Soviet Union.
None of you were even born when there was a Soviet Union. Okay.
The other thing I wanted to mention is this handout of the top 500 computer site.
I think I've mentioned top 500 a couple of times. They update their top 500 twice a year at once, as always in November.
So this is the update from last week.
And you can see that the fastest machines on earth are rated in the tens of teraflops.
They're incredibly fast.
The top ten are listed here and you can see they're from China, the US, Japan, the US, US, Switzerland, Germany, Saudi Arabia.
They're a remarkable collection of machines that are very remote from what we actually do day to day, most of us.
But if you take the trouble to use them with all their cores effectively, they can be incredible.
One thing to remind you of is that all of these ratings spring from the numerical linear algebra community.
The top 500 numbers are computed by running benchmarks, which effectively spring from the old linpack software subroutine libraries from the 1970s.
So it's all about numerical linear algebra used to rate computers as well as to solve problems.
There's a fair amount of scepticism about this list, and yet nobody can bring themselves to stop compiling it.
Okay. Well, today is the last lecture, and the theme of the lecture is optimisation with constraints.
As usual, I won't be able to go into things in depth, but I want to mention some of the features that turn up here.
So 3.7 is our constraints and linear programming.
Now in general in optimisation problem has something you're trying to minimise and then various constraints.
The thing you're minimising could be linear or nonlinear, and the constraints could be linear or nonlinear.
That description applies to continuous optimisation and a further complication as you might have discrete variables other than constraints,
which I'm not talking about now.
Linear programming is the case where everything's linear, and in practice the challenge is really to handle the constraints efficiently.
The kind of picture we have in mind is that we're in some high dimensional space and we have to lie to a certain side of various hyper planes.
So maybe we have to lie to that side of that hyper plane and to this side of this hyper plane and to this side of this hyper plane,
we're constrained to a feasible region of legal positions.
And within that region, we want to find an optimum, which is defined by minimising a linear function.
It sounds trivial and of course it is trivial on the whiteboard,
but once you get into millions of constraints and millions of variables, it's very far from trivial.
So let's write down the notation. So we seek to find a vector X in our M and such that.
We minimise f transpose x.
Subject to the constraints that a times X is less than or equal to be.
So I have to define what all of those things are. X, as I said, is an unknown and vector, and F is a given and vector also.
And then a is a given and by and matrix.
And B is a given m vector.
So the picture here is that I'm talking about a system with NW unknowns and m constraints.
Let's write that down. And The Matrix A defines the constraints that are linear constraints defined by this condition that affects less than or equal.
B Now what does that mean? This is a vector and that's a vector.
When I say less than a equal, I mean component wise.
So each component of x there m components has to be less than or equal to the corresponding component of B.
So this problem, which would have been considered too trivial to say anything about in the 19th century,
began to seem important in the 1930s, 1940s, 1950s, and has just become more and more so over the years.
It's absolutely at the heart of a lot of optimisation.
So I'm going to run a baby example. So let me write down that example.
I like to be able to draw it so it will be two dimensional. So here's our example.
Let's take the X Y plane.
So here's our plane.
We're going to take three constraints X less than or equal to, Y, x greater than or equal to minus Y and Y less than or equal to one.
So that defines a triangle. Why?
Less than or equal to one would be that constraint and x less than or equal to Y would be that constraint.
And X greater than or equal to minus Y would be that constraint.
So we're looking in this region in the X Y plane.
That's our feasible region. When you draw on the board, it's so trivial, but numerically, for many dimensions,
even finding a point in that region is not necessarily an easy problem.
And of course, there may be no point in that region if the constraints are inconsistent.
Now we need to minimise something.
So the particular vector I'm going to show in my code sort of points in that direction, or it's negative points in that direction.
It will be the vector F equals one too.
So the baby problem we're trying to solve is to find that point,
because that's the point that minimises the inner product of X with F subject to lying in that triangle.
Well, there's a long history here. I mentioned Kontorovich. And then another key name is dancing.
So George Dancing was a great genius who worked during the war on secret things, which were certainly related to this,
and then was at Berkeley right after the war, and more or less invented the modern field of linear programming right after the war.
He also became a key person in the RAND Corporation, which was the original think tank,
more or less set up to exploit academics for military purposes.
Dancing invented the so-called simplex algorithm.
Which in my simplistic history was one of the two biggest events, perhaps of the many decades of linear programming.
The simplex algorithm pictorially is an algorithm which recognises that the optimum will always be attained at some vertex.
So in principle all we have to do is check all the vertices.
Now they will be combinatorial many vertices.
So actually in the worst case it can be combinatorial is slow, but in practice it converges very quickly.
The simplex algorithm checks one vertex and then moves in a downward direction to the next vertex and then so on.
That makes it sound easier than it is. It's a brilliant idea of moving from one vertex to another until you find an optimal vertex.
The other legendary thing that happened was in 1984.
So let's say Danzig was in the forties and then Karmakar was 1984.
This was an Indian mathematician from Berkeley and Bell Laboratories who proposed a completely different method.
He proposed that you could do better by not hopping from one vertex to another, but by doing something in the interior.
So carmakers. Well, for a year or two, it was called Karmakar method.
But now everybody speaks of interior point methods.
Now, you know, one of my philosophical interests is the interplay of continuous and discrete things and finite and infinite things.
This is a fascinating example where you have a problem, which in principle is finite.
So in principle, to find the red dot, all you have to do is check the vertices whose number is finite.
The interior point approach is infinite. You're solving a continuous optimisation problem.
You're somehow trying to track along a curve that's getting closer and closer to the red dot.
In principle, that takes an infinite amount of work, but that infinite amount of work involves a very rapid convergence.
So in a practical sense, it's finite and indeed often quicker than the simplex method.
This whole approach was born in tremendous controversy.
Karmakar made claims that his method was 50 times faster than the simplex method,
which really annoyed people because he didn't release all the code and it was hard to verify the claims.
As things settle down, it turns out in many contexts these methods really are superior.
It would be rare for them to be 50 times superior. But these days, both classes of methods are very important interior point and boundary methods.
So let's see if we're going to solve this particular problem. Our constraints need to be formulated in the standard way.
So for our example, the constraints can be written in the form.
X minus Y is less than or equal to zero, minus x, minus Y is less than or equal to zero, and Y is less than or equal to one.
Now I can write that as a matrix problem. It's a three by two matrix times a two vector x y.
Should be less than or equal to a three by one vector. The first constraint would be one minus one zero.
The second constraint would be minus one minus one zero, and the third constraint would be 011.
So there's my matrix a and my constraint vector be.
So we're going in a moment. We're going to run that on the computer and see the very exciting result of the red dot.
Let me say a little more about the history. Of course, it's not just these two remarkable men.
There's been a huge amount of development over many years.
Danzig is reputed to have muttered under his breath that five Nobel Prizes were won by the Simplex method.
I've only heard that indirectly. I never heard him mutter it,
but the impact has been enormous and I tried to figure out which Nobel prizes those might be for the simplex method or for linear programming.
Of course, Danzig didn't get one because mathematicians don't get Nobel Prizes,
but scientists who use the products of mathematicians may get Nobel Prizes.
So depending how you analyse things, one of them was an early economics Nobel Prize in 1917 by Paul Samuelson,
which was certainly related to linear programming. Another one was Leo A.F.
In 1973. That was input-output analysis again in economics, which relates to the Soviet Union and all that stuff,
trying to optimise planning for an economy or for a production facility.
Another one is Kontorovich and Koopmans. And that was 1975, and they were working on optimal resource allocation.
Another one is Markowitz. Who was doing portfolio optimisation in 1990.
I don't know whether it's fair to say that the simplex algorithm won those Nobel Prizes,
but all of them certainly have something to do with linear programming.
If there's a fifth that Danzig was muttering about, I don't know what the fifth is.
Okay. Let's run a code here. This is another one that relies on something in the optimisation toolbox, so I'll have to switch to the other computer.
So I'm now looking at the one called M23 LP.
If you look at that code, you see the main thing it does is call line Prague, which is a MATLAB linear programming code.
So I set up precisely this matrix A and the vector F and the right hand side B, and then I call Lynn Prague and I draw a picture.
You recognise that picture from before? Now.
I haven't tried it on this computer. Let's hope it works. Okay.
MATLAB. Okay. So I'll say M 23 LP.
So there is the region. Very exciting.
And when I press return, you see a red dot. So isn't that impressive?
That's what graduate study at Oxford will do for you.
I have a couple of variants on the code to give a little bit of the flavour of things with larger scale.
So the next one M23 ran increases it.
So we have 40 constraints. Pick that random. So let's see what happens with M23 ran.
Oh, well. So let's see. I'll type em up. And 23 ran.
So there we just pick 40 constraints at random. So now, of course, because it's still two dimensional, it's easy for you to see where the optimum is.
But you can imagine if it were in many more dimensions. We're beginning to get into a real computational problem.
Let's do that one more time. Okay.
Let's do it a little bigger. There's another one on the computer called M23.
Ran big. So here. 40 is changed to 400.
Oops. Hmm.
What's going on there? Again.
I didn't check it on this computer. Oops.
I'm not sure what just happened. We seem to have a problem.
Houston. Let me just take a quick look at that in case it's obvious what the problem is.
Okay. So. Oh, I see.
I've tried to do 10,000. I meant to do 400. That's the problem.
Oops. Right. Okay. That looks a little better.
Let's see if that works. Okay.
So there you have 400 constraints. And it finds the dot.
Well, that's exciting. Do it again. 400 constraints and it finds the dot.
Now I've set it up so that obviously there is a feasible region and I've cooked up the constraints to have that property.
But of course, if you took 400 constraints at random without some kind of intent like that, there would be an empty, feasible region.
Let's at least try it one more and I'll change 400 to 2000.
You can imagine that there's a huge amount known about the complexity of these operations, these algorithms.
And it's been a fascinating interplay of theory and practice.
Are we have 2000 constraints. It still finds the red dot in computer science.
There has been tremendous interest over the last 40 years in the theoretical complexity of linear programming.
And this is a case where theory and practice have dovetailed in a very powerful way.
So it's a great example of theory, not being just theory of really affecting what people do.
Okay. I think that's all I'll show you for that thing.
Just continuing on the theme of Nobel Prizes, I mentioned Last Lecture that we have a bunch of interesting people at Oxford in optimisation.
There's Nick Gould, there's Cora Curtis is Rafael Houser and Felipe Plant.
The last of these is the visitor from Belgium who wrote the code that you're going to use on the assignment.
And I was asking them yesterday what Nobel Prizes have been won by optimisation more generally, not just linear programming.
And unfortunately they didn't come up with a good list, but one that does seem pretty clear is.
DFT now to a mathematician, DFT usually means discrete Fourier transform, but to a chemist it means density functional theory.
And let me just say a very quick word about this. First, let me ask.
We have physicists and chemists here. Has anyone here used this stuff?
Fantastic. Okay, that's interesting. That's four or five of you.
I'm impressed. So I've never had any connection with this. But as I understand it, the story goes.
Around 1926, quantum mechanics was figured out and.
Paul Dirac famously made the observation, well, that that's chemistry.
We've now solved chemistry. It's all done. All that remains is a computational problem to take Schrodinger's equation and solve it.
The trouble is, if you have any particles, the Schrödinger equation is a partial differential equation in a state space of three and dimensions,
and nobody can solve the partial differential equation in that kind of huge dimensional space.
So right from the beginning, around 1926,
there's been a huge effort in trying to find ways to approximate Schrodinger's equation and retain the key physics.
And then I guess a key step with happened with these people and they're sort of three people.
There's Walter Cohn is the one who got the Nobel Prize.
So that was the chemistry prize in 1998, 1998.
But there are two key papers from this field from the beginning of this field.
One of them is by him with a sham and the other is with Hohenberg.
So what these people discovered back then was that in in a certain precise sense, this vast,
high dimensional problem could be reduced to a high dimensional optimisation problem where they were able to show that
actually the key thing was to study a certain energy that depended on a configuration vector for where your electrons are.
So all you had to do was minimise this energy and then you could find initially ground states of complicated molecules.
So now I'm curious, since we have some people in the room,
I don't have much of a sense of how much that's really done with numerical optimisation methods.
Can any of you tell me, do you use what happens when you solve these things?
I've not had much experience of it. Yeah. Okay. How many, like, how big is n have.
Has anyone in here actually solved the problem like this on the computer? And how many unknowns were there?
Below ten. Below ten? Yeah. And are you in principle finding a minimum in a ten or 13 dimensional space?
Is that the idea? Um, yeah. So obviously I don't know much about this, but the impact, if you cannot overstate how important this is, indeed,
my very simple view of the world of difficult pdes is that there are two of them that are most amazing historically.
The Navier-stokes equations for fluid mechanics and the Schrodinger equation for chemistry and physics.
These are ancient things, you know. What is this? 1846, 1926?
These are great examples where we've sort of known the equations for a century or two centuries,
and yet solving the equations is a complete challenge that just goes on and on and on.
Century after century. Okay.
So that's all I'm going to say about linear things.
And now I want to turn to the quadratic case. This is not linear, I hasten to add.
So 3.8, let's say a word about quadratic programming.
And when you're in that subject in the constrained context, you always find yourself talking about Lagrange multipliers.
So just to remind you once again about the big picture, we have linear problems.
We have nonlinear problems. Now, nonlinear problems, of course, could have arbitrary, non-linear narratives,
but locally, at least a smooth, arbitrary non linearity will look quadratic.
So one way to think of a minimum is it's the bottom of a parabolic dish.
Now a point with a zero gradient might not be a minimum, it might be a saddle point.
So then you have a sort of like a parabola, but going up in some directions, down in other directions.
Quadratic programming is the part of optimisation where you actually deal with a quadratic function,
but it has this broader relevance because locally every function looks quadratic.
When there are constraints, well, when there are no constraints, that's sort of least squares fitting, which is huge.
Of course, when there are constraints, then we tend to use this word programming.
It's a kind of old fashioned word, and it always hints at optimisation with constraints.
So quadratic programming usually means minimisation of a quadratic function subject to constraints,
and it's the constraints that lead you to introduce Lagrange multipliers.
So I'm just going, as usual, to show you a simple example of how a Legrand multiplier might appear.
So suppose. We are looking for a vector x.
To minimise that energy functional. And I'm going to write that not as high but as Jay.
So we have an energy functional J of X and we're trying to minimise it.
Now in density functional theory,
that would be something very complicated and perhaps controversial as people try to figure out how to do the physics right.
But in quadratic form programming, it's simply quadratic.
So let's write it in this form. It's one half x, transpose x minus F, transpose x now.
And then there's also a constraint, which will be that B transpose X and I'm going to make an inequality constraint is equal to C.
So what are these things? X is an unknown vector that we're trying to find.
F is a given vector. A is a given matrix.
And the key thing here is that it's symmetric, positive, definite.
If it's not positive, definite, then you have descent directions.
And so the minimum is going to be minus infinity. So you need some kind of lower bound.
Positive, definite minus B is a given vector.
And see, I'm going to guess, do this as a given scalar.
So I'm showing you a simple version with linear programming.
I imagine we had m inequality constraints for this one because I want to show you Lagrange multipliers in their simplest context,
I'm imagining that we have one. Equality constraint.
Of course, that generalises to situations with more constraints.
So we're about to derive a Lagrange multiplier, which will be a scalar because there's one constraint.
More generally, a legrand's multiplier would be a vector if you have constraints.
Okay. So the La Grange idea is amazing.
I mean, this was hundreds of years ago, long before we had a field called optimisation.
But I guess La Grange was studying mechanics and various constraints on how things moved.
And he saw the right thing to do. So the right thing to do is to set up a la Grange in I don't know whether he called it Al.
Probably not. But anyway, the right thing to do is to introduce a new variable, which will be a scalar.
Since we have only one constraint and we make a new function called the Lagrangian, which consists of J, that is to say one half x,
transpose a x minus F, transpose x plus an additional term, which is B transpose x minus C times a scalar.
Now, let's think about what that means. This is the thing we're trying to minimise.
This is the constraint we're trying to satisfy.
So the constraint is that this should be zero.
Now. There are lots of ways to think about this. And in a minute I'll take a derivative and we'll see it mathematically.
But before doing that, let's sort of draw a picture.
We have a constraint here, which is the hyper plane B transpose x equals C, we're forced to lie on that line,
that space, that hyper plane, and we're trying to minimise this quadratic function subject to that constraint.
So we're trying to find not the global minimum of J, but the minimum of J on that constraint.
So. Let's imagine that the level curves of Jay.
Sort of look like this. So we're trying to find this point.
It's the point where Jay is as good as possible on the constraint.
Now, the Lagrange multiplier idea is essentially the geometric observation that at this point.
The direction you would go to improve the value of J is orthogonal to the constraint.
Anything you do along the constraint won't help.
If the only way to improve the up, the objective function would be to violate the constraint and go in an orthogonal direction.
And then here's Lagrange had this brilliant idea that.
This constrained point could be thought of as an unconstrained point.
If only the wind were blowing strongly enough in that direction.
Just the right amount of wind would sort of tilt the objective function so that this point became a global constraint.
And this is the wind speed, if you like. Okay, enough of that.
Let's write down the mathematics. But the idea is to turn a constrained problem into an unconstrained problem with one more variable.
So what we do is compute partial derivatives.
So the partial derivative of the Lagrangian with respect to the constraint.
Well, the constraint only appears here. So that's B transpose X minus C.
The other partial derivative would be respect to the X variable, and that's a gradient.
So the the partial derivative with respect to all the X variables is the gradient of L with respect to X, and that involves all of these terms.
That's a X minus F.
Plus to be. Now.
LA His idea is to find a point where all of these things are zero.
So we know that optimisation involves setting some kind of gradient to zero.
That's when you're at a flat point thanks to having the wind blowing.
That flat point will even satisfy the constraint.
And here's why. Well, let's see what the.
Suppose we find a stationary point. So suppose we find x and lambda such that both of these things are zero,
so the gradient is zero and the derivative with respect to the Lagrange multiplier is zero.
Then what does that imply? So well, first of all, it implies that the constraint is satisfied.
Because we just figured out that the partial derivative of the grunge in with respect to lambda
is that and if that zero the constraint is satisfied but also what it also implies is that.
That A X minus F equals minus lambda B.
That's what we get from this condition, which tells us that the how do I want to say this?
The gradient of J. Is equal to minus Lambda B.
So that condition says we satisfy the constraint. That condition says that the gradient is equal to minus lambda B.
But that's just this picture, because that's telling you that the gradient of the objective function is orthogonal to the constraint.
So if you believe the picture, it's got to be optimal.
The only way, if you move along the constraint, you won't improve the objective function.
So I'm saying it very quickly,
but this tells us that the solution of this unconstrained optimisation problem gives us a solution of the original constraint problem.
So the mathematics is just linear algebra.
And the key idea, which perhaps La Grange didn't have to have, is to think of it as a system of linear equations of size and plus one by end.
Plus one. Here's what it looks like. A.
B b transpose zero.
X lambda equals f c.
So this is an n plus one by n plus one system of equations.
It's linear because we've assumed that we started not with an arbitrary nonlinear function, but with a quadratic nonlinear function.
And what are these two equations? It's end by end, plus one by end plus one.
But you could also say it's block two by two. So it has a block structure of a two by two matrix.
The first row of that block structure would be a x plus B, lambda equals F, the second row is being transpose x equal B, transpose x equals C.
So that you see by solving this end plus one by end, plus one linear system of equations,
we satisfy all the Lagrange multiplier conditions and find our global optimum.
So this idea generalises to a huge part of the technology of quadratic programming and more generally linear programming.
Let me mention that. So of course, if we have them constraints.
Then we get em Lagrange multipliers or a vector of length.
Then we get a system of dimension.
And plus M. BI and plus M.
So again, if you have a quadratic objective function and a finite number of linear equality constraints,
you can solve the whole problem by solving a system of equations if it's more general.
If it's non-linear but not necessarily quadratic objective function.
Well, there are many ways to solve that,
but one of the ways is to locally approximate it by a quadratic and then sequentially use successive approximations.
And that method is called S Q P, which stands for successive or sequential quadratic programming.
So this 200 year old idea of electrons multiplier has morphed or evolved into one of the key ideas in non-linear programming generally.
I wanted to finish by telling you about a particular problem I've been involved in the last couple of years,
and that gets to this final handout about the Faraday cage.
So who's heard of the Faraday cage? Yeah.
Everyone's heard of it. It's amazing. Let me remind you what a Faraday cage is.
So suppose you have a metal shell. Metal is a conductor.
And therefore, the voltage, the potential, let's call it you, the potential on a metal scale will be constant.
And that means that inside a metal shell, if you have an electrostatic potential on the boundary, you just have that same constant potential inside.
So the solution to the pluses equation inside a metal shell is a constant.
So the gradient is zero. So inside a metal shell there are no electric fields because the gradient of the voltage has to be zero.
Now, what Faraday noted in 1836 was that the same seemed to work if you had.
A discrete approximation to a shell. I'm drawing it in two dimensions, but of course he would have been experimenting in three dimensions.
If you take a wire mesh, it seems to block electric fields as well as a solid metal mesh, a solid metal shell.
So in two D we can imagine we have a bunch of wires.
These are the cross-sections of the wires and they're all being held at the same voltage.
So the Faraday effect is that if you have a bunch of points in 2D or lines in 3D held at the same voltage,
then the gradient inside, of course nobody would say it's exactly zero, but it's approximately zero.
The famous example is a microwave oven where you have these microwaves inside that aren't allowed to get out.
How is that achieved while there's a lot of metal?
But the front door is metal with holes in it because you want light to get out and light has a much smaller wavelength.
So I got interested in that a couple of years ago, and this is a clippings from a talk I just gave the other day on the subject,
and it turns out that there's no literature on the Faraday cage.
And, well, there's a little. And what little literature there is is wrong.
So the the famous example or famous the the conspicuous example of a bit of
literature in this area is in Feynman's lecture notes on Physics and Volume two.
You can find a brief one or two page discussion.
He doesn't call it the Faraday cage, but he talks about shielding. So I've given you a quote there.
Feynman does an analysis, and then he says, Inside a screen, the field, the the fields are zero.
And of course, he means exponentially small. So he's saying that inside a screen like this, the fields are nearly the same as there.
So that turns out to be not true. It took us a long time to realise that with confidence.
If you look at Faraday's argument, you discover, rather than setting the voltages to be equal on the wires,
he's actually assuming that each wire has the same charge on it.
And that's not right. It's the voltage that's equal.
The point is that they're connected. So let me explain to you how that's a constrained quadratic programming problem.
So the way we look at that is imagine for simplicity that your cage consists of a bunch of a bunch of circles.
Or little desk, if you like. These are cross-sections of the wires. Out here.
You have some drive in some field that you're trying to shield.
So in two dimensions, that might be something like the log of Z minus some special point.
That's a two dimensional point charge in 3-D.
It would be analogous. The goal of the Faraday cage is to make the voltage nearly constant of here so that the electric field is nearly zero.
So if you think physically about what happens here, these are just passive wires.
They don't have any charge on them in a net sense, but the charge will nevertheless move around so that if this,
for example, is plus, then it will attract some minus charges here and repel some plus charges here.
Always neutral on balance. So the question becomes how will charges distribute themselves around this cage to minimise energy?
And that may explain why it's well, let's just stare at this thing.
The equations are at the bottom of the back. And what you see is that the quadratic energy term that we're trying to minimise to model the Faraday
cage consists of three pieces and two of them are sort of obvious and it's the third that's the surprise.
So let's go from back to front. The third piece is the energy with respect to the external field.
So if you have a certain charge here, then there's an energy associated with its interaction with that.
Obviously there's an inverse square force, an inverse linear energy.
So that's the third term in the equation. The middle term in the equation is the interaction between the charges.
So if there's some charge here and some charge here, they would repel or attract each other.
There's an energy associated with that. And then the first term is the surprising one.
So the way we're modelling this is where imagining that this disk has charged.
Q One on it and this one has charged. Q Two, these are just numbers.
Q So our unknown is a vector of charges.
And those charges will be distributed in such a way as to minimise the energy.
But the third term in the energy that's the first one as written down is the energy involved with
having a lot of charge on a small wire because it takes work to put charge on the small wire.
It's repelling itself. So the smaller the wire it is, the more work it takes and the more charge there is, the more work it takes.
Quadratics. So you go through all this and you find you have a quadratic, objective function.
You notice the first two terms are the quadratic, the squared part.
The first term is the diagonal of a matrix q k squared.
The second term is the off diagonal of the matrix. Q JQ.
K And it's symmetric. The third term is the linear part of the problem.
So we have exactly the format that I wrote down here.
This is this is the energy we're trying to minimise two terms go into there, one term goes there and then there's a constraint.
The total amount of charge is zero. So the sum of the Q case should be zero because there's no net charge on your passive Faraday cage.
In other words, the inner product of C with Q is zero.
If C is a vector of all ones. So it's a perfect example of a one constraint.
Quadratic programming problem. And of course, once you see that, you can solve it in great at great speed.
I have a little code that hopefully will do that. Let's see if it works. I'll try it on this computer.
Chris, does it matter which computer I use? No. Okay, let's try this one.
So suppose I try M24 Faraday, which is something I wrote up at Great Speed the other day.
So it's an ugly bit of code. But it does exactly this.
It solves this end plus one by end, plus one system. Let's give it a radius of each wire.
And the way it's set up is I click and every time I click it sets up this matrix problem and solves it.
So these are wires that I'm just putting into my cage. You see, the cage isn't at all closed yet, so it's not doing much shielding.
But as I close it off. The shielding will get better.
So every time I click, it's just solving another linear algebra problem.
And what could be easier than that? The time is spent in drawing the plot, of course.
So there you see the Faraday shielding effect.
And you see it's pretty good.
But you also see the fact that there are a few of those lines penetrating into the case shows that it's nothing like exponential.
And whether you're a microwave oven is as safe as it ought to be.
I don't know a fact about microwave ovens is that it's hard to see into them.
You know, there's a lot of metal in that front door. And obviously the engineers who measured this stuff were not reading their Feynman.
Thank goodness they realised you needed a lot of metal to have a good Faraday cage.
Okay, so we'll turn to PDS and Otis next term.
Thanks very much.