Example 18
Integrate[{s, 0, t}]
GIVEN: One ODE
REQUIRED: Solve it
SOLUTION: Generate example18.nb
x0 = 1;
a = 2;
f[t_] = Sin[t];
op[x_] := x0 - a*Integrate[x, {s, 0, t}] +
Integrate[f[s], {s, 0, t}];
exact = DSolve[{x'[t] + a * x[t] == f[t], x[0] == x0},
x[t], t];
x = 7 + 8 t;
xx = ToString[x];
aa = ToString[a];
ff = ToString[f[t]];
Print[""]
g = x /. t -> s;
Print["Start of Iteration ...."]
Print["Initial guess: x[t] =", x]
graph = {};
Do[S = op[g];
si = ToString[i];
llabel = StringJoin["Exact and Approx solns when i = ", si];
If[Mod[i, 3] < 1,
graph = Append[graph, Plot[{x[t] /. exact, S}, {t, 0, 1},
PlotLabel -> llabel, PlotRange -> All, DisplayFunction -> Identity]]
];
g = S /. t -> s, {i, 12}]
graph1 = Partition[graph, 2];
output = Show[GraphicsArray[graph1],
DisplayFunction -> $DisplayFunction]
Example
Homework:
a. Change the initial condition
Please send questions or suggestions about this web page to beatnic@aset.psu.edu
ASET | ITS | Penn State
|