If you state when you define the symbolic variable a that it is real, Symbolic Math Toolbox can take advantage of that information.
>> syms a real
>> real(4*a)
ans =
4*a
>> imag(4*a)
ans =
0
Note that even though you've said a is real, the result of operating on a may have a non-zero imaginary part under certain circumstances.
>> real(sqrt(a))
ans =
real(a^(1/2))
>> imag(sqrt(a))
ans =
imag(a^(1/2))
Consider substituting a = 4 into sqrt(a). The result of that calculation has zero as its imaginary part. But if you substitute a = -1, that has a non-zero imaginary part.
>> imag(subs(sqrt(a), a, 4))
ans =
0
>> imag(subs(sqrt(a), a, -1))
ans =
1
If you were to tell Symbolic Math Toolbox that not only is a real but it is also positive, the toolbox can take into account that information.
>> syms b positive
>> imag(sqrt(b))
ans =
0