Hi,(adsbygoogle = window.adsbygoogle || []).push({});

I'd like to solve a DE, create a function with the solution, then use that solution in a Piecewise function, and then NIntegrate the Piecewise function but I can't get NIntegate to work. Here's what I'm trying to do:

NIntegrate then tells me it's not numeric in the interval.Code (Text):

mysol = NDSolve[{y'[x] == x, y[0] == 1}, y, {x, 0, 1}]

myy[x_] := Evaluate[y[x] /. mysol];

myf[x_] := Piecewise[{{myy[x], 0 < x <= 1}, {x^2, x > 1}}];

NIntegrate[myf[x], {x, 0, 2}]

Can someone explain to me what I'm doing wrong?

Thanks,

Jack

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# [Mathematica] NIntegrate Piecewise function with DE solution

Loading...

Similar Threads for Mathematica NIntegrate Piecewise |
---|

Mathematica Storing Mathematica output |

Mathematica Mathematica to MATLAB |

Mathematica Cannot do the integral of the Hyper-geometric function? |

Mathematica Cannot Plot This Function in Mathematica |

Mathematica While Loop in Mathematica |

**Physics Forums - The Fusion of Science and Community**