1

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 :

enter image description here

The variation sign δ has the following basic operational properties :

enter image description here

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

1 Answers1

4

You should notice that $y$ is a function, and $J$ is a function with function as argument, then things become clearly

ClearAll[\[Delta], J]
J[y_] := y[x0]^2 + Integrate[x y[x] + y'[x]^2, {x, x0, x1}]
\[Delta][F_ /; Module[{y}, FreeQ[Level[F[y], {-1}], y]]] := 
 Function[y, 
  Evaluate[D[
     F[y[#] + \[Epsilon] \[Delta][
           y][#] &], \[Epsilon]] /. \[Epsilon] -> 0]]
\[Delta][J][y]

This code gives the result you want

enter image description here

wuyingddg
  • 1,943
  • 10
  • 14