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, 1}], x, k]

It does as of version 5.0! .

Table[FourierTransform[D[f[x], {x, i}], x, k], {i, 24}] // 
      MatrixForm

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 we make some rules that can be applied. It may be instructive to see how to do this.

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

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]

Otherwise, the complete solution (i.e., the inhomogeneous plus the homogeneous parts) can be calculated by the DSolve function

FullSimplify[
      y[t] /. 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][[0]], 
      Assumptions ->  ω0  >  0  &&   Mass  >  0  &&  
          Damper  >  0  &&  SpringK  >  0]

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

An early application of introductory calculus involves finding extreme values of a function y = y(x): values of the independent variable x are sought that maximize or minimize y(x). In the calculus of variations, a common problem involves finding an unknown function y(x) that minimizes a different function in which y(x) appears inside an integral. Here we pursue an answer to a problem of this type.

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 takes 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)] = (∫_(x = 0)^(x = 1))(Sqrt[1 + ((((dy/dx)))^2) +((((dh/dx)) )^2)]) 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 toy(x=1) = 1  will be replaced by looking at all second-order polynomials: y(x) = a + bx + c(x^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}]

OK, the time is a minimum somewhere on the interval 0 < b < 1.  Solving for the value of b at the minimum:

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

Now we can write the desired fuction that minimizes the time and plot it:

YCubicSolution  =  YSatisifyingBCs /. Bminsol[[2]]

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

The exact minimizing path can be found by using Calculus of Variations. The solution is obtained from a boundary-value problem which we do not take up at this point, but it is interesting to see the exact solution and compare it with the approximate one we obtained above.  The closed-form expression for the function that minimizes the climbing time is:

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

and a series approimation to this function is:

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

Now plot the exact solution and compare it to our calculated approximation...

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

Show[ApproxSolution, ExactSolution]

These two curves are very close!