开发者

Maple: simplifying Im(a+I*b) - why it does not work for me?

So I want to simpli开发者_StackOverflow社区fy z:=a+I*b; Im(z) where a, b are real variables So I try:

s:= 1+2*I
Im(s) // outputs 2
z:=a+I*b
Im(z) // outputs  Im(a+I*b)

So I wonder is it any how possible to simplify Im(z) so to get b as output (here we look at general case meaning z could be any complex expression from real values (like a, b, c etc and complex I))?


You didn't tell Maple that a and b were real, so the simplification doesn't work because it doesn't necessarily hold. One way to get what you want is by using the assume command to let it know:

> s:=1+2*I;
                                 s := 1 + 2 I

> Im(s);
                                       2

> z:=a+I*b;
                                 z := a + b I

> Im(z);
                                  Im(a + b I)

> assume(a,real);
> assume(b,real);
> z;
                                   a~ + b~ I

> Im(z);
                                      b~


The evalc command works by considering unknowns as being real.

z:=a+I*b:

Im(z);
                             Im(a + I b)

evalc( Im(z) );
                                  b

See its help-page, ?evalc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