• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Manipulate in MATHEMATICA

ramprasad

Junior Member
Dear all,

I am trying to implement an algorithm using manipulate environment. But its not working properly. Kindly figure out the error.
The same code outside manipulate works fine. Following are the codes.

Without manipulate
Module[{G, f, h, n, A, p}, Off[]; G[t_, s_] := s(t - 1);
f[0][t_] := t^2;
h[t_] := Sin[t]; n = 3; a = 0; b = 5;
f[1][t_] := Integrate[G[t, s]
h[f[0][t]],
{s, 0, 1}];
Do[f[i + 1][t] = Integrate[G[t, s]*h[f[t]], {s, 0, 1}], {i, n}];
Do[Print[Panel[f[t]]], {i, n}]; p[k_] := f[k][t];
A = Array[p, {n}];
Plot[A, {t, a, b}]]

Inside manipulate
Manipulate[
Module[{G, f, h, n, A, p}, Off[]; G[t_, s_] := Gr; f[0][t_] := g;
h[t_] := r; n = 3;
f[1][t_] := Integrate[G[t, s]h[f[0][t]], {s, 0, 1}];
Do[f[i + 1][t] = Integrate[G[t, s]
h[f[t]], {s, 0, 1}], {i,
n}];
Do[Print[Panel[f[t]]], {i, n}]; p[k_] := f[k][t];
A = Array[p, {n}];
Plot[A, {t, a, b}]], {{Gr, s*(t - 1), "Green's Function"}},
{{r, Sin[t], "Function in RHS"}}, {{g, t^2,
"First Guess Solution"}},
{{a, 0, "Left extreme of interval"}}, {{b, 5,
"Right extreme of interval"}},
TrackedSymbols -> True, AutorunSequencing -> {1}]

Regards,
Ramprasad
 
Back
Top