0

This is a problem of no special significance or difficulty. I trimmed it down to the minimum to demonstrate the frustrating behavior:

(DSolve[{ y''[t] + +y'[t] + v y[t] == Sin[w t], y[0] == 0, 
 y'[0] == 0}, y[t], t][[1, 1, 2]]) // FullSimplify

assume the above is the first action in a new kernel session

Manipulate[Plot[%1, {t, .01, 10}], {v, 2, 5}, {w, 6, 10}]

This gives something that works

repeat the exact above except name the solution, and then try to use that in the second expression:

vvv = (DSolve[{ y''[t] + +y'[t] + v y[t] == Sin[w t], y[0] == 0, 
 y'[0] == 0}, y[t], t][[1, 1, 2]]) // FullSimplify

Manipulate[Plot[vvv, {t, .01, 10}], {v, 2, 5}, {w, 6, 10}]

This last form gives a dumb, mute manipulate. Sliders move, but you get nothing - no output.

This is Mathematica 10.1.0 on OSX 10.11.6

If this is a bug, I'm speechless. If there's something I'm missing then I'd love to know what it is).

Paul_A
  • 487
  • 2
  • 9

1 Answers1

3

Use explicit arguments in vvv

vvv[t_, v_, w_] = 
  DSolve[{y''[t] + +y'[t] + v y[t] == Sin[w t], y[0] == 0, y'[0] == 0}, y[t], 
     t][[1, 1, 2]] // FullSimplify;

Manipulate[
 Plot[vvv[t, v, w], {t, .01, 10}],
 {v, 2, 5, Appearance -> "Labeled"},
 {w, 6, 10, Appearance -> "Labeled"}]

enter image description here

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198
  • This "just makes it work" - does not explain why the second case (giving the solution a name, in this case vvv) makes the Manipulate mute/nonfunctional. – Paul_A Aug 30 '16 at 13:38
  • @Paul_A - @Kuba already told you that it is a scoping issue. Manipulate has the the attribute HoldAll which keeps the variables in vvv from being associated with the control variables unless the association is made by the use of explicit arguments in vvv[t, v, w]. Alternatively, you could move the definition of vvv inside the Manipulate. – Bob Hanlon Aug 30 '16 at 14:15