Skip to main content
added 443 characters in body
Source Link
Artes
  • 57.9k
  • 13
  • 159
  • 247

It seems like the simplestThe most straightforward way isappears to usebe using carefully simple replacement rules involving RuleDelayed twicerather than Rule:

HornerForm[ E^(I x) + 2 E^(2 I x) + 3 E^(3 I x) + 4 E^(4 I x) + 5 E^(5 I x) 
           + 6 E^(6 I x) + 7 E^(7 I x) + 8 E^(8 I x) + 9 E^(9 I x) + 10 E^(10 I x) /. 
E^(Complex[0, b_] x) :> z^b, z] /. z :> E^(I x)

enter image description here

% // TraditionalForm

enter image description here

We couldn't make it simpler since imaginaryshould remember one subtlety using patterns in replacement rules involving complex (imaginary) factors are represented as, which we can illustrate with e.g. Complex[0, 5], not:

FullForm @ Unevaluated[ 5 I x]
FullForm[ 5 I x]
 Unevaluated[ Times[5, I, x]]
 Times[ Complex[0, 5], x]
 

namely: built-in rewriting rules of the system automatically evaluate Times[ 5, I] even though the latter automatically evaluates to Complex[0, 5] being an atom:

AtomQ[ Complex[0, 5]]
True

therefore we couldn't make our rule simpler and had used E^(Complex[0, b_] x) :> z^b instead of something like apparently simpler E^(I b_ x) :> z^b.

It seems like the simplest way is to use RuleDelayed twice:

HornerForm[ E^(I x) + 2 E^(2 I x) + 3 E^(3 I x) + 4 E^(4 I x) + 5 E^(5 I x) 
           + 6 E^(6 I x) + 7 E^(7 I x) + 8 E^(8 I x) + 9 E^(9 I x) + 10 E^(10 I x) /. 
E^(Complex[0, b_] x) :> z^b, z] /. z :> E^(I x)

enter image description here

% // TraditionalForm

enter image description here

We couldn't make it simpler since imaginary factors are represented as e.g. Complex[0, 5], not Times[ 5, I] even though the latter automatically evaluates to Complex[0, 5] being an atom:

AtomQ[ Complex[0, 5]]
True

The most straightforward way appears to be using carefully simple replacement rules involving RuleDelayed rather than Rule:

HornerForm[ E^(I x) + 2 E^(2 I x) + 3 E^(3 I x) + 4 E^(4 I x) + 5 E^(5 I x) 
           + 6 E^(6 I x) + 7 E^(7 I x) + 8 E^(8 I x) + 9 E^(9 I x) + 10 E^(10 I x) /. 
E^(Complex[0, b_] x) :> z^b, z] /. z :> E^(I x)

enter image description here

% // TraditionalForm

enter image description here

We should remember one subtlety using patterns in replacement rules involving complex (imaginary) factors, which we can illustrate with e.g.:

FullForm @ Unevaluated[ 5 I x]
FullForm[ 5 I x]
 Unevaluated[ Times[5, I, x]]
 Times[ Complex[0, 5], x]
 

namely: built-in rewriting rules of the system automatically evaluate Times[ 5, I] to Complex[0, 5] being an atom:

AtomQ[ Complex[0, 5]]
True

therefore we couldn't make our rule simpler and had used E^(Complex[0, b_] x) :> z^b instead of something like apparently simpler E^(I b_ x) :> z^b.

added 132 characters in body
Source Link
Artes
  • 57.9k
  • 13
  • 159
  • 247

It seems like the simplest way is to use RuleDelayed twice:

HornerForm[ E^(I x) + 2 E^(2 I x) + 3 E^(3 I x) + 4 E^(4 I x) + 5 E^(5 I x) 
           + 6 E^(6 I x) + 7 E^(7 I x) + 8 E^(8 I x) + 9 E^(9 I x) + 10 E^(10 I x) /. 
E^(Complex[0, b_] x) :> z^b, z] /. z :> E^(I x)

