RE: RE: complex analysis problem in mathematica 3.0

• To: mathgroup at smc.vnet.net
• Subject: [mg48492] RE: [mg48476] RE: [mg48459] complex analysis problem in mathematica 3.0
• From: "David Park" <djmp at earthlink.net>
• Date: Wed, 2 Jun 2004 04:21:56 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```I suspected I would get some alternative methods to simplify, but I don't
think that they are all that obvious, and therefore not quicker. I still
think a MapLevelParts command would be useful. It complements MapAt and
gives much better direct control at manipulating expressions.

David Park

From: Andrzej Kozlowski [mailto:akoz at mimuw.edu.pl]
To: mathgroup at smc.vnet.net

A quicker way to get the same answer is:

step1 = 1/(s^3 + 2*s^2 + 2*s + 1) /. s -> I*w

Collect[ComplexExpand[step1] /. I -> i, i,
Simplify] /. i -> I

(1 - 2*w^2)/(w^6 + 1) + (I*w*(w^2 - 2))/(w^6 + 1)

P.S. Although it is true one can't use j, one can use the character
entered as  escape j j escape, which looks like a fancy j.

Andrzej Kozlowski
Chiba, Japan
http://www.mimuw.edu.pl/~akoz/

On 1 Jun 2004, at 16:02, David Park wrote:

> You can't use j. Use the Mathematica I.
>
> step1 = 1/(s^3 + 2*s^2 + 2*s + 1) /. s -> I*w
>
> Then you can separate into real and imaginary parts by using
> ComplexExpand.
>
> step2 = ComplexExpand[step1]
> 1/((1 - 2*w^2)^2 + (2*w - w^3)^2) -
>   (2*w^2)/((1 - 2*w^2)^2 + (2*w - w^3)^2) +
>   I*(-((2*w)/((1 - 2*w^2)^2 + (2*w - w^3)^2)) +
>     w^3/((1 - 2*w^2)^2 + (2*w - w^3)^2))
>
> But how do we further simplify that? We can't use Simplify or Together
> on
> the entire expression because that mixes the real and imaginary parts
> together again. We can get a partial simplification by mapping
> Simplify onto
> the parts.
>
> step3 = Simplify /@ step2
> 1/(1 + w^6) - (2*w^2)/(1 + w^6) + (I*w*(-2 + w^2))/
>    (1 + w^6)
>
> But the expression could be further simplified by using Together on the
> first two terms. Unfortunately Mathematica doesn't provide any direct
> method
> of doing that other than resorting to a rule that duplicates the parts
> on
> the lhs. I think that Mathematica needs an additional routine that
> would
> complement MapAt. I call it MapLevelParts and it maps a function to a
> subset
> of level parts in an expression. The common application would be to a
> subset
> of terms in a Plus expression or a subset of factors in a Times
> expression.
>
> MapLevelParts::usage =
>     "MapLevelParts[function, {topposition, levelpositions}][expr] will
> map \
> the function onto the selected level positions in an expression. \
> Levelpositions is a list of the selected parts. The function is
> applied to \
> them as a group and they are replaced with a single new expression.
> Other \
> parts not specified in levelpositions are left unchanged.\nExample:\na
> + b +
> \
> c + d + e // MapLevelParts[f, {{2,4,5}}] -> a + c + f[b + d + e]";
>
> MapLevelParts[func_,
>       part : {toppart___Integer?Positive,
>           subp : {_Integer?Positive,
> eprest__Integer?Positive}}][expr_] :=
>   Module[{work, subparts, npos, null, i, nnull = Length[{eprest}]},
>     work = func@Part[expr, Sequence @@ part];
>     newparts = {work, Table[null[i], {i, 1, nnull}]} // Flatten;
>     npos = Partition[Range[nnull + 1], 1];
>     ReplacePart[expr, newparts, subparts, npos] /. null[_] ->
> Sequence[]
>     ]
>
> Now we can use Together on just the first two terms of the sum.
>
> step3 // MapLevelParts[Together, {{1, 2}}]
> (1 - 2*w^2)/(1 + w^6) + (I*w*(-2 + w^2))/(1 + w^6)
>
> David Park
>

```

• Prev by Date: Re: checking accuracy with stepwise ode.
• Next by Date: Re: complex analysis problem in mathematica 3.0
• Previous by thread: Re: complex analysis problem in mathematica 3.0
• Next by thread: Re: complex analysis problem in mathematica 3.0