# How to find the variational result of this functional according to the definition of textbook

I see this variational problem here.

The functional is : $$J(y)=y^{2}(x_{0})+\int_{x_{0}}^{x_{1}}(xy+y'^{2}) dx$$ In the textbook, the result of finding the functional variation according to the functional variation defined by Lagrange is : The variation sign δ has the following basic operational properties :

How to use MMA to define a correlation function and find the variation of this function according to the definition of Lagrange?

I really want to solve this problem, but when I replace y with y+ε*δ, it can't be expanded linearly, so I can't do further calculation.

f[x] /. f :> f + ε*δ
f'[x] + f[x] /. f :> f + ε*δ


I want to get the following result according to the linear operation rule of variation mentioned above:

f[x] + ε*δ f[x]
(f'[x] + ε*δ f'[x]) + (f[x] + ε*δ f[x])


The title of the book is 《变分法基础》, the author is 老大中. And the relevant content is on page 59 to page 63. You can get a photocopy of this book from here. The password of the online disk is wthj.

• have you seen EulerEquations? Feb 21 '20 at 3:03
• @AccidentalFourierTransform Yes. I've seen the built-in VariationalMethods function package, but I want to do a similar custom function to solve variational problem according to the textbook definition. Feb 21 '20 at 3:07
• Please provide the title and author of the textbook. Feb 21 '20 at 3:34
• @LouisB I'm sorry, the textbook is written in Chinese. The title of the book is called《变分法基础》, the author is 老大中 and the relevant content is from page 59 to page 63. Feb 21 '20 at 3:39
• What is the desired result? Feb 21 '20 at 8:14

To obtain the formal variation for the given functional we can use

J[y_, x_, x0_, x1_] := (y^2 /. {x -> x0}) + Integrate[x y + D[y, x]^2, {x, x0, x1}]
varJ[J_, y_, x_, x0_, x1_] := D[J[y + epsilon delta[y], x, x0, x1], epsilon] /. {epsilon -> 0}

varJ[J, y[x], x, x0, x1]


Regarding the result obtained

$$\delta J(y) = 2\delta(y(x_0))y(x_0)+\int_{x_0}^{x_1}(x\delta(y)+2\delta'(y)(y')^2)dx$$

NOTE

The operator should be able to detect

$$\delta'(y)(y')^2 = (\delta(y))'y' = (\delta(y)y')'-\delta(y)y''$$

concluding with

$$\int_{x_0}^{x_1}(x\delta(y)+2\delta'(y)(y')^2)dx = \int_{x_0}^{x_1}(x-2y'')\delta(y)dx-\delta(y)y'|_{x_0}^{x_1}$$

• Thanks a lot. But your variational sign $δ$ does not perform the variational correlation operation like the differential sign $d$, and the result is not consistent with that in the textbook. Feb 21 '20 at 2:04
• The operator $\delta(y)$ performs an action very similar to a differentiation. With the results in hand, we can choose which properties apply. Feb 21 '20 at 9:59
• This is what I mean. Can you write down the specific implementation process? Feb 21 '20 at 10:10
• Please. See attached note. Feb 21 '20 at 11:11
• Thank you very much, but the result of the code above is 2 y[x0] delta[y[x0]] + Integrate[(2 Derivative[y][x]^2 Derivative[delta][y[x]] + x delta[y[x]]) \[DifferentialD]x, {x, x0, x1}], while the result of the textbook is 2 y[x0] delta[y[x0]] + Integrate[(2 Derivative[y][x] Derivative[delta][y[x]] + x delta[y[x]]) \[DifferentialD]x, {x, x0, x1}], they are slightly different.How to modify them to be the same? Feb 22 '20 at 7:26

I am not sure if VariationalMethodsVariationalD works properly for this problem, but worthy of trying, I suppose.

<< VariationalMethods

Clear[J]
J = y[x0]^2 + Integrate[x y[x] + y'[x]^2, {x, x0, x1}];

VariationalD[J, y[x], x]


1/2 (-x0^2 + x1^2)

• I want a result like I want a result like 2 y[x0] δ[y[x0]] + Integrate[(x δ[y[x]] + 2 Derivative[y][x] δ[y'[x]]), {x, x0, x1}] or 2 y[x0] δ[y[x0]] + Integrate[(x δ[y[x]] + 2 Derivative[y][x] δ'[y[x]]), {x, x0, x1}] . Feb 21 '20 at 9:54
• @PleaseCorrectGrammarMistakes OK, VariationalD returns the variational derivative, which is not what you want for the moment. Feb 21 '20 at 11:20