enter image description here

% // TraditionalForm

enter image description here

We couldn't make it simpler since imaginary factors are represented as e.g. Complex[0, 5], not Times[ 5, I] even though the latter automatically evaluates to Complex[0, 5] being an atom:

AtomQ[Complex[0AtomQ[ Complex[0, 5]]
True

It seems like the simplest way:

HornerForm[ E^(I x) + 2 E^(2 I x) + 3 E^(3 I x) + 4 E^(4 I x) + 5 E^(5 I x) 
           + 6 E^(6 I x) + 7 E^(7 I x) + 8 E^(8 I x) + 9 E^(9 I x) + 10 E^(10 I x) /. 
E^(Complex[0, b_] x) :> z^b, z] /. z :> E^(I x)

enter image description here

We couldn't make it simpler since imaginary factors are represented as e.g. Complex[0, 5], not Times[ 5, I] even though the latter automatically evaluates to an atom:

AtomQ[Complex[0, 5]]
True

It seems like the simplest way is to use RuleDelayed twice:

HornerForm[ E^(I x) + 2 E^(2 I x) + 3 E^(3 I x) + 4 E^(4 I x) + 5 E^(5 I x) 
           + 6 E^(6 I x) + 7 E^(7 I x) + 8 E^(8 I x) + 9 E^(9 I x) + 10 E^(10 I x) /. 
E^(Complex[0, b_] x) :> z^b, z] /. z :> E^(I x)

enter image description here

% // TraditionalForm

enter image description here

We couldn't make it simpler since imaginary factors are represented as e.g. Complex[0, 5], not Times[ 5, I] even though the latter automatically evaluates to Complex[0, 5] being an atom:

AtomQ[ Complex[0, 5]]
True
added 198 characters in body
Source Link
Artes
  • 57.9k
  • 13
  • 159
  • 247

We can make it simply thisIt seems like the simplest way:

HornerForm[ E^(I x) + 2 E^(2 I x) + 3 E^(3 I x) + 4 E^(4 I x) + 5 E^(5 I x) 
           + 6 E^(6 I x) + 7 E^(7 I x) + 8 E^(8 I x) + 9 E^(9 I x) + 10 E^(10 I x) /. 
{Power[E, Times[Complex[0E^(Complex[0, b_], x]]x) :> z^b}, z] /. z :> E^(I x)

enter image description here

We couldn't make it simpler since imaginary factors are represented as e.g. Complex[0, 5], not Times[ 5, I] even though the latter automatically evaluates to an atom:

AtomQ[Complex[0, 5]]
True

We can make it simply this way:

HornerForm[ E^(I x) + 2 E^(2 I x) + 3 E^(3 I x) + 4 E^(4 I x) + 5 E^(5 I x) 
           + 6 E^(6 I x) + 7 E^(7 I x) + 8 E^(8 I x) + 9 E^(9 I x) + 10 E^(10 I x) /. 
{Power[E, Times[Complex[0, b_], x]] :> z^b}, z] /. z :> E^(I x)

enter image description here

It seems like the simplest way:

HornerForm[ E^(I x) + 2 E^(2 I x) + 3 E^(3 I x) + 4 E^(4 I x) + 5 E^(5 I x) 
           + 6 E^(6 I x) + 7 E^(7 I x) + 8 E^(8 I x) + 9 E^(9 I x) + 10 E^(10 I x) /. 
E^(Complex[0, b_] x) :> z^b, z] /. z :> E^(I x)

enter image description here

We couldn't make it simpler since imaginary factors are represented as e.g. Complex[0, 5], not Times[ 5, I] even though the latter automatically evaluates to an atom:

AtomQ[Complex[0, 5]]
True
added 357 characters in body
Source Link
Artes
  • 57.9k
  • 13
  • 159
  • 247
Loading
Source Link
Artes
  • 57.9k
  • 13
  • 159
  • 247
Loading