1
$\begingroup$

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?

$\endgroup$
3
$\begingroup$

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

$\endgroup$
1
  • 1
    $\begingroup$ Your answer is great and thank you very much. $\endgroup$
    – user69323
    Feb 21 '20 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy