1
$\begingroup$

I have solved a system of equations using NDSolve just fine. From there, I can plot the solutions $u(x)$ and $v(x)$, as well as its derivatives, just fine. But, when I want to evaluate the energy density for v, defined as $E(x)=\frac{\alpha}{2}(\frac{\partial v}{\partial x})^2+\beta((v^2-1)^2+\epsilon_2v)$, as well as the total energy, $\int_{0}^{10}E(x)dx$, I run into the following problem:

NIntegrate::inumr: "The integrand energiephi6 has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,10}}."

Here's the code:

eps = 1/4;
eps2 = 1/10;
eps3 = 1/10;
alpha = 1;
beta = 3;
a = 5.6294;
sol = NDSolve[{D[u[x], x, 
  x] == -(6 u[x]^5 - (8 + 4 eps) u[x]^3 + (2 + 4 eps) u[
      x] + (v[x]^4 - 2 v[x]^2 + eps2*v[x] + 1)*2 u[
       x]/(u[x]^2 + eps3)^2), 
alpha*D[v[x], x, 
   x] == -beta (4 v[x]^3 - 4 v[x] + eps2)/(u[x]^2 + eps3), 
u[0] == 0, u'[0] == a, v[0] == 1, v'[0] == 0}, {u, v}, {x, 0, 10}];
phi6n = Evaluate[v[x]] /. sol
phi6Dn = D[phi6n, x]
energiephi6[x] = 0.5*alpha*phi6Dn[x]^2 + beta ((phi6n[x]^2 - 1)^2 + eps2*phi6n);
energietotale6 = NIntegrate[energiephi6, {x, 0, 10}]
Plot[Evaluate[u[t]] /. sol, {t, 0, 10}, PlotRange -> All]
Plot[phi6n, {x, 0, 10}, PlotRange -> All]
Plot[phi6Dn, {x, 0, 10}, PlotRange -> All]
Plot[energiephi6, {x, 0, 10}, PlotRange -> All]

Thus far, all I could do was to identify this line as the culprit:

energiephi6[x] = 0.5*alpha*phi6Dn[x]^2 + beta ((phi6n[x]^2 - 1)^2 + eps2*phi6n);
$\endgroup$
2
$\begingroup$
phi6n = v[x] /. sol[[1]];
phi6Dn = D[phi6n, x];
energiephi6 = 0.5*alpha*phi6Dn^2 + beta ((phi6n^2 - 1)^2 + eps2*phi6n);
energietotale6 = NIntegrate[energiephi6, {x, 0, 10}]
Plot[energiephi6, {x, 0, 10}, PlotRange -> All]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.