Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: ComplexExpand confusion

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60202] Re: [mg60141] Re: [mg60109] ComplexExpand confusion
  • From: Chris Chiasson <chris.chiasson at gmail.com>
  • Date: Wed, 7 Sep 2005 04:04:00 -0400 (EDT)
  • References: <200509040702.DAA07328@smc.vnet.net>
  • Reply-to: chris.chiasson at gmail.com
  • Sender: owner-wri-mathgroup at wolfram.com

Wow, that is a ridiculous amount of output. Did anyone else look at
all the intermediate expressions it generates? I wonder why it is so
complicated.

In[5]:=
ComplexExpand[(-1)^(1/4)]//Trace//InputForm
Out[5]//InputForm=
{{{{HoldForm[4^(-1)], HoldForm[1/4]}, HoldForm[1/4], HoldForm[1/4]},
HoldForm[(-1)^(1/4)]}, HoldForm[ComplexExpand[(-1)^(1/4)]],
  {{HoldForm[System`ComplexExpandDump`mapheads], HoldForm[{List,
Equal, Unequal, Inequality, Greater, Less, GreaterEqual,
     LessEqual}]}, {HoldForm[Head[(-1)^(1/4)]], HoldForm[Power]}, 
  HoldForm[MemberQ[{List, Equal, Unequal, Inequality, Greater, Less,
GreaterEqual, LessEqual}, Power]], HoldForm[False]},
  HoldForm[ComplexExpand[(-1)^(1/4), {}]],
{{HoldForm[System`ComplexExpandDump`mapheads],
   HoldForm[{List, Equal, Unequal, Inequality, Greater, Less,
GreaterEqual, LessEqual}]},
  {HoldForm[Head[(-1)^(1/4)]], HoldForm[Power]}, 
  HoldForm[MemberQ[{List, Equal, Unequal, Inequality, Greater, Less,
GreaterEqual, LessEqual}, Power]], HoldForm[False]},
  HoldForm[Block[{System`ComplexExpandDump`AllowedFunctions,
System`ComplexExpandDump`badrulelist, System`ComplexExpandDump`x,
    System`ComplexExpandDump`y, System`ComplexExpandDump`funs,
System`ComplexExpandDump`hed, System`ComplexExpandDump`len,
    System`ComplexExpandDump`return,
System`ComplexExpandDump`AssumedComplex = {}},
   System`ComplexExpandDump`badrulelist = Select[{},  !MatchQ[#1,
TargetFunctions -> _] & ];
    Do[Message[ComplexExpand::optx,
System`ComplexExpandDump`badrulelist[[System`ComplexExpandDump`i]],
ComplexExpand],
     {System`ComplexExpandDump`i,
Length[System`ComplexExpandDump`badrulelist]}];
    If[Length[System`ComplexExpandDump`badrulelist] != 0,
Return[(-1)^(1/4)]]; System`ComplexExpandDump`funs =
     TargetFunctions /. {} /. Options[ComplexExpand];
If[Head[System`ComplexExpandDump`funs] =!= List,
     System`ComplexExpandDump`funs = {System`ComplexExpandDump`funs}];
System`ComplexExpandDump`AllowedFunctions =
     Select[System`ComplexExpandDump`funs,
MemberQ[System`ComplexExpandDump`AllowedSix, #1] & ];
    If[Length[System`ComplexExpandDump`AllowedFunctions] < 1,
Message[ComplexExpand::exf, System`ComplexExpandDump`funs,
       System`ComplexExpandDump`AllowedSix]; Return[(-1)^(1/4)]];
System`ComplexExpandDump`hed = Head[(-1)^(1/4)];
    System`ComplexExpandDump`len = Length[(-1)^(1/4)];
Which[System`ComplexExpandDump`len == 1 &&
      System`ComplexExpandDump`hed === Conjugate,
System`ComplexExpandDump`y = 0; System`ComplexExpandDump`x =
       System`ComplexExpandDump`ConjugateExpr[((-1)^(1/4))[[1]]];
System`ComplexExpandDump`return = System`ComplexExpandDump`x,
     System`ComplexExpandDump`len == 1 && System`ComplexExpandDump`hed
=== Sign, System`ComplexExpandDump`y = 0;
      System`ComplexExpandDump`x =
System`ComplexExpandDump`SignExpr[((-1)^(1/4))[[1]]];
      System`ComplexExpandDump`return = System`ComplexExpandDump`x, True, 
     {System`ComplexExpandDump`x, System`ComplexExpandDump`y} =
System`ComplexExpandDump`ReImExpr[(-1)^(1/4)];
      System`ComplexExpandDump`return =
Expand[System`ComplexExpandDump`x] +
I*Expand[System`ComplexExpandDump`y]; ];
    If[System`ComplexExpandDump`x ===
System`ComplexExpandDump`ReImFail || System`ComplexExpandDump`y ===
       System`ComplexExpandDump`ReImFail, (-1)^(1/4),
Block[{System`ComplexExpandDump`BadFunctions,
       System`ComplexExpandDump`Badpatterns, System`ComplexExpandDump`pos}, 
      System`ComplexExpandDump`BadFunctions =
Select[System`ComplexExpandDump`AllowedSix,
          !MemberQ[System`ComplexExpandDump`AllowedFunctions, #1] & ];
System`ComplexExpandDump`BadPatterns =
        Alternatives @@
Table[System`ComplexExpandDump`BadFunctions[[System`ComplexExpandDump`j]],
          {System`ComplexExpandDump`j,
Length[System`ComplexExpandDump`BadFunctions]}];
System`ComplexExpandDump`pos =
        Position[System`ComplexExpandDump`return,
System`ComplexExpandDump`BadPatterns[_]];
       System`ComplexExpandDump`AllowedFunctions =
System`ComplexExpandDump`AllowedSix; System`ComplexExpandDump`return =
        MapAt[ComplexExpand[#1, {}] & ,
System`ComplexExpandDump`return, System`ComplexExpandDump`pos];
       System`ComplexExpandDump`return]]]],
{HoldForm[System`ComplexExpandDump`AssumedComplex = {}],
HoldForm[{}]},
  {HoldForm[System`ComplexExpandDump`badrulelist = Select[{}, 
!MatchQ[#1, TargetFunctions -> _] & ];
    Do[Message[ComplexExpand::optx,
System`ComplexExpandDump`badrulelist[[System`ComplexExpandDump`i]],
ComplexExpand],
     {System`ComplexExpandDump`i,
Length[System`ComplexExpandDump`badrulelist]}];
    If[Length[System`ComplexExpandDump`badrulelist] != 0,
Return[(-1)^(1/4)]]; System`ComplexExpandDump`funs =
     TargetFunctions /. {} /. Options[ComplexExpand];
If[Head[System`ComplexExpandDump`funs] =!= List,
     System`ComplexExpandDump`funs = {System`ComplexExpandDump`funs}];
System`ComplexExpandDump`AllowedFunctions =
     Select[System`ComplexExpandDump`funs,
MemberQ[System`ComplexExpandDump`AllowedSix, #1] & ];
    If[Length[System`ComplexExpandDump`AllowedFunctions] < 1,
Message[ComplexExpand::exf, System`ComplexExpandDump`funs,
       System`ComplexExpandDump`AllowedSix]; Return[(-1)^(1/4)]];
System`ComplexExpandDump`hed = Head[(-1)^(1/4)];
    System`ComplexExpandDump`len = Length[(-1)^(1/4)];
Which[System`ComplexExpandDump`len == 1 &&
      System`ComplexExpandDump`hed === Conjugate,
System`ComplexExpandDump`y = 0; System`ComplexExpandDump`x =
       System`ComplexExpandDump`ConjugateExpr[((-1)^(1/4))[[1]]];
System`ComplexExpandDump`return = System`ComplexExpandDump`x,
     System`ComplexExpandDump`len == 1 && System`ComplexExpandDump`hed
=== Sign, System`ComplexExpandDump`y = 0;
      System`ComplexExpandDump`x =
System`ComplexExpandDump`SignExpr[((-1)^(1/4))[[1]]];
      System`ComplexExpandDump`return = System`ComplexExpandDump`x, True, 
     {System`ComplexExpandDump`x, System`ComplexExpandDump`y} =
System`ComplexExpandDump`ReImExpr[(-1)^(1/4)];
      System`ComplexExpandDump`return =
Expand[System`ComplexExpandDump`x] +
I*Expand[System`ComplexExpandDump`y]; ];
    If[System`ComplexExpandDump`x ===
System`ComplexExpandDump`ReImFail || System`ComplexExpandDump`y ===
       System`ComplexExpandDump`ReImFail, (-1)^(1/4),
Block[{System`ComplexExpandDump`BadFunctions,
       System`ComplexExpandDump`Badpatterns, System`ComplexExpandDump`pos}, 
      System`ComplexExpandDump`BadFunctions =
Select[System`ComplexExpandDump`AllowedSix,
          !MemberQ[System`ComplexExpandDump`AllowedFunctions, #1] & ];
System`ComplexExpandDump`BadPatterns =
        Alternatives @@
Table[System`ComplexExpandDump`BadFunctions[[System`ComplexExpandDump`j]],
          {System`ComplexExpandDump`j,
Length[System`ComplexExpandDump`BadFunctions]}];
System`ComplexExpandDump`pos =
        Position[System`ComplexExpandDump`return,
System`ComplexExpandDump`BadPatterns[_]];
       System`ComplexExpandDump`AllowedFunctions =
System`ComplexExpandDump`AllowedSix; System`ComplexExpandDump`return =
        MapAt[ComplexExpand[#1, {}] & ,
System`ComplexExpandDump`return, System`ComplexExpandDump`pos];
       System`ComplexExpandDump`return]]], {{HoldForm[Select[{}, 
!MatchQ[#1, TargetFunctions -> _] & ]], HoldForm[{}]},
   HoldForm[System`ComplexExpandDump`badrulelist = {}], HoldForm[{}]}, 
  {HoldForm[Do[Message[ComplexExpand::optx,
System`ComplexExpandDump`badrulelist[[System`ComplexExpandDump`i]],
ComplexExpand],
     {System`ComplexExpandDump`i,
Length[System`ComplexExpandDump`badrulelist]}]],
   {{HoldForm[System`ComplexExpandDump`badrulelist], HoldForm[{}]},
HoldForm[Length[{}]], HoldForm[0]}, HoldForm[Null]},
  {{{{HoldForm[System`ComplexExpandDump`badrulelist], HoldForm[{}]},
HoldForm[Length[{}]], HoldForm[0]}, HoldForm[0 != 0],
    HoldForm[False]}, HoldForm[If[False, Return[(-1)^(1/4)]]], HoldForm[Null]}, 
  {{{HoldForm[TargetFunctions /. {}], HoldForm[TargetFunctions]},
{HoldForm[Options[ComplexExpand]],
     HoldForm[{TargetFunctions -> {Re, Im, Abs, Arg, Conjugate, Sign}}]}, 
    HoldForm[TargetFunctions /. {TargetFunctions -> {Re, Im, Abs, Arg,
Conjugate, Sign}}],
    HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
HoldForm[System`ComplexExpandDump`funs =
     {Re, Im, Abs, Arg, Conjugate, Sign}], HoldForm[{Re, Im, Abs, Arg,
Conjugate, Sign}]},
  {{{{HoldForm[System`ComplexExpandDump`funs], HoldForm[{Re, Im, Abs,
Arg, Conjugate, Sign}]},
     HoldForm[Head[{Re, Im, Abs, Arg, Conjugate, Sign}]],
HoldForm[List]}, HoldForm[List =!= List], HoldForm[False]},
   HoldForm[If[False, System`ComplexExpandDump`funs =
{System`ComplexExpandDump`funs}]], HoldForm[Null]},
  {{{HoldForm[System`ComplexExpandDump`funs], HoldForm[{Re, Im, Abs,
Arg, Conjugate, Sign}]},
    HoldForm[Select[{Re, Im, Abs, Arg, Conjugate, Sign},
MemberQ[System`ComplexExpandDump`AllowedSix, #1] & ]],
    {HoldForm[(MemberQ[System`ComplexExpandDump`AllowedSix, #1] & )[Re]], 
     HoldForm[MemberQ[System`ComplexExpandDump`AllowedSix, Re]],
{HoldForm[System`ComplexExpandDump`AllowedSix],
      HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign}, Re]],
     HoldForm[True]},
{HoldForm[(MemberQ[System`ComplexExpandDump`AllowedSix, #1] & )[Im]],
     HoldForm[MemberQ[System`ComplexExpandDump`AllowedSix, Im]],
{HoldForm[System`ComplexExpandDump`AllowedSix],
      HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign}, Im]],
     HoldForm[True]},
{HoldForm[(MemberQ[System`ComplexExpandDump`AllowedSix, #1] & )[Abs]],
     HoldForm[MemberQ[System`ComplexExpandDump`AllowedSix, Abs]],
{HoldForm[System`ComplexExpandDump`AllowedSix],
      HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign}, Abs]],
     HoldForm[True]},
{HoldForm[(MemberQ[System`ComplexExpandDump`AllowedSix, #1] & )[Arg]],
     HoldForm[MemberQ[System`ComplexExpandDump`AllowedSix, Arg]],
{HoldForm[System`ComplexExpandDump`AllowedSix],
      HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign}, Arg]],
     HoldForm[True]},
{HoldForm[(MemberQ[System`ComplexExpandDump`AllowedSix, #1] &
)[Conjugate]],
     HoldForm[MemberQ[System`ComplexExpandDump`AllowedSix,
Conjugate]], {HoldForm[System`ComplexExpandDump`AllowedSix],
      HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign}, Conjugate]],
     HoldForm[True]},
{HoldForm[(MemberQ[System`ComplexExpandDump`AllowedSix, #1] &
)[Sign]],
     HoldForm[MemberQ[System`ComplexExpandDump`AllowedSix, Sign]],
{HoldForm[System`ComplexExpandDump`AllowedSix],
      HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign}, Sign]],
     HoldForm[True]}, HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]}, 
   HoldForm[System`ComplexExpandDump`AllowedFunctions = {Re, Im, Abs,
Arg, Conjugate, Sign}],
   HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]}, 
  {{{{HoldForm[System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
     HoldForm[Length[{Re, Im, Abs, Arg, Conjugate, Sign}]],
HoldForm[6]}, HoldForm[6 < 1], HoldForm[False]},
   HoldForm[If[False, Message[ComplexExpand::exf,
System`ComplexExpandDump`funs, System`ComplexExpandDump`AllowedSix];
      Return[(-1)^(1/4)]]], HoldForm[Null]},
{{HoldForm[Head[(-1)^(1/4)]], HoldForm[Power]},
   HoldForm[System`ComplexExpandDump`hed = Power], HoldForm[Power]},
{{HoldForm[Length[(-1)^(1/4)]], HoldForm[2]},
   HoldForm[System`ComplexExpandDump`len = 2], HoldForm[2]}, 
  {HoldForm[Which[System`ComplexExpandDump`len == 1 &&
System`ComplexExpandDump`hed === Conjugate,
     System`ComplexExpandDump`y = 0; System`ComplexExpandDump`x =
System`ComplexExpandDump`ConjugateExpr[((-1)^(1/4))[[1]]];
      System`ComplexExpandDump`return = System`ComplexExpandDump`x,
System`ComplexExpandDump`len == 1 &&
      System`ComplexExpandDump`hed === Sign,
System`ComplexExpandDump`y = 0; System`ComplexExpandDump`x =
       System`ComplexExpandDump`SignExpr[((-1)^(1/4))[[1]]];
System`ComplexExpandDump`return = System`ComplexExpandDump`x, True,
     {System`ComplexExpandDump`x, System`ComplexExpandDump`y} =
System`ComplexExpandDump`ReImExpr[(-1)^(1/4)];
      System`ComplexExpandDump`return =
Expand[System`ComplexExpandDump`x] +
I*Expand[System`ComplexExpandDump`y]; ]],
   {HoldForm[System`ComplexExpandDump`len == 1 &&
System`ComplexExpandDump`hed === Conjugate],
    {{HoldForm[System`ComplexExpandDump`len], HoldForm[2]}, HoldForm[2
== 1], HoldForm[False]}, HoldForm[False]},
   {HoldForm[System`ComplexExpandDump`len == 1 &&
System`ComplexExpandDump`hed === Sign],
    {{HoldForm[System`ComplexExpandDump`len], HoldForm[2]}, HoldForm[2
== 1], HoldForm[False]}, HoldForm[False]},
   HoldForm[{System`ComplexExpandDump`x, System`ComplexExpandDump`y} =
System`ComplexExpandDump`ReImExpr[(-1)^(1/4)];
     System`ComplexExpandDump`return =
Expand[System`ComplexExpandDump`x] +
I*Expand[System`ComplexExpandDump`y]; ],
   {{HoldForm[System`ComplexExpandDump`ReImExpr[(-1)^(1/4)]],
HoldForm[System`ComplexExpandDump`ReImRecursive[(-1)^(1/4)]],
     {HoldForm[System`ComplexExpandDump`NonNegValQ[-1]],
{{HoldForm[Positive[-1]], HoldForm[False]}, HoldForm[TrueQ[False]],
       HoldForm[False]}, {HoldForm[NumericQ[-1]], HoldForm[True]},
HoldForm[TrueQ[NonNegative[-1]]],
      {HoldForm[NonNegative[-1]], HoldForm[False]},
HoldForm[TrueQ[False]], HoldForm[False]},
     HoldForm[Block[{System`ComplexExpandDump`abs,
System`ComplexExpandDump`abs2, System`ComplexExpandDump`re,
        System`ComplexExpandDump`im, System`ComplexExpandDump`newg}, 
       {System`ComplexExpandDump`re, System`ComplexExpandDump`im} =
System`ComplexExpandDump`ReImExpr[-1];
        System`ComplexExpandDump`newg = System`ComplexExpandDump`re +
I*System`ComplexExpandDump`im;
        System`ComplexExpandDump`abs =
System`ComplexExpandDump`AbsExpr[System`ComplexExpandDump`newg];
        If[System`ComplexExpandDump`newg =!= -1,
System`ComplexExpandDump`abs2 = System`ComplexExpandDump`AbsExpr[-1];
          If[LeafCount[System`ComplexExpandDump`abs2] <
LeafCount[System`ComplexExpandDump`abs],
           System`ComplexExpandDump`abs = System`ComplexExpandDump`abs2]; ]; 
        If[System`ComplexExpandDump`IsZeroQ[System`ComplexExpandDump`abs]
&& System`ComplexExpandDump`PosValQ[1/4], {0, 0},
         Block[{System`ComplexExpandDump`arg,
System`ComplexExpandDump`arg2, System`ComplexExpandDump`x,
           System`ComplexExpandDump`y, System`ComplexExpandDump`theta,
System`ComplexExpandDump`power,
           System`ComplexExpandDump`re, System`ComplexExpandDump`im},
System`ComplexExpandDump`arg =
            System`ComplexExpandDump`ArgExpr[System`ComplexExpandDump`newg];
If[System`ComplexExpandDump`newg =!= -1,
            System`ComplexExpandDump`arg2 =
System`ComplexExpandDump`ArgExpr[-1];
If[LeafCount[System`ComplexExpandDump`arg2] <
               LeafCount[System`ComplexExpandDump`arg],
System`ComplexExpandDump`arg = System`ComplexExpandDump`arg2]; ];
           {System`ComplexExpandDump`x, System`ComplexExpandDump`y} =
System`ComplexExpandDump`ReImExpr[1/4];
           System`ComplexExpandDump`theta =
System`ComplexExpandDump`y*System`ComplexExpandDump`RealLog[
               System`ComplexExpandDump`abs] +
System`ComplexExpandDump`x*System`ComplexExpandDump`arg;
           System`ComplexExpandDump`power =
System`ComplexExpandDump`abs^System`ComplexExpandDump`x/
             E^(System`ComplexExpandDump`y*System`ComplexExpandDump`arg);
If[System`ComplexExpandDump`SpecialQ[
             System`ComplexExpandDump`theta],
System`ComplexExpandDump`re = System`ComplexExpandDump`ReImRecursive[
                Cos[System`ComplexExpandDump`theta]][[1]];
System`ComplexExpandDump`im = System`ComplexExpandDump`ReImRecursive[
                Sin[System`ComplexExpandDump`theta]][[1]],
System`ComplexExpandDump`re = Cos[System`ComplexExpandDump`theta];
             System`ComplexExpandDump`im =
Sin[System`ComplexExpandDump`theta]]; {System`ComplexExpandDump`power*
             System`ComplexExpandDump`re,
System`ComplexExpandDump`power*System`ComplexExpandDump`im}]]]],
     {HoldForm[{System`ComplexExpandDump`re,
System`ComplexExpandDump`im} = System`ComplexExpandDump`ReImExpr[-1];
        System`ComplexExpandDump`newg = System`ComplexExpandDump`re +
I*System`ComplexExpandDump`im;
        System`ComplexExpandDump`abs =
System`ComplexExpandDump`AbsExpr[System`ComplexExpandDump`newg];
        If[System`ComplexExpandDump`newg =!= -1,
System`ComplexExpandDump`abs2 = System`ComplexExpandDump`AbsExpr[-1];
          If[LeafCount[System`ComplexExpandDump`abs2] <
LeafCount[System`ComplexExpandDump`abs],
           System`ComplexExpandDump`abs = System`ComplexExpandDump`abs2]; ]; 
        If[System`ComplexExpandDump`IsZeroQ[System`ComplexExpandDump`abs]
&& System`ComplexExpandDump`PosValQ[1/4], {0, 0},
         Block[{System`ComplexExpandDump`arg,
System`ComplexExpandDump`arg2, System`ComplexExpandDump`x,
           System`ComplexExpandDump`y, System`ComplexExpandDump`theta,
System`ComplexExpandDump`power,
           System`ComplexExpandDump`re, System`ComplexExpandDump`im},
System`ComplexExpandDump`arg =
            System`ComplexExpandDump`ArgExpr[System`ComplexExpandDump`newg];
If[System`ComplexExpandDump`newg =!= -1,
            System`ComplexExpandDump`arg2 =
System`ComplexExpandDump`ArgExpr[-1];
If[LeafCount[System`ComplexExpandDump`arg2] <
               LeafCount[System`ComplexExpandDump`arg],
System`ComplexExpandDump`arg = System`ComplexExpandDump`arg2]; ];
           {System`ComplexExpandDump`x, System`ComplexExpandDump`y} =
System`ComplexExpandDump`ReImExpr[1/4];
           System`ComplexExpandDump`theta =
System`ComplexExpandDump`y*System`ComplexExpandDump`RealLog[
               System`ComplexExpandDump`abs] +
System`ComplexExpandDump`x*System`ComplexExpandDump`arg;
           System`ComplexExpandDump`power =
System`ComplexExpandDump`abs^System`ComplexExpandDump`x/
             E^(System`ComplexExpandDump`y*System`ComplexExpandDump`arg);
If[System`ComplexExpandDump`SpecialQ[
             System`ComplexExpandDump`theta],
System`ComplexExpandDump`re = System`ComplexExpandDump`ReImRecursive[
                Cos[System`ComplexExpandDump`theta]][[1]];
System`ComplexExpandDump`im = System`ComplexExpandDump`ReImRecursive[
                Sin[System`ComplexExpandDump`theta]][[1]],
System`ComplexExpandDump`re = Cos[System`ComplexExpandDump`theta];
             System`ComplexExpandDump`im =
Sin[System`ComplexExpandDump`theta]]; {System`ComplexExpandDump`power*
             System`ComplexExpandDump`re,
System`ComplexExpandDump`power*System`ComplexExpandDump`im}]]],
      {{HoldForm[System`ComplexExpandDump`ReImExpr[-1]],
HoldForm[System`ComplexExpandDump`ReImRecursive[-1]],
        {HoldForm[NumericQ[-1]], HoldForm[True]},
{{HoldForm[System`ComplexExpandDump`CartQ[-1]],
          HoldForm[System`ComplexExpandDump`IsOK[{Re, Im}, -1]],
HoldForm[And @@ (System`ComplexExpandDump`IsOK[#1, -1] & ) /@
             {Re, Im}], {HoldForm[(System`ComplexExpandDump`IsOK[#1,
-1] & ) /@ {Re, Im}],
           HoldForm[{(System`ComplexExpandDump`IsOK[#1, -1] & )[Re],
(System`ComplexExpandDump`IsOK[#1, -1] & )[Im]}],
           {HoldForm[(System`ComplexExpandDump`IsOK[#1, -1] & )[Re]],
HoldForm[System`ComplexExpandDump`IsOK[Re, -1]],
            HoldForm[MemberQ[System`ComplexExpandDump`AllowedFunctions, Re]], 
            {HoldForm[System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
            HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign},
Re]], HoldForm[True]},
           {HoldForm[(System`ComplexExpandDump`IsOK[#1, -1] & )[Im]],
HoldForm[System`ComplexExpandDump`IsOK[Im, -1]],
            HoldForm[MemberQ[System`ComplexExpandDump`AllowedFunctions, Im]], 
            {HoldForm[System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
            HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign},
Im]], HoldForm[True]}, HoldForm[{True, True}]},
          HoldForm[And @@ {True, True}], HoldForm[True && True],
HoldForm[True]},
         HoldForm[RuleCondition[$ConditionHold[$ConditionHold[{Re[-1],
Im[-1]}]], True]],
         HoldForm[$ConditionHold[$ConditionHold[{Re[-1], Im[-1]}]]]},
HoldForm[{Re[-1], Im[-1]}],
        {HoldForm[Re[-1]], HoldForm[-1]}, {HoldForm[Im[-1]],
HoldForm[0]}, HoldForm[{-1, 0}]},
       HoldForm[{System`ComplexExpandDump`re,
System`ComplexExpandDump`im} = {-1, 0}], HoldForm[{-1, 0}]},
      {{{HoldForm[System`ComplexExpandDump`re], HoldForm[-1]},
{{HoldForm[I], HoldForm[I]},
         {HoldForm[System`ComplexExpandDump`im], HoldForm[0]},
HoldForm[I*0], HoldForm[0]}, HoldForm[-1 + 0], HoldForm[-1]},
       HoldForm[System`ComplexExpandDump`newg = -1], HoldForm[-1]},
{{{HoldForm[System`ComplexExpandDump`newg], HoldForm[-1]},
        HoldForm[System`ComplexExpandDump`AbsExpr[-1]],
HoldForm[System`ComplexExpandDump`AbsRecursive[-1]],
        HoldForm[System`ComplexExpandDump`LeafAbs[-1]],
{HoldForm[System`ComplexExpandDump`NonNegValQ[-1]],
         {{HoldForm[Positive[-1]], HoldForm[False]},
HoldForm[TrueQ[False]], HoldForm[False]},
         {HoldForm[NumericQ[-1]], HoldForm[True]},
HoldForm[TrueQ[NonNegative[-1]]], {HoldForm[NonNegative[-1]],
          HoldForm[False]}, HoldForm[TrueQ[False]], HoldForm[False]},
{HoldForm[System`ComplexExpandDump`NonPosValQ[-1]],
         {{HoldForm[Negative[-1]], HoldForm[True]},
HoldForm[TrueQ[True]], HoldForm[True]}, HoldForm[True]},
        HoldForm[With[{System`ComplexExpandDump`x =
First[System`ComplexExpandDump`ReImExpr[-1]]},
          -System`ComplexExpandDump`x]],
{{HoldForm[System`ComplexExpandDump`ReImExpr[-1]],
          HoldForm[System`ComplexExpandDump`ReImRecursive[-1]],
{HoldForm[NumericQ[-1]], HoldForm[True]},
          {{HoldForm[System`ComplexExpandDump`CartQ[-1]],
HoldForm[System`ComplexExpandDump`IsOK[{Re, Im}, -1]],
            HoldForm[And @@ (System`ComplexExpandDump`IsOK[#1, -1] & )
/@ {Re, Im}],
            {HoldForm[(System`ComplexExpandDump`IsOK[#1, -1] & ) /@ {Re, Im}], 
             HoldForm[{(System`ComplexExpandDump`IsOK[#1, -1] & )[Re],
(System`ComplexExpandDump`IsOK[#1, -1] & )[Im]}],
             {HoldForm[(System`ComplexExpandDump`IsOK[#1, -1] &
)[Re]], HoldForm[System`ComplexExpandDump`IsOK[Re, -1]],
              HoldForm[MemberQ[System`ComplexExpandDump`AllowedFunctions,
Re]], {HoldForm[
                System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
              HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign},
Re]], HoldForm[True]},
             {HoldForm[(System`ComplexExpandDump`IsOK[#1, -1] &
)[Im]], HoldForm[System`ComplexExpandDump`IsOK[Im, -1]],
              HoldForm[MemberQ[System`ComplexExpandDump`AllowedFunctions,
Im]], {HoldForm[
                System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
              HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign},
Im]], HoldForm[True]}, HoldForm[{True, True}]},
            HoldForm[And @@ {True, True}], HoldForm[True && True],
HoldForm[True]},
           HoldForm[RuleCondition[$ConditionHold[$ConditionHold[{Re[-1],
Im[-1]}]], True]],
           HoldForm[$ConditionHold[$ConditionHold[{Re[-1],
Im[-1]}]]]}, HoldForm[{Re[-1], Im[-1]}],
          {HoldForm[Re[-1]], HoldForm[-1]}, {HoldForm[Im[-1]],
HoldForm[0]}, HoldForm[{-1, 0}]}, HoldForm[First[{-1, 0}]],
         HoldForm[-1]}, HoldForm[-(-1)], HoldForm[1]},
HoldForm[System`ComplexExpandDump`abs = 1], HoldForm[1]},
      {{{HoldForm[System`ComplexExpandDump`newg], HoldForm[-1]},
HoldForm[-1 =!= -1], HoldForm[False]},
       HoldForm[If[False, System`ComplexExpandDump`abs2 =
System`ComplexExpandDump`AbsExpr[-1];
          If[LeafCount[System`ComplexExpandDump`abs2] <
LeafCount[System`ComplexExpandDump`abs],
           System`ComplexExpandDump`abs =
System`ComplexExpandDump`abs2]; ]], HoldForm[Null]},
      {{HoldForm[System`ComplexExpandDump`IsZeroQ[System`ComplexExpandDump`abs]
&& System`ComplexExpandDump`PosValQ[1/4]],
        {{HoldForm[System`ComplexExpandDump`abs], HoldForm[1]},
HoldForm[System`ComplexExpandDump`IsZeroQ[1]],
         {HoldForm[System`ComplexExpandDump`NonNegValQ[1] &&
System`ComplexExpandDump`NonPosValQ[1]],
          {HoldForm[System`ComplexExpandDump`NonNegValQ[1]],
{{HoldForm[Positive[1]], HoldForm[True]}, HoldForm[TrueQ[True]],
            HoldForm[True]}, HoldForm[True]},
{HoldForm[System`ComplexExpandDump`NonPosValQ[1]],
           {{HoldForm[Negative[1]], HoldForm[False]},
HoldForm[TrueQ[False]], HoldForm[False]},
           {HoldForm[NumericQ[1]], HoldForm[True]},
HoldForm[TrueQ[NonPositive[1]]], {HoldForm[NonPositive[1]],
            HoldForm[False]}, HoldForm[TrueQ[False]],
HoldForm[False]}, HoldForm[False]}, HoldForm[False]},
HoldForm[False]},
       HoldForm[If[False, {0, 0}, Block[{System`ComplexExpandDump`arg,
System`ComplexExpandDump`arg2,
           System`ComplexExpandDump`x, System`ComplexExpandDump`y,
System`ComplexExpandDump`theta,
           System`ComplexExpandDump`power,
System`ComplexExpandDump`re, System`ComplexExpandDump`im},
          System`ComplexExpandDump`arg =
System`ComplexExpandDump`ArgExpr[System`ComplexExpandDump`newg];
           If[System`ComplexExpandDump`newg =!= -1,
System`ComplexExpandDump`arg2 = System`ComplexExpandDump`ArgExpr[-1];
             If[LeafCount[System`ComplexExpandDump`arg2] <
LeafCount[System`ComplexExpandDump`arg],
              System`ComplexExpandDump`arg = System`ComplexExpandDump`arg2]; ]; 
           {System`ComplexExpandDump`x, System`ComplexExpandDump`y} =
System`ComplexExpandDump`ReImExpr[1/4];
           System`ComplexExpandDump`theta =
System`ComplexExpandDump`y*System`ComplexExpandDump`RealLog[
               System`ComplexExpandDump`abs] +
System`ComplexExpandDump`x*System`ComplexExpandDump`arg;
           System`ComplexExpandDump`power =
System`ComplexExpandDump`abs^System`ComplexExpandDump`x/
             E^(System`ComplexExpandDump`y*System`ComplexExpandDump`arg);
If[System`ComplexExpandDump`SpecialQ[
             System`ComplexExpandDump`theta],
System`ComplexExpandDump`re = System`ComplexExpandDump`ReImRecursive[
                Cos[System`ComplexExpandDump`theta]][[1]];
System`ComplexExpandDump`im = System`ComplexExpandDump`ReImRecursive[
                Sin[System`ComplexExpandDump`theta]][[1]],
System`ComplexExpandDump`re = Cos[System`ComplexExpandDump`theta];
             System`ComplexExpandDump`im =
Sin[System`ComplexExpandDump`theta]]; {System`ComplexExpandDump`power*
             System`ComplexExpandDump`re,
System`ComplexExpandDump`power*System`ComplexExpandDump`im}]]],
       HoldForm[Block[{System`ComplexExpandDump`arg,
System`ComplexExpandDump`arg2, System`ComplexExpandDump`x,
          System`ComplexExpandDump`y, System`ComplexExpandDump`theta,
System`ComplexExpandDump`power,
          System`ComplexExpandDump`re, System`ComplexExpandDump`im},
System`ComplexExpandDump`arg =
           System`ComplexExpandDump`ArgExpr[System`ComplexExpandDump`newg];
If[System`ComplexExpandDump`newg =!= -1,
           System`ComplexExpandDump`arg2 =
System`ComplexExpandDump`ArgExpr[-1];
If[LeafCount[System`ComplexExpandDump`arg2] <
              LeafCount[System`ComplexExpandDump`arg],
System`ComplexExpandDump`arg = System`ComplexExpandDump`arg2]; ];
          {System`ComplexExpandDump`x, System`ComplexExpandDump`y} =
System`ComplexExpandDump`ReImExpr[1/4];
          System`ComplexExpandDump`theta =
System`ComplexExpandDump`y*System`ComplexExpandDump`RealLog[
              System`ComplexExpandDump`abs] +
System`ComplexExpandDump`x*System`ComplexExpandDump`arg;
          System`ComplexExpandDump`power =
System`ComplexExpandDump`abs^System`ComplexExpandDump`x/
            E^(System`ComplexExpandDump`y*System`ComplexExpandDump`arg);
If[System`ComplexExpandDump`SpecialQ[
            System`ComplexExpandDump`theta],
System`ComplexExpandDump`re =
System`ComplexExpandDump`ReImRecursive[Cos[
                System`ComplexExpandDump`theta]][[1]];
System`ComplexExpandDump`im =
System`ComplexExpandDump`ReImRecursive[Sin[
                System`ComplexExpandDump`theta]][[1]],
System`ComplexExpandDump`re = Cos[System`ComplexExpandDump`theta];
            System`ComplexExpandDump`im = Sin[System`ComplexExpandDump`theta]]; 
          {System`ComplexExpandDump`power*System`ComplexExpandDump`re,
System`ComplexExpandDump`power*
            System`ComplexExpandDump`im}]],
{HoldForm[System`ComplexExpandDump`arg =
System`ComplexExpandDump`ArgExpr[
            System`ComplexExpandDump`newg];
If[System`ComplexExpandDump`newg =!= -1,
           System`ComplexExpandDump`arg2 =
System`ComplexExpandDump`ArgExpr[-1];
If[LeafCount[System`ComplexExpandDump`arg2] <
              LeafCount[System`ComplexExpandDump`arg],
System`ComplexExpandDump`arg = System`ComplexExpandDump`arg2]; ];
          {System`ComplexExpandDump`x, System`ComplexExpandDump`y} =
System`ComplexExpandDump`ReImExpr[1/4];
          System`ComplexExpandDump`theta =
System`ComplexExpandDump`y*System`ComplexExpandDump`RealLog[
              System`ComplexExpandDump`abs] +
System`ComplexExpandDump`x*System`ComplexExpandDump`arg;
          System`ComplexExpandDump`power =
System`ComplexExpandDump`abs^System`ComplexExpandDump`x/
            E^(System`ComplexExpandDump`y*System`ComplexExpandDump`arg);
If[System`ComplexExpandDump`SpecialQ[
            System`ComplexExpandDump`theta],
System`ComplexExpandDump`re =
System`ComplexExpandDump`ReImRecursive[Cos[
                System`ComplexExpandDump`theta]][[1]];
System`ComplexExpandDump`im =
System`ComplexExpandDump`ReImRecursive[Sin[
                System`ComplexExpandDump`theta]][[1]],
System`ComplexExpandDump`re = Cos[System`ComplexExpandDump`theta];
            System`ComplexExpandDump`im = Sin[System`ComplexExpandDump`theta]]; 
          {System`ComplexExpandDump`power*System`ComplexExpandDump`re,
System`ComplexExpandDump`power*
            System`ComplexExpandDump`im}],
{{{HoldForm[System`ComplexExpandDump`newg], HoldForm[-1]},
          HoldForm[System`ComplexExpandDump`ArgExpr[-1]],
{HoldForm[System`ComplexExpandDump`NonNegValQ[-1]],
           {{HoldForm[Positive[-1]], HoldForm[False]},
HoldForm[TrueQ[False]], HoldForm[False]},
           {HoldForm[NumericQ[-1]], HoldForm[True]},
HoldForm[TrueQ[NonNegative[-1]]], {HoldForm[NonNegative[-1]],
            HoldForm[False]}, HoldForm[TrueQ[False]],
HoldForm[False]}, {HoldForm[System`ComplexExpandDump`NegValQ[-1]],
           {HoldForm[NumericQ[-1]], HoldForm[True]},
HoldForm[TrueQ[Negative[-1]]], {HoldForm[Negative[-1]],
HoldForm[True]},
           HoldForm[TrueQ[True]], HoldForm[True]}, HoldForm[Pi]},
HoldForm[System`ComplexExpandDump`arg = Pi], HoldForm[Pi]},
        {{{HoldForm[System`ComplexExpandDump`newg], HoldForm[-1]},
HoldForm[-1 =!= -1], HoldForm[False]},
         HoldForm[If[False, System`ComplexExpandDump`arg2 =
System`ComplexExpandDump`ArgExpr[-1];
            If[LeafCount[System`ComplexExpandDump`arg2] <
LeafCount[System`ComplexExpandDump`arg],
             System`ComplexExpandDump`arg =
System`ComplexExpandDump`arg2]; ]], HoldForm[Null]},
        {{HoldForm[System`ComplexExpandDump`ReImExpr[1/4]],
HoldForm[System`ComplexExpandDump`ReImRecursive[1/4]],
          {HoldForm[NumericQ[1/4]], HoldForm[True]},
{{HoldForm[System`ComplexExpandDump`CartQ[1/4]],
            HoldForm[System`ComplexExpandDump`IsOK[{Re, Im}, 1/4]],
HoldForm[And @@ (System`ComplexExpandDump`IsOK[#1,
                 1/4] & ) /@ {Re, Im}],
{HoldForm[(System`ComplexExpandDump`IsOK[#1, 1/4] & ) /@ {Re, Im}],
             HoldForm[{(System`ComplexExpandDump`IsOK[#1, 1/4] &
)[Re], (System`ComplexExpandDump`IsOK[#1, 1/4] & )[Im]}],
             {HoldForm[(System`ComplexExpandDump`IsOK[#1, 1/4] &
)[Re]], HoldForm[System`ComplexExpandDump`IsOK[Re, 1/4]],
              HoldForm[MemberQ[System`ComplexExpandDump`AllowedFunctions,
Re]], {HoldForm[
                System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
              HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign},
Re]], HoldForm[True]},
             {HoldForm[(System`ComplexExpandDump`IsOK[#1, 1/4] &
)[Im]], HoldForm[System`ComplexExpandDump`IsOK[Im, 1/4]],
              HoldForm[MemberQ[System`ComplexExpandDump`AllowedFunctions,
Im]], {HoldForm[
                System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
              HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign},
Im]], HoldForm[True]}, HoldForm[{True, True}]},
            HoldForm[And @@ {True, True}], HoldForm[True && True],
HoldForm[True]},
           HoldForm[RuleCondition[$ConditionHold[$ConditionHold[{Re[1/4],
Im[1/4]}]], True]],
           HoldForm[$ConditionHold[$ConditionHold[{Re[1/4],
Im[1/4]}]]]}, HoldForm[{Re[1/4], Im[1/4]}],
          {HoldForm[Re[1/4]], HoldForm[1/4]}, {HoldForm[Im[1/4]],
HoldForm[0]}, HoldForm[{1/4, 0}]},
         HoldForm[{System`ComplexExpandDump`x,
System`ComplexExpandDump`y} = {1/4, 0}], HoldForm[{1/4, 0}]},
        {{{{HoldForm[System`ComplexExpandDump`y], HoldForm[0]},
{{HoldForm[System`ComplexExpandDump`abs], HoldForm[1]},
            HoldForm[System`ComplexExpandDump`RealLog[1]],
HoldForm[If[Head[1] === Power && 1[[1]] === E, 1[[2]], Log[1]]],
            {HoldForm[Head[1] === Power && 1[[1]] === E],
{{HoldForm[Head[1]], HoldForm[Integer]}, HoldForm[Integer === Power],
              HoldForm[False]}, HoldForm[False]}, HoldForm[If[False,
1[[2]], Log[1]]], HoldForm[Log[1]], HoldForm[0]},
           HoldForm[0*0], HoldForm[0]},
{{HoldForm[System`ComplexExpandDump`x], HoldForm[1/4]},
           {HoldForm[System`ComplexExpandDump`arg], HoldForm[Pi]},
HoldForm[Pi/4]}, HoldForm[0 + Pi/4], HoldForm[Pi/4]},
         HoldForm[System`ComplexExpandDump`theta = Pi/4], HoldForm[Pi/4]}, 
        {{{{HoldForm[System`ComplexExpandDump`abs], HoldForm[1]},
{HoldForm[System`ComplexExpandDump`x], HoldForm[1/4]},
           HoldForm[1^(1/4)], HoldForm[1]},
{{{HoldForm[System`ComplexExpandDump`y], HoldForm[0]},
            {HoldForm[System`ComplexExpandDump`arg], HoldForm[Pi]},
HoldForm[-(0*Pi)], HoldForm[0*Pi], HoldForm[0]},
           HoldForm[E^0], HoldForm[1]}, HoldForm[1*1], HoldForm[1]},
HoldForm[System`ComplexExpandDump`power = 1], HoldForm[1]},
        {{{HoldForm[System`ComplexExpandDump`theta], HoldForm[Pi/4]},
HoldForm[System`ComplexExpandDump`SpecialQ[Pi/4]],
          HoldForm[Block[{System`ComplexExpandDump`den =
Denominator[1/4]}, System`ComplexExpandDump`den == 8 ||
             System`ComplexExpandDump`den == 9 ||
System`ComplexExpandDump`den == 15 || System`ComplexExpandDump`den ==
16 ||
             System`ComplexExpandDump`den == 18]],
{HoldForm[Denominator[1/4]], HoldForm[4]},
          {HoldForm[System`ComplexExpandDump`den = 4], HoldForm[4]},
{HoldForm[System`ComplexExpandDump`den == 8 ||
             System`ComplexExpandDump`den == 9 ||
System`ComplexExpandDump`den == 15 || System`ComplexExpandDump`den ==
16 ||
             System`ComplexExpandDump`den == 18],
{{HoldForm[System`ComplexExpandDump`den], HoldForm[4]}, HoldForm[4 ==
8],
            HoldForm[False]},
{{HoldForm[System`ComplexExpandDump`den], HoldForm[4]}, HoldForm[4 ==
9], HoldForm[False]},
           {{HoldForm[System`ComplexExpandDump`den], HoldForm[4]},
HoldForm[4 == 15], HoldForm[False]},
           {{HoldForm[System`ComplexExpandDump`den], HoldForm[4]},
HoldForm[4 == 16], HoldForm[False]},
           {{HoldForm[System`ComplexExpandDump`den], HoldForm[4]},
HoldForm[4 == 18], HoldForm[False]}, HoldForm[False]},
          HoldForm[False]}, HoldForm[If[False,
System`ComplexExpandDump`re =
System`ComplexExpandDump`ReImRecursive[Cos[
                System`ComplexExpandDump`theta]][[1]];
System`ComplexExpandDump`im =
System`ComplexExpandDump`ReImRecursive[Sin[
                System`ComplexExpandDump`theta]][[1]],
System`ComplexExpandDump`re = Cos[System`ComplexExpandDump`theta];
            System`ComplexExpandDump`im =
Sin[System`ComplexExpandDump`theta]]],
         HoldForm[System`ComplexExpandDump`re =
Cos[System`ComplexExpandDump`theta]; System`ComplexExpandDump`im =
            Sin[System`ComplexExpandDump`theta]],
{{{HoldForm[System`ComplexExpandDump`theta], HoldForm[Pi/4]},
           HoldForm[Cos[Pi/4]], HoldForm[1/Sqrt[2]]},
HoldForm[System`ComplexExpandDump`re = 1/Sqrt[2]],
HoldForm[1/Sqrt[2]]},
         {{{HoldForm[System`ComplexExpandDump`theta], HoldForm[Pi/4]},
HoldForm[Sin[Pi/4]], HoldForm[1/Sqrt[2]]},
          HoldForm[System`ComplexExpandDump`im = 1/Sqrt[2]],
HoldForm[1/Sqrt[2]]}, HoldForm[1/Sqrt[2]]},
        {{{HoldForm[System`ComplexExpandDump`power], HoldForm[1]},
{HoldForm[System`ComplexExpandDump`re], HoldForm[1/Sqrt[2]]},
          HoldForm[1/Sqrt[2]], HoldForm[1/Sqrt[2]]},
{{HoldForm[System`ComplexExpandDump`power], HoldForm[1]},
          {HoldForm[System`ComplexExpandDump`im],
HoldForm[1/Sqrt[2]]}, HoldForm[1/Sqrt[2]], HoldForm[1/Sqrt[2]]},
         HoldForm[{1/Sqrt[2], 1/Sqrt[2]}]}, HoldForm[{1/Sqrt[2],
1/Sqrt[2]}]}, HoldForm[{1/Sqrt[2], 1/Sqrt[2]}]},
      HoldForm[{1/Sqrt[2], 1/Sqrt[2]}]}, HoldForm[{1/Sqrt[2], 1/Sqrt[2]}]}, 
    HoldForm[{System`ComplexExpandDump`x, System`ComplexExpandDump`y}
= {1/Sqrt[2], 1/Sqrt[2]}],
    HoldForm[{1/Sqrt[2], 1/Sqrt[2]}]},
{{{{HoldForm[System`ComplexExpandDump`x], HoldForm[1/Sqrt[2]]},
      HoldForm[Expand[1/Sqrt[2]]], HoldForm[1/Sqrt[2]]},
{{HoldForm[I], HoldForm[I]},
      {{HoldForm[System`ComplexExpandDump`y], HoldForm[1/Sqrt[2]]},
HoldForm[Expand[1/Sqrt[2]]], HoldForm[1/Sqrt[2]]},
      HoldForm[I/Sqrt[2]]}, HoldForm[1/Sqrt[2] + I/Sqrt[2]],
HoldForm[I/Sqrt[2] + 1/Sqrt[2]], HoldForm[(1 + I)/Sqrt[2]]},
    HoldForm[System`ComplexExpandDump`return = (1 + I)/Sqrt[2]],
HoldForm[(1 + I)/Sqrt[2]]}, HoldForm[Null]},
  {{HoldForm[System`ComplexExpandDump`x ===
System`ComplexExpandDump`ReImFail || System`ComplexExpandDump`y ===
       System`ComplexExpandDump`ReImFail],
{{HoldForm[System`ComplexExpandDump`x], HoldForm[1/Sqrt[2]]},
     HoldForm[1/Sqrt[2] === System`ComplexExpandDump`ReImFail],
HoldForm[False]},
    {{HoldForm[System`ComplexExpandDump`y], HoldForm[1/Sqrt[2]]},
HoldForm[1/Sqrt[2] === System`ComplexExpandDump`ReImFail],
     HoldForm[False]}, HoldForm[False]}, HoldForm[If[False, (-1)^(1/4), 
     Block[{System`ComplexExpandDump`BadFunctions,
System`ComplexExpandDump`Badpatterns, System`ComplexExpandDump`pos},
      System`ComplexExpandDump`BadFunctions =
Select[System`ComplexExpandDump`AllowedSix,
          !MemberQ[System`ComplexExpandDump`AllowedFunctions, #1] & ];
System`ComplexExpandDump`BadPatterns =
        Alternatives @@
Table[System`ComplexExpandDump`BadFunctions[[System`ComplexExpandDump`j]],
          {System`ComplexExpandDump`j,
Length[System`ComplexExpandDump`BadFunctions]}];
System`ComplexExpandDump`pos =
        Position[System`ComplexExpandDump`return,
System`ComplexExpandDump`BadPatterns[_]];
       System`ComplexExpandDump`AllowedFunctions =
System`ComplexExpandDump`AllowedSix; System`ComplexExpandDump`return =
        MapAt[ComplexExpand[#1, {}] & ,
System`ComplexExpandDump`return, System`ComplexExpandDump`pos];
       System`ComplexExpandDump`return]]],
HoldForm[Block[{System`ComplexExpandDump`BadFunctions,
      System`ComplexExpandDump`Badpatterns, System`ComplexExpandDump`pos}, 
     System`ComplexExpandDump`BadFunctions =
Select[System`ComplexExpandDump`AllowedSix,
         !MemberQ[System`ComplexExpandDump`AllowedFunctions, #1] & ];
System`ComplexExpandDump`BadPatterns =
       Alternatives @@
Table[System`ComplexExpandDump`BadFunctions[[System`ComplexExpandDump`j]],
         {System`ComplexExpandDump`j,
Length[System`ComplexExpandDump`BadFunctions]}];
      System`ComplexExpandDump`pos =
Position[System`ComplexExpandDump`return,
System`ComplexExpandDump`BadPatterns[_]];
      System`ComplexExpandDump`AllowedFunctions =
System`ComplexExpandDump`AllowedSix;
      System`ComplexExpandDump`return = MapAt[ComplexExpand[#1, {}] &
, System`ComplexExpandDump`return,
        System`ComplexExpandDump`pos]; System`ComplexExpandDump`return]], 
   {HoldForm[System`ComplexExpandDump`BadFunctions =
Select[System`ComplexExpandDump`AllowedSix,
         !MemberQ[System`ComplexExpandDump`AllowedFunctions, #1] & ];
System`ComplexExpandDump`BadPatterns =
       Alternatives @@
Table[System`ComplexExpandDump`BadFunctions[[System`ComplexExpandDump`j]],
         {System`ComplexExpandDump`j,
Length[System`ComplexExpandDump`BadFunctions]}];
      System`ComplexExpandDump`pos =
Position[System`ComplexExpandDump`return,
System`ComplexExpandDump`BadPatterns[_]];
      System`ComplexExpandDump`AllowedFunctions =
System`ComplexExpandDump`AllowedSix;
      System`ComplexExpandDump`return = MapAt[ComplexExpand[#1, {}] &
, System`ComplexExpandDump`return,
        System`ComplexExpandDump`pos]; System`ComplexExpandDump`return], 
    {{{HoldForm[System`ComplexExpandDump`AllowedSix], HoldForm[{Re,
Im, Abs, Arg, Conjugate, Sign}]},
      HoldForm[Select[{Re, Im, Abs, Arg, Conjugate, Sign}, 
!MemberQ[System`ComplexExpandDump`AllowedFunctions, #1] & ]],
      {HoldForm[( !MemberQ[System`ComplexExpandDump`AllowedFunctions,
#1] & )[Re]],
       HoldForm[ !MemberQ[System`ComplexExpandDump`AllowedFunctions, Re]], 
       {{HoldForm[System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
        HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign}, Re]],
HoldForm[True]}, HoldForm[ !True], HoldForm[False]},
      {HoldForm[( !MemberQ[System`ComplexExpandDump`AllowedFunctions,
#1] & )[Im]],
       HoldForm[ !MemberQ[System`ComplexExpandDump`AllowedFunctions, Im]], 
       {{HoldForm[System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
        HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign}, Im]],
HoldForm[True]}, HoldForm[ !True], HoldForm[False]},
      {HoldForm[( !MemberQ[System`ComplexExpandDump`AllowedFunctions,
#1] & )[Abs]],
       HoldForm[ !MemberQ[System`ComplexExpandDump`AllowedFunctions, Abs]], 
       {{HoldForm[System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
        HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign}, Abs]],
HoldForm[True]}, HoldForm[ !True], HoldForm[False]},
      {HoldForm[( !MemberQ[System`ComplexExpandDump`AllowedFunctions,
#1] & )[Arg]],
       HoldForm[ !MemberQ[System`ComplexExpandDump`AllowedFunctions, Arg]], 
       {{HoldForm[System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
        HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign}, Arg]],
HoldForm[True]}, HoldForm[ !True], HoldForm[False]},
      {HoldForm[( !MemberQ[System`ComplexExpandDump`AllowedFunctions,
#1] & )[Conjugate]],
       HoldForm[ !MemberQ[System`ComplexExpandDump`AllowedFunctions,
Conjugate]],
       {{HoldForm[System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
        HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign},
Conjugate]], HoldForm[True]}, HoldForm[ !True], HoldForm[False]},
      {HoldForm[( !MemberQ[System`ComplexExpandDump`AllowedFunctions,
#1] & )[Sign]],
       HoldForm[ !MemberQ[System`ComplexExpandDump`AllowedFunctions, Sign]], 
       {{HoldForm[System`ComplexExpandDump`AllowedFunctions],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
        HoldForm[MemberQ[{Re, Im, Abs, Arg, Conjugate, Sign}, Sign]],
HoldForm[True]}, HoldForm[ !True], HoldForm[False]},
      HoldForm[{}]}, HoldForm[System`ComplexExpandDump`BadFunctions =
{}], HoldForm[{}]},
    {{{HoldForm[Table[System`ComplexExpandDump`BadFunctions[[System`ComplexExpandDump`j]],
{System`ComplexExpandDump`j,
          Length[System`ComplexExpandDump`BadFunctions]}]],
HoldForm[{}]}, HoldForm[Alternatives @@ {}],
      HoldForm[Alternatives[]]},
HoldForm[System`ComplexExpandDump`BadPatterns = Alternatives[]],
HoldForm[Alternatives[]]},
    {{{HoldForm[System`ComplexExpandDump`return], HoldForm[(1 + I)/Sqrt[2]]}, 
      {{HoldForm[System`ComplexExpandDump`BadPatterns],
HoldForm[Alternatives[]]}, HoldForm[(Alternatives[])[_]]},
      HoldForm[Position[(1 + I)/Sqrt[2], (Alternatives[])[_]]],
HoldForm[{}]}, HoldForm[System`ComplexExpandDump`pos = {}],
     HoldForm[{}]}, {{HoldForm[System`ComplexExpandDump`AllowedSix],
HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
     HoldForm[System`ComplexExpandDump`AllowedFunctions = {Re, Im,
Abs, Arg, Conjugate, Sign}],
     HoldForm[{Re, Im, Abs, Arg, Conjugate, Sign}]},
{{{HoldForm[System`ComplexExpandDump`return], HoldForm[(1 +
I)/Sqrt[2]]},
      {HoldForm[System`ComplexExpandDump`pos], HoldForm[{}]},
HoldForm[MapAt[ComplexExpand[#1, {}] & , (1 + I)/Sqrt[2], {}]],
      HoldForm[(1 + I)/Sqrt[2]]},
HoldForm[System`ComplexExpandDump`return = (1 + I)/Sqrt[2]],
HoldForm[(1 + I)/Sqrt[2]]},
    {HoldForm[System`ComplexExpandDump`return], HoldForm[(1 +
I)/Sqrt[2]]}, HoldForm[(1 + I)/Sqrt[2]]},
   HoldForm[(1 + I)/Sqrt[2]]}, HoldForm[(1 + I)/Sqrt[2]]}, HoldForm[(1
+ I)/Sqrt[2]]}

On 9/4/05, David Park <djmp at earthlink.net> wrote:
> Mike,
> 
> The answer is very simple! Just look at...
> 
> ComplexExpand[(-1)^(1/4)] // Trace
> 
> Could anything be clearer?
> 
> David Park
> djmp at earthlink.net
> http://home.earthlink.net/~djmp/
> 
> 
> From: mike_in_england2000 at yahoo.co.uk
To: mathgroup at smc.vnet.net
> [mailto:mike_in_england2000 at yahoo.co.uk]
> 
> 
> Hi
> 
> The Mathematica help system says that
> 
> "ComplexExpand[expr] expands expr assuming that all variables are
> real."
> 
> which is fine and explains why expressions such as
> ComplexExpand[Conjugate[x +I y]] work.All seems obvious so far.
> 
> What is confusing me though is why does
> 
> ComplexExpand[(-1)^(1/4)]
> 
> give the result
> 
> (1 + I)/Sqrt[2]
> 
> I know this the correct result but in the expression (-1)^(1/4) there
> are no variables.  The numbers involved are real so what on earth is
> ComplexExpand doing? Is this a stupid question? Should I have drank
> more coffee before posting this.
> 
> Thanks
> Mike
> 
> 
> 
> 
> 


-- 
Chris Chiasson
http://chrischiasson.com/
1 (810) 265-3161


  • Prev by Date: Re: Why this function does not return a single value
  • Next by Date: # question
  • Previous by thread: Re: ComplexExpand confusion
  • Next by thread: Re: ComplexExpand confusion