Question: Two strange results with indets

Can anyone tell me what is going on in the following worksheet? 


restart:

 

The following type  matches any second-or-higher-order derivative specified in D form with independent variables. You don't need to understand how this type works---which is, admittedly, convoluted---in order to understand the rest of this post.


TypeTools:-AddType(
     HODD,
     {typefunc(
           name,
           typefunc(
                name,
                {'`@@`'(identical(D), posint),
                 And(specindex(posint, D), satisfies(D-> nops([op(D)]) > 1))
                }
           )
      )
     }
);

 

Here's an expression which is simply a sum of various types of derivatives. Note that the first and last terms only differ in the dependent variable name.


expr:=
     D[1,2](u)(x,t) + diff(u(x,t), x, t) + diff(f(x),x$2) +
     diff(f(t),t) + (D@@3)(f)(x) + D(g)(x) + D[1,2](v)(x,t)
;

(D[1, 2](u))(x, t)+diff(diff(u(x, t), t), x)+diff(diff(f(x), x), x)+diff(f(t), t)+((D@@3)(f))(x)+(D(g))(x)+(D[1, 2](v))(x, t)

I1:= indets(expr, HODD);

{(D[1, 2](u))(x, t), (D[1, 2](v))(x, t), ((D@@3)(f))(x)}

The above result is as expected: Ds of order greater than 1 are selected; diffs are not. Now I try to extract the diffs also.

 

indets(expr, HODD &under (convert, D));

{diff(diff(f(x), x), x), diff(diff(u(x, t), t), x), (D[1, 2](v))(x, t), ((D@@3)(f))(x)}

The above result is missing D[1,2](u)(x,t) even though it contains the syntactically identical term D[1,2](v)(x,t)! Running trace  on `type/&under` shows that it never gets called for that missing term! So, the problem is not in &under. A further test shows that if the missing term is put elsewhere in expr (after restart, of course) then the indets works okay.

 

The following result is even weirder. One would expect that for any types T1 and T2 and any expression expr, that indets(expr, {T1, T2}) would equal indets(expr, T1) union indets(expr, T2), right? One would expect that even if there were a bug with one of the individual indets calls, right? So, note that I1 above contains the first term of expr, yet ...

indets(expr, {HODD, HODD &under (convert, D)});

{diff(diff(f(x), x), x), diff(diff(u(x, t), t), x), (D[1, 2](v))(x, t), ((D@@3)(f))(x)}

I get the same results if put the type explicitly in the indets calls rather than using AddType. I get the same results in Maple 16 and 18. So, what's going on?

 


Download indets.mw

Please Wait...