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
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
My Computer
System One
-
- OS
- Windows 8
- Computer type
- Laptop