Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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);
share|improve this question

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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