I have a functional in the form:
$$F[s(x)]=\int_0^1(s(x)-a(x))^2\mathrm{d}x$$ where $a(x)$ is a parameter function, and I would like to find the functional derivative of $F$ with respect to $s$.
Following this documentation, I do:
Needs["VariationalMethods`"]
Define the funcitonal derivative without yet specifying $a$ and $s$:
vard[x_]:=VariationalD[(a[x]-s[x])^2, s[x], x]
Give $a$ and $s$ some example values:
a[x_]:=Sin[x]
s[x_]:=1.2*Sin[x]
Now my expectation is that if I ask for vard[0.5]
, I will get the value of the functional derivative at $x=0.5$. However, in reality:
vard[0.5]
I get after clicking Show Stack Trace
:
Message[VariationalD::args]
Message[VariationalD::args];False
RuleCondition[$ConditionHold[$ConditionHold[Null]],Message[VariationalD::args];False]
VariationalD[0.009193953882637202`,0.5753106463250436`,0.5`]
$UserPre[vard[0.5`]]
and: VariationalD[0.00919395,0.575311,0.5]
which is nice because $1.2\cdot\sin(0.5)$ is indeed ~0.57531064632
, and $(1.2\cdot\sin(0.5)-\sin(0.5))^2$ is indeed ~0.00919395
.
How to get the numerical value of the functional derivative at that specific point though?