3
$\begingroup$

I get an InterpolatingFunction, call if F1, as a solution to NDSolveValue. I then need to do further operations on this function. However, I only need to work with a small part of the domain of the function. Because of the dimensionality and complexity of the function, these operations are slow if I use the entire function. For example, I can take the gradient of F1 by using Grad[F1[x,y,z],{x,y,z}] which calculates the gradient on the whole domain. But I only need the gradient on a small subset of the domain, and since the gradient is a local operator, I don't need the rest of the function for that.

How can I create a new InterpolatingFunction from the F1 that has a smaller domain than F1?

$\endgroup$
  • $\begingroup$ perhaps something like dom = .4 <= # <= .5 && .7 <= #2 <= .75 && 0 <= #3 <= .1 &;F2 = ConditionalExpression[F1[##], dom[##]] &? $\endgroup$ – kglr Oct 3 at 18:56
  • 2
    $\begingroup$ There's a 1D version of this Q&A somewhere on site (I wrote an answer). The data structures in an InterpolatingFunction depend on the method used to construct it, so code for an MWE (using the same NDSolve method etc.) is probably needed. $\endgroup$ – Michael E2 Oct 3 at 19:25
  • 1
    $\begingroup$ Here's the 1D version: mathematica.stackexchange.com/questions/151845/… $\endgroup$ – Michael E2 Oct 3 at 19:38

Browse other questions tagged or ask your own question.