RE: How do I pick out the expression under a radical?
- To: mathgroup at smc.vnet.net
- Subject: [mg36247] RE: [mg36225] How do I pick out the expression under a radical?
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 28 Aug 2002 04:16:07 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Steve, Here is a slightly more complicated case. expr = a b x^2 + 5 x^3 + 5 Sqrt[4 - x^2] - 1/Sqrt[5 - 2x^2] The following picks out the expressions under square roots. Square roots are represented as Power[a,1/2] and if they are in the denominator they are a -1/2 power. We use an Alternative in the pattern to pick out both. rexprs = Cases[expr, Power[a_, 1/2 | -1/2] -> a, Infinity] {5 - 2*x^2, 4 - x^2} The following Standard Package is useful. Needs["Algebra`InequalitySolve`"] And @@ (# >= 0 & /@ rexprs) InequalitySolve[%, x] 5 - 2*x^2 >= 0 && 4 - x^2 >= 0 -Sqrt[5/2] <= x <= Sqrt[5/2] David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Steve Beach [mailto:asb4 at psu.edu] To: mathgroup at smc.vnet.net I'm a poor physicist trying to figure out how to sort out the "physical" from the "non-physical" solutions to a problem. To do that, I need to be able to look at an expression and pick out a subexpression, the part under the radical. For example, say I've got the expression a b x^2 + 5 x^3 + 5 Sqrt[4 - x^2] I'd like to pick out "4 - x^2", which would then tell me that x is between +/- 2. I know there has got to be an easy way to do it, but I can't find it. Any help would be appreciated. Thanks, Steve Beach asb4 at psu.edu http://www.thebeachfamily.org