MathGroup Archive 2006

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

Search the Archive

Re: How do I create a parametric expression?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68568] Re: How do I create a parametric expression?
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Wed, 9 Aug 2006 23:57:09 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 8/9/06 at 4:19 AM, axlq at spamcop.net (axlq) wrote:

>I'm trying to figure out how to simplify a large expression so that
>it's expressed in terms of a sub-expression that's factored into the
>larger one.

>My expression looks like this:

>-((1 + 2*n)*((a^4*k^2 + a^2*(-1 + k^2*(q - z)^2) + 2*(q - z)^2)
>*Cos[k*Sqrt[a^2 + (q - z)^2]] - k*(a^2 - 2*(q - z)^2) *Sqrt[a^2 + (q
>- z)^2]*Sin[k*Sqrt[a^2 + (q - z)^2]]) *Sin[((1 +
>2*n)*Pi*z)/L])/(8*Pi*w*(a^2 + (q - z)^2)^(5/2))

>Now, I *know* there are places in there were Sqrt[a^2+(q-z)^2]
>occurs, either by itself or raised to various powers.  If I want to
>define

>R:=Sqrt[a^2+(q-z)^2]

>...then how can I make Mathematica re-state my expression in terms
>of R?  The ReplaceRepated[] function doesn't seem to do the job.

ReplaceAll (./) seems to work, i.e.,

In[5]:=
expr=-((1 + 2*n)*((a^4*k^2 + a^2*(-1 + k^2*(q - z)^2) + 
        2*(q - z)^2)*Cos[k*Sqrt[a^2 + (q - z)^2]] - 
      k*(a^2 - 2*(q - z)^2)*Sqrt[a^2 + (q - z)^2]*
       Sin[k*Sqrt[a^2 + (q - z)^2]])*
     Sin[((1 + 2*n)*Pi*z)/L])/
   (8*Pi*w*(a^2 + (q - z)^2)^(5/2));

In[6]:=
expr /. Sqrt[a^2 + (q - z)^2] -> R

Out[6]=
-(((2*n + 1)*((k^2*a^4 + (k^2*(q - z)^2 - 1)*a^2 + 
       2*(q - z)^2)*Cos[k*R] - k*R*(a^2 - 2*(q - z)^2)*
      Sin[k*R])*Sin[((2*n + 1)*Pi*z)/L])/
   (8*Pi*w*(a^2 + (q - z)^2)^(5/2)))

Of course this doesn't replace (a^2 + (q - z)^2)^(5/2) with R^5

That could be done as by modifying the replacement rule, i.e.,

In[7]:=
expr /. a^2 + (q - z)^2 -> R^2

Out[7]=
-((1/(8*Pi*(R^2)^(5/2)*w))*((2*n + 1)*
    ((k^2*a^4 + (k^2*(q - z)^2 - 1)*a^2 + 2*(q - z)^2)*
      Cos[k*Sqrt[R^2]] - k*Sqrt[R^2]*(a^2 - 2*(q - z)^2)*
      Sin[k*Sqrt[R^2]])*Sin[((2*n + 1)*Pi*z)/L]))

This will leave terms like Sqrt[R^2] which can be eliminated using PowerExpand. However, the transformation made by PowerExpand isn't valid for all possible values of the variables
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: How do I create a parametric expression?
  • Next by Date: Re: How do I create a parametric expression?
  • Previous by thread: Re: How do I create a parametric expression?
  • Next by thread: Re: How do I create a parametric expression?