I used "Table" to calculate and plot the following complicated function. First, we choose an initial value for $G$ and other parameters, but at later times $G$ changes with function $I_a$.
Y = 1; r1 = .3; r2 = .3; G = 0.35;
points = Table[L = G - Y; w = Sqrt[-4 + G^2 + 2 G Y + Y^2];
Ia = 1/(
8 w^2) (Cosh[2 L t] + Sinh[2 L t]) (8 + 2 G^2 - 2 w^2 +
4 G Y + 2 Y^2 - 2 (G^2 - w^2 + 2 G Y + Y^2) Cosh[2 r1] -
8 Cosh[2 r2] - 8 Cosh[2 t w] - 2 G^2 Cosh[2 t w] -
2 w^2 Cosh[2 t w] - 4 G Y Cosh[2 t w] - 2 Y^2 Cosh[2 t w] +
G^2 Cosh[2 (r1 - t w)] + w^2 Cosh[2 (r1 - t w)] +
2 G Y Cosh[2 (r1 - t w)] + Y^2 Cosh[2 (r1 - t w)] +
4 Cosh[2 (r2 - t w)] + G^2 Cosh[2 (r1 + t w)] +
w^2 Cosh[2 (r1 + t w)] + 2 G Y Cosh[2 (r1 + t w)] +
Y^2 Cosh[2 (r1 + t w)] + 4 Cosh[2 (r2 + t w)] -
4 G w Sinh[2 t w] - 4 w Y Sinh[2 t w] -
2 G w Sinh[2 (r1 - t w)] - 2 w Y Sinh[2 (r1 - t w)] +
2 G w Sinh[2 (r1 + t w)] + 2 w Y Sinh[2 (r1 + t w)]) +
Integrate[(
E^(2 L (t - u) -
2 (t + u) w) (E^(2 u w) (-G + w - Y) +
E^(2 t w) (G + w + Y))^2)/(4 w^2), {u, 0, t}] // Chop;
G = 1/(1 + Ia/.05);
{{t, Ia}, {t, G}}, {t, 0, 10, .05}];
Iapoints = Map[First, points];
varpoints = Map[Last, points];
ListLinePlot [Iapoints,PlotRange -> All]
ListLinePlot [varpoints,PlotRange -> All]
The output seems good to this point. But if I change the initial values as
Y = 2.2; r1 = .3; r2 = .3; G = 1.96;
and
G = 2/(1 + Ia/5)
then the output does not seem good. I couldn't upload the figure because I don't know how imgur works!
Anyway, I think the irregularities in the plots are due to error accumulation. I want to try a for loop that does the same job and see if the errors are still there or I can get a good plot for any parameters. But I don't know how to write a "for loop" for this problem.