I have a symbolic expressions as below
y1 = (1/a)-(b/a^2)+x*a*b-x/b
y2 = a*b+a*x+b*sqrt(x)
now I need to get the partial expressions which
listOfTerms = op(expression); # y1 or y2
numberOfSubExpressions=nops(expression); # for y1 or y2
requiredTerm = 0;
for i 1 to numberOfSubExpressions do
if has(listOfTerms [i], x) then # x is our required term
requiredTerm := requiredTerm +listOfTerms [i]
end if
end do
Above code does my requirement. But, if are there any bugs for special expressions please let me know. Because op function behaves differently when we have functions like(sin,cos Log ..etc)