Question: How to substitute only sqrt(2)/2 by 1/%sqrt(2) ?

Example: In the expression

expr:=1/sqrt(2)*(x+a);

I prefer the output

over

because it is shorter. To fix that I do

expr:=1/sqrt(2)*(x+a);
subs(sqrt(2) = 2/%sqrt(2), %)

The problem with that way is that all occurences of sqrt(2) are replaced, which I do not want. I only want to replace sqrt(2)/2.

I thought about selecting all products that contain 1/2 and sqrt(2) among others and apply the substitution only there.

How to do this in a (simple?) way?

Maybe there are other ways without subs.

Please Wait...