From: DBird on
Trying the following procedure:

In[41]:= {T1, T2, C1, C2, R1, R2, w} \[Element] Reals

Out[41]= (T1|T2|C1|C2|R1|R2|w)\[Element]\[DoubleStruckCapitalR]

In[42]:= x = R1 + I 1/(w C1)

Out[42]= R1+I/(C1 w)

In[43]:= Im[x]

Out[43]= Re(1/(C1 w))+Im(R1)

Question is, how do I specify the list {T1,T2,...} such that Im[x]
yield just R1.

I usually find I am missing something dumb...

Thanks,

Dave

From: Sjoerd C. de Vries on
Hi Dave,

In Mathematica there are no typed variables, so you cannot in general
declare certain variables to be reals. Your attempt to do so with {T1,
T2, C1, C2, R1, R2, w} \[Element] Reals is not a declaration that
these variables are reals, but actually a *test* whether or not they
are real.

You can set up environments for functions like Simplify in which you
specify certain assumptions about variable domains, using Assuming.
You might look up Assumptions as well.

Your problem can be solved by using ComplexExpand. It will assume that
any named variable is real.

ComplexExpand[Im[R1 + I/(C1 w)]]

1/(C1 w)

Cheers -- Sjoerd

On Jun 22, 1:00 pm, DBird <db...(a)ieee.org> wrote:
> Trying the following procedure:
>
> In[41]:= {T1, T2, C1, C2, R1, R2, w} \[Element] Reals
>
> Out[41]= (T1|T2|C1|C2|R1|R2|w)\[Element]\[DoubleStruckCapitalR]
>
> In[42]:= x = R1 + I 1/(w C1)
>
> Out[42]= R1+I/(C1 w)
>
> In[43]:= Im[x]
>
> Out[43]= Re(1/(C1 w))+Im(R1)
>
> Question is, how do I specify the list {T1,T2,...} such that Im[x]
> yield just R1.
>
> I usually find I am missing something dumb...
>
> Thanks,
>
> Dave


From: David Park on
When working with complex expressions your best friend is the ComplexExpand
command. For some reason, this command doesn't immediately jump to the
notice of beginners and this leads to frequent questions on MathGroup.

R1 + I 1/(w C1)
ComplexExpand[Im[%]]

R1 + I/(C1 w)

1/(C1 w)

Mathematica generally assumes all variables are complex. ComplexExpand
assumes that all variables are real, except for ones you specifically
designate as complex. It is worth studying the Help page for ComplexExpand.
The TargetFunctions option is often useful.


David Park
djmpark(a)comcast.net
http://home.comcast.net/~djmpark/


From: DBird [mailto:dbird(a)ieee.org]


Trying the following procedure:

In[41]:= {T1, T2, C1, C2, R1, R2, w} \[Element] Reals

Out[41]= (T1|T2|C1|C2|R1|R2|w)\[Element]\[DoubleStruckCapitalR]

In[42]:= x = R1 + I 1/(w C1)

Out[42]= R1+I/(C1 w)

In[43]:= Im[x]

Out[43]= Re(1/(C1 w))+Im(R1)

Question is, how do I specify the list {T1,T2,...} such that Im[x]
yield just R1.

I usually find I am missing something dumb...

Thanks,

Dave



From: Jon on
Hi

You should try using the command $Assumptions. For example,

In[1]:= $Assumptions={T1, T2, C1, C2, R1, R2, w} \[Element] Reals

Then commands like Simplify[....], etc. will always assume that T1, T2, C1, C2, R1, R2, w, are real.

From: AES on
In article <hvs7n2$8v0$1(a)smc.vnet.net>,
"David Park" <djmpark(a)comcast.net> wrote:

> When working with complex expressions your best friend is the ComplexExpand
> command. For some reason, this command doesn't immediately jump to the
> notice of beginners and this leads to frequent questions on MathGroup.

It doesn't immediately jump to the notice of beginners because:

1) Unlike familiar commands or functions or operators such as Sin, Cos,
Exp, SquareRoot, or even Re[-] or Im[-] or complex conjugate, there is
no such command or operator in "ordinary mathematics."

No one _says_ "ComplexExpand" in ordinary mathematical discourse, and
the term would not have been encountered by the ordinary high school or
even college graduate.

2) It's bizarrely named. SeriesExpand _expands_ into a series.
ComplexExpand[Re[expr]] trims, or selects.

3) And, because of Mathematica's generally dysfunctional documentation
-- e.g. "ComplexExpand" is not even mentioned in tutorial/ComplexNumbers
and if it's mentioned in ref/Conjugate, it's buried somewhere down in
the nested and closed subsections and therefore cannot be _searched_ for
using any kind of Find command.


Would anyone suggest that the occurrence of "frequent questions on
MathGroup" might indicate a weakness, or even a product defect, in this
particular Mathematica design decision?

 |  Next  |  Last
Pages: 1 2 3
Prev: SFTP
Next: calculating mean prediction bands