MathGroup Archive 2008

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

Search the Archive

Re: Exponent function question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94436] Re: [mg94362] Exponent function question
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Fri, 12 Dec 2008 06:59:39 -0500 (EST)
  • References: <200812110844.DAA01122@smc.vnet.net>

On Dec 11, 2008, at 3:44 AM, Tuesday Shopping wrote:

> Reposting the question (previous post did not make it for some reason)
>
> Consider a simple example: "Exponent[Sqrt[x^2+1], x]". This gives  
> "0" as output.
>
> I am trying to determine the maximum exponent of a given variable  
> in an expression. Is there any way to do this? I would like to get  
> "2" as output for the above example.
>
> Note that the input expression could be quite complex involving  
> many functions, such as trigonametric, logarithms and other  
> functions. However, the exponent itself (2 in the above example) is  
> always going to be an integer.

I don't use Exponent regularly, but it seems it only works on  
polynomials, so you need to find the polynomials in your expression,  
apply exponent to each individually, and then do something with all  
the results such as taking the maximum exponent found.  Here's a  
hastily contrived example:

maxExponentInExpression[expr_,var_]:=Max[Most[Reap[Scan[If[PolynomialQ 
[#, var], Sow[Exponent[#,var]]] &, expr, Depth[expr] - 1]]]]

Regards,

Ssezi


  • Prev by Date: Re: Clever way to manipulate lists
  • Next by Date: Re: VectorStyle for centered vector tail?
  • Previous by thread: Exponent function question
  • Next by thread: Elliptic Modular Function