0
$\begingroup$

I have

pde1 = -y1''[x] - (2*y1'[x])/x + ((y1[x])^3 + y2[x])*y1[x] == 0;
pde2 = y2''[x] + (2*y2'[x])/x - (y1[x])^3 == 0
sol = 
  NDSolve[
    {pde1, pde2, 
     y1[1] == 0.001, y2[1] == -0.001, 
     y1'[0.001] == 0.001, y2'[0.001] == 0.001}, 
    {y1, y2}, {x, 30}] 

I need to plot the values of Integrate[y1[u] u^2, {u, xmin, x}] over the domain {xmin, xmax}.

$\endgroup$
2
  • $\begingroup$ Try Plot[Evaluate[y1[x] x^2 /. sol], {x, 0.001, 30}] $\endgroup$
    – Cesareo
    Commented Dec 2, 2019 at 13:28
  • $\begingroup$ thank you but i need the integration of the solution of( y1)*x^2 $\endgroup$ Commented Dec 2, 2019 at 13:36

1 Answer 1

4
$\begingroup$

You can augment your system to

pde1 = -y1''[x] - (2*y1'[x])/x + (10^-19 (y1[x])^2y2[x])*y1[x] == 0; 
pde2 = y2''[x] + (2*y2'[x])/x - (10^-25)*(y1[x])^2 == 0;
pde3 = y3'[x] == y1[x] x^2;
sol = NDSolve[{pde1, pde2, pde3, y1[1] == 0.001, y2[1] == -0.001, y1'[0.001] == 0.001, y2'[0.001] == 0.001, y3[0.001] == 0}, {y1, y2,y3}, {x, 30}]

and then

Plot[Evaluate[y3[x] /. sol], {x, 0.001, 30}]
$\endgroup$
1
  • $\begingroup$ thank you so much it's so helpful $\endgroup$ Commented Dec 2, 2019 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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