       # Re: Re[a + I b] = a

```> how can I tell mathematica that the variable a and b is real, so that
> Re[a+ I  b] results to a?

ComplexExpand assumes that a and b are real unless you tell it
otherwise.

In:= ?ComplexExpand
ComplexExpand[expr] expands expr assuming that all variables are real.
ComplexExpand[expr, {x1, x2, ... }] expands expr assuming that
variables
matching any of the xi are complex.

In:= ComplexExpand[ Re[a + I b] ]

Out= a

> or: n a integer number and Sin[n x] results to 0?
>
> I am using mathematica 2.2

Algorithmically, this is a much harder (and largely unsolved) problem.
If your needs are not too elaborate, though, you may be able to program
it yourself, as in

In:= Unprotect[Sin] ;

In:= Sin[p_ Pi] := 0 /; IntegerQ[p]

In:= Protect[Sin] ;

In:= IntegerQ[n] ^= True ;

In:= Sin[n Pi]

Out= 0

Dave Withoff
Wolfram Research

```

• Prev by Date: Re: ValueList command
• Next by Date: define function of functions
• Prev by thread: Re: Re[a + I b] = a
• Next by thread: RE: Re[a + I b] = a