Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I've tried to make some research, but without any luck.

How do I setup the Euler equation for this in Mathematica?:

$ \text{Min} \int_0^1\left(2x^2+ \left(4t-5 e^{r \, t} \right) x \, \dot{x} + 12e^{r \, t} \,\dot{x}^2 \right) dt,\; \; \text{for} \; x(0)=1, \; \text{and} \; x(1)=e^{\frac{1}{6}}$

Thanks a lot guys, and happy friday.

share|improve this question
1  
Take a look at VariationalMethods in the help –  belisarius Apr 12 '13 at 11:36

1 Answer 1

up vote 9 down vote accepted
Needs["VariationalMethods`"]
eu = EulerEquations[2 x[t]^2 + (4 t - 5 E^(r t)) x'[t] x[t] +  12 E^(r t) x'[t]^2, {x[t]}, t]
s=DSolve[Join[eu, {x[0] == 0}, {x[1] == E^(1/6)}], x[t], t]

Plot[x[t] /. s /. r -> # & /@ Range[-5, 5], {t, 0, 1},  Evaluated -> True]

enter image description here

ContourPlot[x[t] /. s, {t, 0, 1}, {r, -5, 5}, Evaluated -> True, 
 FrameLabel -> {Style[t, 20, Bold], Style[r, Bold, 20]}, PlotLegends -> Automatic]  

enter image description here

Edit

The dynamics for several values of the parameter r and the velocity profiles:

p = Plot[D[x[t] /. s, t]/14 + # /. r -> # /. t -> u & /@ Range[-5, 5], {u, 0, E^(1/6)},              
         Evaluated -> True, Filling -> Table[{i -> i - 6}, {i, 1, 11}], Axes -> False];
rs = Flatten@{#, -#} &@Range@5;
ss = Animate[Show[
         Graphics[{Line[{{0, #}, {E^(1/6), #}}] & /@ rs, PointSize[Large], 
                   Table[Point[{(x[t] /. s[[1]] /. r -> u) /. t -> v, u}], {u, rs}]}, 
                  PlotRange -> {{0, E^(1/6)}, {-6, 6}}, 
                  FrameLabel -> {Style[t, 20, Bold], Style[r, Bold, 20]}, 
                  Frame -> True, AspectRatio -> 1], 
                 p], 
     {v, 0, 1, .01}]

enter image description here

share|improve this answer
    
@PlatoManiac Thanks! –  belisarius Apr 12 '13 at 12:00
    
you just missed the s so no mention! –  PlatoManiac Apr 12 '13 at 12:06
    
Just to point out that one of your boundary conditions is different from the OP's. x[0] == 1. –  RunnyKine Apr 12 '13 at 15:49
    
@RunnyKine Thanks for pointing that out, I haven't noticed it. I think it doesn't make much difference to the system's dynamic behavior. –  belisarius Apr 12 '13 at 15:53
    
@Belisarius, yeah I figured it wouldn't make much of a difference, +1 by the way. –  RunnyKine Apr 12 '13 at 15:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.