MathGroup Archive 2008

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

Search the Archive

Re: Exponent function question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94420] Re: Exponent function question
  • From: dimitris <dimmechan at yahoo.com>
  • Date: Fri, 12 Dec 2008 06:56:46 -0500 (EST)
  • References: <ghqju2$138$1@smc.vnet.net>

On 11 =C4=E5=EA, 10:44, Tuesday Shopping <tuesdayshopp... at yahoo.com> 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 e=
xpression. Is there any way to do this? I would like to get "2" as output f=
or the above example.
>
> Note that the input expression could be quite complex involving many func=
tions, such as trigonametric, logarithms and other functions. However, the =
exponent itself (2 in the above example) is always going to be an integer.
>
> Thanks

Say, Sqrt[x^2 + 1] + Sin[x^4*Tan[x^8]]] is your expression, then you
could try

In[36]:=
Max[Cases[Log[Sqrt[x^2 + 1] + Sin[x^4*Tan[x^8]]], (x_)^(a_Integer) :>
a, Infinity]]

Out[36]=
8

or
In[37]:=
Max[(Exponent[#1, x] & ) /@ Cases[Log[Sqrt[x^2 + 1] + Sin[x^4*Tan
[x^8]]], x^_Integer, Infinity]]

Out[37]=
8

You can take an idea of how the above one liners work if you decompose
the codes. You also the built in functions
TreeForm and FullForm to this end

Dimitris


  • Prev by Date: Re: Manipulate question
  • Next by Date: Re: Clever way to manipulate lists
  • Previous by thread: Re: Exponent function question
  • Next by thread: Re: Exponent function question