Skip to main content
3 of 4
deleted 70 characters in body
Karsten7
  • 27.6k
  • 5
  • 74
  • 135

Using Manipulate with predefined expressions

EDIT: in view of the questions below, in particular Bill's one, here is the puzzling code. Manipulate and the first Plot do not work, the last Plot does. Why???:

f[x_] = a + c x^2 + d x^3;

sol = Solve[{f[0] == f0, f[1] == f1, f'[1] == ff1, f'[0] == 0}, {a, c, d}, Reals];

g[t_, f0_, f1_, ff1_] := f[t] /. sol[[1]];

Manipulate[
 Plot[g[t, f0, f1, ff1], {t, 0, 1}], {{f0, 0}, 0, 1}, {{f1, 1/2}, 0, 1}, {{ff1, 0}, -1, 0}]

Plot[g[t, 0.8, 0.9, -1/2], {t, 0, 1}]

Plot[g[t, f0, f1, ff1] /. {f0 -> 0.8, f1 -> 0.9, ff1 -> -1/2}, {t, 0, 1}]
ac1965
  • 105
  • 6