> q := x^(1/2):
> type(q, `^`);
true
> op(0,q);
^
> subsindets(q, `^`, f->subsop(0=H,f));
Error, (in unknown) improper op or subscript selector
What's wrong with that last one? It's modelled on the first Example in the ?subsindets help-page.
Are there cases where the following would not be a good enough workaround?
> subsindets(q, `^`, f->H(op(f)));
H(x, 1/2)
The same thing seems to happen for `*` and `+`. But this infix neutral operator seems ok,
> z := s &* P;
z := s &* P
> subsindets(z, specfunc(anything,`&*`), f->subsop(0=H,f));
H(s, P)
acer
illegal use of subsop
See the help page for subsop, third bullet, second sentence
Note that neutral operators are represented as functions,
ok, but..
Thanks Joe, but I was not surprised that it worked OK for `&*`.
I'm wondering why it doesn't work for `^`, `*`, and `+`. As I believe that I showed, op(0,..) of such things can be accessed.
acer
Not implemented
Unfortunately,
opandsubsopare not completely symmetric. They are 2 totally different pieces of code, and not all ofop's features are supported bysubsop. I do not know of a 'good' reason for that, just history.history and future
More important would be to know whether these things can be made consistent. And if they can, they will.
Consistent
I am fairly sure that they can be made consistent. As to when that will happen, you'd have to ask for the prioritized task list for the Kernel Group to figure that out. Somehow I would guess that this doesn't rank too high...
Road map
I would find very useful to know such lists. Ie know where Maple is going. I guess that Maplesoft's policy is not to show its cards the competition, though.
Exactly!
As long as Maple remains a closed-source product, that will be so. Note that this is not necessarily related to Maplesoft being for-profit, as many companies (like Mozilla, Sun and Red Hat) have shown.
type
I do not know whether it is a good reason, but I have just happen to compare these two paragraphs, the one in ?subsop, cited by Joe:
with this one in ?op:
I.e., 'subsop' for 0 is allowed for those objects whose 'op' 0 is not the type.
Though it is not an explanation as why this is so, this relation makes me simpler to remember the rule.
type function
So, a workaround is possible: generate an object of type function whose 'op' 0 is `^`:
q := subs(p=`^`,p(x,1/2)); q := ^(x, 1/2)This object is "metastable", so that it is necesary to prevent its full evaluation:
q; 1/2 x eval(q,1); ^(x, 1/2)In this way:
subsop(0=H,eval(q,1)); H(x, 1/2)