# VariationalBound with and interpolated trial function

I am trying to solve a Sturm-Liouville problem using the VariationalBound function of Mathematica, as recomended in the wolfram mathworld site. The example given in the Mathematica documentation is this:

In[2]:= eqn = y''''[x] + Pi y''[x] + 5  y'[x] == \[Lambda] y[x];

In[3]:= sol =
VariationalBound[{y[x] eqn[[1]], y[x]^2}, y[x], {x, 0, Infinity},
E^(c x), {c}]

Out[3]= {-1.74565, {c -> -0.633739}}


It is important to observe that if the trial function (Exp^(cx)) is far from the solution to the diferential equation, the compiler will show some error. For example, chosing cx as a trial function gives the following error messages:

In[227]:= sol =
VariationalBound[{ y[x] eqn[[1]], y[x]^2},
y[x], {x, 0, Infinity}, (c x), {c}]

During evaluation of In[227]:= Power::infy: Infinite expression 1/0 encountered.

During evaluation of In[227]:= Infinity::indet: Indeterminate expression 0 ComplexInfinity encountered.

During evaluation of In[227]:= VariationalBound::nonex: No meaningful extremum found in the specified parameter interval(s).

During evaluation of In[227]:= Part::partw: Part {1,1,1,2} of {{}} does not exist.

Out[227]= {0., {{}}[[{1, 1, 1, 2}]]}


In more complicated differential equations could be necessary to use a trial function that is an Interpolating Function of some data or an approximated solution to the ODE. So I tried this as an exercise:

tab = Table[E^(0.01 i), {i, 0, 100000}];

Ifun = Interpolation[tab, InterpolationOrder -> 4, Method -> "Spline"];

In[230]:= sol =
VariationalBound[{ y[x] eqn[[1]], y[x]^2}, y[x], {x, 0, Infinity},
Ifun[c x], {c}]

During evaluation of In[230]:= VariationalBound::int: The integral(s) involved cannot be evaluated.

During evaluation of In[230]:= VariationalBound::int: The integral(s) involved cannot be evaluated.


Changing the position of the parameter c do not make things better. So it seems that an interpolating function can not be used as trial function, but I think it must. Any help?

• Your approach has many problems. tab contains numbers as large as Exp[10^4], which is extraordinarily large, apparently too large for Interpolation to handle with splines. Since Ifun, if it could be constructed, would be defined only for x between 0 and 10^4, Ifun[c x] with c negative would be undefined. Finally, numerical integrals cannot be performed over an infinite range. Nonetheless, an interesting problem. One thing you might try is defining Ifun for negative arguments only. Commented Dec 17, 2016 at 0:02
• @bbgodfrey You are right the integral is not performed over all the real axis, this is a problem. I wonder if adding some Lagrange multiplier with a boundary condition could solve the finitude problem, however I failed to get a solution in this case as well. Commented Dec 17, 2016 at 1:56