I have a function I want to integrate, which is $v(t)$.
solv = NDSolve[{v'[t] + (v[t])^2 + f == 0, v[0] == -I*k55},
v[t], {t, 0, 150}]
Also, I have a range tRange=[0,150,0.001]
. Now, what I want to do is to integrate this function v=v[t]/.solv
using the range I proposed. For example, say x1
and x2
are in the range, and xmin=0
, xmax=150
; how do I integrate v
from xmin
to x_1
, then x_1
to x_2
, then so on until xmax
with 0.001
of difference between each step. At the end, I want to put everything in a table. Is there any way how? Or is it possible to make a For[]
loop to get the results?
sol = NDSolve[{x''[t] + 3 x'[t] Sqrt[(x'[t])^2/6 + (1 - Exp[-x[t]
Sqrt[2/3]])^2/4] +
Sqrt[3/2] Exp[-x[t] Sqrt[2/3]] (1 - Exp[-x[t] Sqrt[2/3]]) == 0,
a'[t]/a[t] == Sqrt[(x'[t])^2/6 + (1 - Exp[-x[t] Sqrt[2/3]])^2/4],
τ'[t] == 1/a[t],
x'[0] == -0.008226306418212731,
x[0] == 5.630991866033891,
a[0] == 1,
τ[149.4517772937791] == 0},
{x, τ, a},
{t, 0, 500}]
a = a[t] /. sol;
\[Tau] = \[Tau][t] /. sol;
x = x[t] /. sol;
xt = x'[t] /. sol;
att = a''[t] /. sol;
tEnd = t /. FindRoot[(att == 0), {t, 0, 150}]
aEnd = a /. t -> tEnd;
H = Sqrt[(xt)^2/6 + (1 - Exp[-x*Sqrt[2/3]])^2/4];
V = 3/4 (1 - Exp[-Sqrt[2/3] x])^2;
Vt = Sqrt[3/2] Exp[-x Sqrt[2/3]] (1 - Exp[-x Sqrt[2/3]]);
Vtt = -Exp[-2 Sqrt[2/3]*x]*(Exp[Sqrt[2/3]*x] - 2);
t55 = t /. FindRoot[(aEnd/a == E^55), {t, 0, 150}];
\[Tau]55 = \[Tau] /. t -> t55;
a55 = a /. t -> t55;
eps1 = (1/2) (Vt/V)^2;
eta = Vtt/V;
eps2 = -4 eps1 + 2 eta;
k55 = a55*(H /. t -> t55);
\[Nu] = 3/2 + eps1 + 1/2*eps2;
f = k55^2 - (\[Nu]^2 - 1/4)/(\[Tau]^2);
k55
is undefined $\endgroup$V= NDSolve[{v'[t] + (v[t]^2 + f == 0, v[0] == -I*k55}, v[t], {t, 0, 150}]
:V[x2]-V[x1]
$\endgroup$V= NDSolve[{v'[t] + (v[t]^2 + f == 0, v[0] == -I*k55}, v[t], {t, 0, 150}]
:MapThread[V[#2]-V[#1&,{Rest[trange],Most[trange]}]
$\endgroup$