I used the compose operator on two functions (a vector-valued interpolated from ndsolve composed with Norm) and then passed the result to MaxValue, which works fine only if I reapply the norm. What is happening?

Raw input

sol = NDSolve[{v[u] == Derivative[1][r][u], Derivative[1][v][u] == {1, 1, 1}, r[0] == {0, 0, 0}, v[0] == {1, 1, 0}}, {r, v}, {u, 0, 1}][[1]]
speed = (v /. sol) /* Norm
MaxValue[speed[u], Element[u, Interval[{0, 1}]]]


Screenshot screenshot

  • 2
    $\begingroup$ Rather than an image, post actual Mathematica code (Raw InputForm) that can be copy and pasted into a workbook. $\endgroup$
    – Bob Hanlon
    Jul 6, 2018 at 19:07

2 Answers 2


I found this confusing too. The issue has nothing to do with compose "/*". You can reproduce it any other way.

Working with regions can be a bit strange. The issue was solved when I read this line in the documentation for MaxValue:

"For x ϵ reg, the different coordinates can be referred to using Indexed[x,i]."

So you really want:

MaxValue[speed[Indexed[x, 1]], x ϵ Interval[{0, 1}]]

The logic behind this might be confusing at first, but the point is that regions can be multidimensional, so you always get a "vector" or a list of values out of them.


Note that Interval[{0, 1}] is a one-dimensional region, so its elements are specified as lists of coordinates having length 1:

Element[{0.5}, Interval[{0, 1}]]

(* True *)

I would not call this strange or confusing, not any more than {1, 0} being an element of Disk[] or {0, 0, 0} being an element of FullRegion[3].

Since the speed function needs scalar input, something like

MaxValue[speed[u], Element[{u}, Interval[{0, 1}]]]

(* 3. *)

would be appropriate.

  • $\begingroup$ Both @Searke 's answer and yours solve the issue, I ended up using this form: MaxValue[speed[u], {u} [Element] Interval[{0,1}]] $\endgroup$
    – migrral
    Jul 8, 2018 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.