MathGroup Archive 2005

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

Search the Archive

Re: how to find n in expression x^n using a pattern?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58499] Re: how to find n in expression x^n using a pattern?
  • From: "Nasser Abbasi" <nma at 12000.org>
  • Date: Mon, 4 Jul 2005 02:24:41 -0400 (EDT)
  • References: <da5iiq$1tc$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"steve" <nma124 at hotmail.com> wrote in message 
news:da5iiq$1tc$1 at smc.vnet.net...
>
> i.e I need to find the power of the factor x by itself if it exist 
> in
> the expression. not (x^n+anything), just (x^n) byitself.
>
> For example
>
> p= x (x^2+2)  ---> here n=1
>


I think a more mathematical approach might be as follows
p = x(x^2 + 2);
sol = Solve[p == 0];
r = ComplexExpand[x /. sol];
Count[r, 0]

Out[31]= 1

Nasser


  • Prev by Date: Re: Simple List manipulation question
  • Next by Date: Re: Simple List manipulation question
  • Previous by thread: Re: how to find n in expression x^n using a pattern?
  • Next by thread: converting exact numbers to binary fixed-point representation