0
$\begingroup$

Let u consider the case (given in Mathematica documentation as an example)

ysol = NDSolveValue[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1},y, {x, 0, 30}]

So, you can define a function of ysol like

y2 = FunctionInterpolation[soly[x]^2, {x, 0, x0}]

I'd like to integrate y2 and later define and Plot enter image description here

where y^2(x)=y2. As I said, I'd like to Plot z[x]. I dont know how to Integrate y2 symbolically in such a way we can Plot a function defined as above.

I'd like to refer question1 and question2 where this case were asked.

$\endgroup$
  • $\begingroup$ e.g. NIntegrate[ysol[x]^2, {x, 0, 30}]. $\endgroup$ – AccidentalFourierTransform May 8 '18 at 19:39
  • $\begingroup$ You could do yzsol = NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1, z'[x] == y[x]^2, z[0] == 0},{y, z}, {x, 0, 30}], but that's not defining it "later." $\endgroup$ – Michael E2 May 8 '18 at 19:43
  • $\begingroup$ You could use this answer to multiply ysol by itself. Then Integrate (not NIntegrate) can be used to compute the antiderivative of the result. $\endgroup$ – Michael E2 May 8 '18 at 19:46

Your Answer

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

Browse other questions tagged or ask your own question.