Differential Operators and Harmonic Oscillators

Operator Calculus to Solve Heterogeneous Second Order Linear ODEs

Does Mathematica  apply the Fourier Transform/Derivative Rule Automagically?

FourierTransform[D[f[x], x], x, k]

Apparently not, define a set of rules that can be applied to get the operator effect:

DTransformRules  =  {FourierTransform[D[f_[x_], x_], x_, 
            k_]  ->  -I k FourierTransform[f[x], x, 
              k], 
FourierTransform[D[f_[x_], {x_, n_}], 
            x_, k_]  ->  (-1)^n (I)^n k^
              n FourierTransform[f[x], x, k]}

Let's see if it works...

FourierTransform[D[f[x], x], x, k] /. 
      DTransformRules
FourierTransform[f''[x], x, k] /. DTransformRules

Does  Mathematica apply the rules according to the Fourier Transform being a linear operator?

FourierTransform[a f[x]  +  b g[x], x, k]

Apparently not--so make some rules that can be applied.

ConstantRule  =  
      FourierTransform[a_  f_[y_], x_, k_] :>  
        a FourierTransform[f[y], x, k]

    
DistributeRule =   
FourierTransform[Plus[expr_], 
          x_,  k_]  :> 
        Distribute[FourierTransform[expr, x, k], Plus]

Try them out:

temp  = FourierTransform[a f[x]  +  b g[x]  +  d p[x], x, k] /. 
          DistributeRule /. ConstantRule

Let's  Fourier Transform the left-hand -side of a second order ODE:

ODE2nd  =  
      Mass D[y[t], {t, 2}]  +  Viscosity D[y[t], t]  +  
        SpringK y [t]

FrrODE2nd  = FourierTransform[ODE2nd, t, ω] /. 
            DistributeRule /. ConstantRule /. DTransformRules

rhs  =  
      FourierTransform[Cos[ ω0  t] , t, ω]

ftsol  =  
      Solve[FrrODE2nd  == rhs, 
        FourierTransform[y[t], t, ω]]

InverseFourierTransform[
      FourierTransform[y[t], t, ω] /. Flatten[ftsol], ω, t, 
      Assumptions  ->  ω0 >  0]

DSolve[{Mass D[y[t], {t, 2}]  +  Damper D[y[t], t]  +  
              SpringK y[t]  ==  Cos[(Subscript[ω, o]) t],  
          y[0] == 1, y'[0] == 0}, y[t], t] // Simplify

Functionals: An Introduction to Variational Calculus by way of Variation of Parameters

The "quickest" path of running up-hill  can be estimated with a model of how fast one runs up hill.  Given a starting point y(x=0) =0 and an ending point y(x=1)=1, the question is to find, among all possible choices of path y(x) that connects the end and starting point, which is the one that take the least time if there is a hill h(x) that has to be "run-up."
A reasonable model is that running speed is proportional to Cos(climbing-angle)--that is the velocity is 1 for running on a flat surface and goes to zero as the climbing-angle goes to (π/2) .

In this case, the time can be represented as an integral of the unknown y(x) (this is worked out in the accompanying lecture notes)
T[y(x)] = \(TraditionalForm\`∫\_\(x = 0\)\%\(x = 1\)\@\(\(1\)\(\ \)\(+\)\(\ \)\(\((dy\/dx)\)\^2\)\(\ \)\(+\)\((dh\/dx)\)\(\ \)\)\ dx\)
Suppose that the "hill" has the shape h(x) = (x^2).

Here, the "real" problem of finding the optimal path from the infinite set of all paths connecting y(x=0)=0 to  y(x=1)=1 will be replaced by looking at all third-order polynomials: y(x) = a + bx + cx^2

h  =  x^2;
YGeneral  =  a  +  b x  +  c (x^2);

The general path must satisfy the boundary conditions:

YSatisifyingBCs  =  
      YGeneral /. (Solve[{(YGeneral /. x -> 0) == 
                  0, (YGeneral /. x -> 1) == 1}, {a, c}] // 
            Flatten)

There is one remaining free variable, it can be determined by minimizing the integral

TimeIntegral  =  
      Integrate[
        Sqrt[1  +  (D[YSatisifyingBCs, x])^2  +  (D[h, x])^2], 
        x]

Time  =  
      Simplify[(TimeIntegral /. x -> 1)  -  (TimeIntegral /. 
              x -> 0)]

Plot[Time, {b, -2, 2}]

Bminsol  =  FindMinimum[Time, {b, 0, 1}]

YCubicSolution  =  YSatisifyingBCs /. Bminsol[[2]]

ApproxSolution  =  Plot[YCubicSolution, {x, 0, 1}]

The actual minimzing path can be found by using Calculus of Variations, it is:

YExactSolution  =  (((2  x (Sqrt[1 + 4 (x^2)]) +  ArcSinh[2 x]))/((2 (Sqrt[5]) + ArcSinh[2])));

Series[YExactSolution, {x, 0, 6}] // Normal // N

ExactSolution =  
      Plot[YExactSolution, {x, 0, 1}, 
        PlotStyle -> {Thickness[0.005], Hue[1]}]

Show[ApproxSolution, ExactSolution]