I have an expression with number of csgn(arg) in it.
I'd like to scan this expression, telling Maple to assume arg is positive, in order to replace csgn(arg) by 1.
I am trying to do this using subsindets. But I do not know why it is not working. I am doing this in code, without looking at the expression. So I do not know what the arg's are and how many such cases could be.
Here is an example
To get to each csgn(arg), I am using the type 'specfunc( anything, csgn )'. I checked this is correct type by doing
type(csgn(a),'specfunc( anything, csgn )');
subsindets(expr,'specfunc( anything, csgn )', f->simplify(f) assuming positive);
But this does not change anything.
I also tried
subsindets(expr,'specfunc( anything, csgn )',f->simplify(f) assuming op(1,f)::positive);
No change, But if I do
simplify(csgn(a)) assuming positive;
it works. And Maple returns 1. Also this works
simplify(expr) assuming a>0,b>0;
But since I am do not before hand what the arguments to csgn() in the expression are, I can't do the above. I do not know even if expression has csgn() in it even. I am trying to simplify a result I obtain inside the program by doing the above.
What is wrong with my use of subsindets above?
I think the problem is with using assumptions inside subsindents. As this below works
subsindets(expr,'specfunc( anything, csgn )',f->1);
So the call to subsidents was OK, it is just that the assumptions do not seem to be somehow effective inside. May be name scoping issue?
For now and as workaround, I am doing this
fun:=selectfun(expr,'csgn'); #find csgn if any
if numelems(fun)>0 then
simplify(expr) assuming map(x->x::positive,the_args);