1

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}]]]

file

Screenshot screenshot

migrral
  • 15
  • 4
  • 2
    Rather than an image, post actual Mathematica code (Raw InputForm) that can be copy and pasted into a workbook. – Bob Hanlon Jul 06 '18 at 19:07

2 Answers2

0

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.

Searke
  • 4,404
  • 20
  • 23
0

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.

ilian
  • 25,474
  • 4
  • 117
  • 186
  • Both @Searke 's answer and yours solve the issue, I ended up using this form: MaxValue[speed[u], {u} [Element] Interval[{0,1}]] – migrral Jul 08 '18 at 15:55