Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to use a user-defined NormFunction with NDSolve, e.g.,

NormFunction -> (Norm[Take[#, 2], \[Infinity]] &)

which says that the infinity norm should be used on the first two state variables.

How can I use a compiled version of the NormFunction above? When using a user-defined NormFunction integration seems to take longer time, and this seems to be because the NormFunction is not compiled. I believe that this is the case since when I define a user-defined norm returning the default norm it takes longer time compared to when not specifying it (and hence get the default norm automatically).

Any suggestions?

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.