MathGroup Archive 1997

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

Search the Archive

Re: How do you make Mma assume a parameter is real and positive?

  • To: mathgroup at
  • Subject: [mg7407] Re: [mg7343] How do you make Mma assume a parameter is real and positive?
  • From: Richard Finley <trfin at>
  • Date: Fri, 30 May 1997 01:20:39 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


Sorry, I didn't have time to read your whole background, but for an answer
to the basic question:

PowerExpand[ expr ] makes the assumption that the arguments are real and
positive as you suggested, therefore you can use this ( if you know your
arguments do indeed satisfy those constraints) and you will get:

PowerExpand [ Sqrt [ a^2 ] ] = a 
as you desire.

Hope that helps...RF

At 10:27 PM 5/27/97 -0400, you wrote:
>Hi all,
>If I give mma the input Sqrt[3^2] I get back 3, but when I give it
>Sqrt[a^2] I don't get back a. This is exactly the behavior I expect. 
>However, suppose that I want to tell mma that a is a real positive number,
>so that I want Sqrt[a^2] to return a. How can I do this?
>Let me give you the background for this question. As a simple example,
>suppose I am trying to find the series expansion of 
>        2
>       b
>          2  2
>a - Sqrt[a -b ]
>So, I try
>and mma returns
>     2
>    b
>---------- + O[b]^4
>        2
>a-Sqrt[a ]
>which is certainly the wrong answer. The correct answer is
>        2
>       b
>2 a - --- + O[b]^4
>      2 a
>So, I need to tell mma that Sqrt[a^2] is a while it is doing its series
>expansion algorithm. Another manifestation of this problem occurs when
>taking limits, since mma gives
>            2
>           b
>Limit[-------------, b->0] ---> 0
>              2  2
>      a-Sqrt[a -b ]
>which is also incorrect (it should be 2 a). The usual solution of using
>ComplexExpand doesn't help here. My solution for this particular example
>was to add new rules for Power: 
>Power[Power[a,n_],m_]:=Power[a,n m];
>I would have preferred to add an upvalue to a, but a would be too deeply
>buried if I were to try
>a /: Power[Power[a,n_],m_]:=Power[a,n m]
>I am not crazy about the above method, since it slows down the application
>of Power everywhere, so I am curious if anybody has a better method.
>Thanks for any suggestions.

  • Prev by Date: Accessing help-pages (mm3.0) is so slow (PC-Xware --> Workstation)
  • Next by Date: Abs and Sign anomolies
  • Previous by thread: Accessing help-pages (mm3.0) is so slow (PC-Xware --> Workstation)
  • Next by thread: Abs and Sign anomolies