# Thread: Calculus of variations (with a non-smooth integrand)

1. ## Calculus of variations (with a non-smooth integrand)

Hey guys

I am currently somewhat stuck on a calculus of variations question. Normally I'd just use the Euler-Lagrange equation, however I am somewhat confused by the max in the integrand. Hence I was hoping whether someone of you could help me to maximise

$\int_{y=v}^{v+1}\left[v+1-x\left(y\right)\right]\left[\phi'\left(y\right)y-\phi(y)\right]dy$

where $x\left(y\right)=\max\left\{ y,-\phi\left(y\right)\right\}$ and $\phi'\left(y\right)=\frac{\delta}{\delta y}\phi\left(y\right)$
with respect to the function $\phi\left(y\right)$.

Help would be greatly appreciated!
Will

2. ## Re: Calculus of variations (with a non-smooth integrand)

What is $\phi(y)$? Do you know for what values of $y \in [v,v+1]$ $y\ge -\phi(y)$? If you do, then split the integral into two integrals. For the values of $y$ where it is greater than or equal to $-\phi(y)$, replace $x(y)$ by $y$. For the values where $-\phi(y)>y$, replace $x(y)$ by $-\phi(y)$.

Edit: This is a guess. I have never studied calculus of variations.

3. ## Re: Calculus of variations (with a non-smooth integrand)

No, naturally I don't know that as it depends on my function phi, and I intend to maximize the above expression with respect to the function phi

4. ## Re: Calculus of variations (with a non-smooth integrand)

Do you have some initial conditions for $\phi$? What you can do is solve the two equations, which you get by substituting the two values of $x$, without the initial conditions. Next, put the initial conditions of $\phi$ and solve for the given $x$. Calculate when $x$ changes, say at $y_1$. You can now calculate the new initial conditions, i.e. $\phi(y_1)$, and find the constants of the second equation etc. It depends how many times this crossover happens. You may need to use numerical methods.

Edit
What you are actually doing is changing between two equations when $x$ changes. Whenever $x$ changes you calculate the initial conditions for the second equation from the final value of $\phi$. Once you write the equations for calculating the constants it shouldn't be that difficult to write a program to calculate the value of $\phi$.

5. ## Re: Calculus of variations (with a non-smooth integrand)

hey fobos, thanks for the reply, much appreciated!

So I don't have any initial conditions. However I know that this crossover will happen exaclty once, that is there exists $y_1$ such that $\forall y\leq y_1$ $-\phi(y_1)\geq y$ and $\forall y\geq y_1$ $-\phi(y_1)\leq y$, with equality only at $y_1$

so just to check whether I am understanding correctly what you're saying:
should I split the integral up in two parts (where the breaking point is the kink in x, say $y_1$) and then apply the Euler-Lagrange equation for both integrals, using, in both cases, the constrait $\phi(y_1)=-y_1$?
or am I misunderstanding you?

EDIT: and then maximize wrt $y_1$

6. ## Re: Calculus of variations (with a non-smooth integrand)

Originally Posted by WilliamH
hey fobos, thanks for the reply, much appreciated!

So I don't have any initial conditions. However I know that this crossover will happen exaclty once, that is there exists $y_1$ such that $\forall y\leq y_1$ $-\phi(y_1)\geq y$ and $\forall y\geq y_1$ $-\phi(y_1)\leq y$, with equality only at $y_1$

so just to check whether I am understanding correctly what you're saying:
should I split the integral up in two parts (where the breaking point is the kink in x, say $y_1$) and then apply the Euler-Lagrange equation for both integrals, using, in both cases, the constrait $\phi(y_1)=-y_1$?
or am I misunderstanding you?

EDIT: and then maximize wrt $y_1$
Well, if you don't have any initial conditions, $y_1$ will depend on the constants of integration. Also, you do not know what the initial value of $x$ is so this complicates things. What you are doing is splitting the integral the same way you would split it, if $x$ did not depend of $\phi$. However, because it depends on $\phi$ you first solve it with the first value for $x$ and then solve it for the second, once you find what $y_1$ is.

The split occurs $\phi(y_1)=-y_1$, so that will be the initial conditions for your second integral. If you don't know what the value of $x$ is, you will get a set of solutions. You see, let $I = I_1 + I_2$ be your integral. $I_1$ is the integral with the initial value of $x$ and at $\phi(y_1)=-y_1$ the integral $I_2$ takes place.

It's a bit hard to explain, so if anything is unclear just ask.

Edit:
The constraint $y_1$ must be satisfied by both equations but at different ends. For $I_1$ it is on the right but for $I_2$ it is on the left. For the first equation that is a final condition not an initial condition. It is when the second equation kicks in.

7. ## Re: Calculus of variations (with a non-smooth integrand)

apologies, i fear i am slightly struggling to understand how I should tackle this:
So how will I be finding $y_1$ and when do I maximize which interval?

8. ## Re: Calculus of variations (with a non-smooth integrand)

Originally Posted by WilliamH
apologies, i fear i am slightly struggling to understand how I should tackle this:
So how will I be finding $y_1$ and when do I maximize which interval?
Right. Basically, you have two intervals, each with its integral. If you solve each integral, you will get a solution with some constants of integration. Your final solution will be a piecewise function. The first part being the maximum of the first integral and the second part the second.

The point $y_1$ depends on your function $\phi$ i.e. $\phi(y_1)=-y_1$. For argument's sake let $\phi(y) = Ay + B$, where $A$ and $B$ are the constants of integration. Then:
$Ay_1 + B = -y_1$ or $y_1 = \frac{-B}{A+1}$.

Once you find $y_1$ you can solve the second integral in a straight forward manner. You know the initial conditions(i.e. $\phi(y_1)$) from the first integral.

Which integral is "the first one" and which is "the second one" depends on the initial conditions of $\phi$. So you have two scenarios. One where $x_0=-\phi$ and one where $x_0 = y$

What is $\phi$ anyway? Does it have a physical meaning? Do you know what $x_0$ is? I can imagine that in one of the two scenarios the function $\phi$ will never cross the threshold to change $x$.

9. ## Re: Calculus of variations (with a non-smooth integrand)

Okay this makes much more sense!

What do you define as $x_0$? Is that the (lower of the 2) lower integral bound?

I know that $\phi$ will definitely cross the bound from a different analysis and that for the lower y values $-\phi$ will be greater than $y$ and vice versa for the larger y values

10. ## Re: Calculus of variations (with a non-smooth integrand)

This is what I get.

$\mathcal{L} = (v+1)(y\phi' - \phi) + x(\phi - y\phi')$

The two Lagrangians are:
$\mathcal{L}_1 = (v+1)(y\phi' - \phi) + y\phi - y^2 \phi'$
and
$\mathcal{L}_2 = (v+1)(y\phi' - \phi) + y\phi\phi' - \phi^2$

From the first Lagrangian:
$\frac{\partial \mathcal{L}_1}{\partial \phi} = -(v+1) + y$
$\frac{\partial \mathcal{L}_1}{\partial \phi'} = (v+1)y - y^2$
$\frac{d}{dy}\left( \frac{\partial \mathcal{L}_1}{\partial \phi'} \right) = (v+1) - 2y$
Which gives:
$y = \frac{2(v+1)}{3}$

From the second Lagrangian:
$\frac{\partial \mathcal{L}_2}{\partial \phi} = -(v+1) + y\phi' - 2\phi$
$\frac{\partial \mathcal{L}_2}{\partial \phi'} = (v+1)y + y\phi$
$\frac{d}{dy}\left( \frac{\partial \mathcal{L}_2}{\partial \phi'} \right) = v + 1 + \phi + y\phi'$
Which gives:
$\phi = \frac{-2(v+1)}{3}$

Those are kind of weird results in my opinion. Imagine your first integral is with $\mathcal{L}_2$. Once you get to:
$\frac{-2(v+1)}{3} = -y$ you stop at a fixed $y = \frac{2(v+1)}{3}$.

11. ## Re: Calculus of variations (with a non-smooth integrand)

Originally Posted by WilliamH
Okay this makes much more sense!

What do you define as $x_0$? Is that the (lower of the 2) lower integral bound?

I know that $\phi$ will definitely cross the bound from a different analysis and that for the lower y values $-\phi$ will be greater than $y$ and vice versa for the larger y values
You find $x_0$ from the initial conditions. It is just the initial value of $x$.

12. ## Re: Calculus of variations (with a non-smooth integrand)

Where did you get that equation anyway? What are all the variables?