Items tagged with indets

Feed

Hi everybody,

I have differential equation of the form eq := diff(x(t), t) = x(t) + 1  and I want to find the name of the dependent variable (more generally this issue concerns a differential system in N dependent variables).

How should I use “indets” in order to obtain {t, x(t)} ?

(indets(eq, name) returns {t}, while indets(eq, function) returns {t, x(t), d/dt x(t)}.

Thanks in advance

mas := proc(f)
return ln(diff(rhs(subs(_C1=0,dsolve(diff(y(x),x) = f))), x$2));
end proc:
mas(exp(x));
mas(mas(exp(x)));
mas(x^2);
mas(x^2+x^3);
 
when i hard code x, there is no problem in above code.
but when i op to get variable x and run below, it do not have problem when run line by line, but it has problem when run in
procedure
Error, (in mas) invalid input: diff received exp(x), which is not valid for its 2nd argument
 
mas := proc(f)
local martin:
martin := op(f):
return ln(diff(rhs(subs(_C1=0,dsolve(diff(y(martin),martin) = f))), martin$2));
end proc:
 
mas(exp(x));
mas(mas(exp(x)));
mas(x^2);
mas(x^2+x^3);

indets(AA(MM(AA(X1,X2),B2),MM(AA(B2,X3),X5)));
this can get a list of X1,X2,B2,X3,X5

propositionsentence := MM(AA("it", "run"), "maple"):
indets(propositionsentence);

but this can not get "it", "run", "maple"

how to do this in case this in maple 12?
 

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

Page 1 of 1