Skip to main content
Post Closed as "Duplicate" by Mr.Wizard
Post Reopened by Mr.Wizard
added 348 characters in body
Source Link
ac1965
  • 105
  • 6

EDIT: I believe this is not a duplicate question, because the answers to questions pointed to as similar DO NOT give practical solutions to the problems, at least not for normal Mathematica users like me (not computer science experts) who are endlessly confused by the arcane details of Set, SetDelayed, Evaluate, etc.

I thank Karsten 7 here who produced a practical, usable answer

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}]

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}]

EDIT: I believe this is not a duplicate question, because the answers to questions pointed to as similar DO NOT give practical solutions to the problems, at least not for normal Mathematica users like me (not computer science experts) who are endlessly confused by the arcane details of Set, SetDelayed, Evaluate, etc.

I thank Karsten 7 here who produced a practical, usable answer

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}]
Post Closed as "Duplicate" by Yves Klett, Öskå, Hector, Michael E2, Kuba
deleted 70 characters in body
Source Link
Karsten7
  • 27.6k
  • 5
  • 74
  • 135

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}]

Comment: trying to format the code with the 4 spaces but failing. using backtick instead

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}]

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}]

Comment: trying to format the code with the 4 spaces but failing. using backtick instead

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}]
added 566 characters in body
Source Link
ac1965
  • 105
  • 6

The following doesEDIT: 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;

gsol = Solve[{f[0] == f0, f[1] == f1, f'[1] == ff1, f'[0] == 0}, {a, +c, bd}, t;Reals];   

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

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

can you explain why? thanks

NOTE that instead writing explicitly the function does work: Manipulate[Plot[aPlot[g[t, +0.8, b0.9, t-1/2], {t, 0, 1}]

Plot[g[t, {af0, 0f1, 1},ff1] {/. {bf0 -> 0.8, f1 -> 0.9, ff1 -> -1/2}, {t, 0, 1}]

Comment: trying to format the code with the 4 spaces but failing. using backtick instead

The following does not work:

g = a + b t;  Manipulate[Plot[g, {t, 0, 1}], {a, 0, 1}, {{b, 1/2}, 0, 1}]

can you explain why? thanks

NOTE that instead writing explicitly the function does work: Manipulate[Plot[a + b t, {t, 0, 1}], {a, 0, 1}, {{b, 1/2}, 0, 1}]

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}]

Comment: trying to format the code with the 4 spaces but failing. using backtick instead

Source Link
ac1965
  • 105
  • 6
Loading