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 integration of solution(y1) * x^2.

New contributor
Bahi Mido is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
  • $\begingroup$ Try Plot[Evaluate[y1[x] x^2 /. sol], {x, 0.001, 30}] $\endgroup$ – Cesareo Dec 2 at 13:28
  • $\begingroup$ thank you but i need the integration of the solution of( y1)*x^2 $\endgroup$ – Bahi Mido Dec 2 at 13:36
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$
  • $\begingroup$ thank you so much it's so helpful $\endgroup$ – Bahi Mido Dec 2 at 14:14

Your Answer

Bahi Mido is a new contributor. Be nice, and check out our Code of Conduct.

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.