Re: find argument of function inside long result?

• To: mathgroup at smc.vnet.net
• Subject: [mg31347] Re: [mg31313] find argument of function inside long result?
• From: "Johannes Ludsteck" <johannes.ludsteck at wiwi.uni-regensburg.de>
• Date: Tue, 30 Oct 2001 04:35:30 -0500 (EST)
• Organization: Universitaet Regensburg
• Sender: owner-wri-mathgroup at wolfram.com

```Dear jose,
use pattern matching functions
Here is an example. I try to extract all
arguments of Sqrt[_] from an expression. This
defines the expression:

expr=Sqrt[a] Sin[Sqrt[Sqrt[d]+e] 5+c]

This extracts all root subexpressions and returns
a list of them.
temp=Cases[expr,Sqrt[__],Infinity]

Only one additional step extracts the arguments
from the Sqrt[_] terms:

Map[Cases[#,_]&,temp]

Of course, you can combine both steps
Map[Cases[#,_]&,Cases[expr,Sqrt[__],Infinity]]

Note that argument Infinity is important if you
want to get all Sqrt terms.

Best regards,
Johannes

On 27 Oct 2001, at 1:08, jose flanigan wrote:

> I have a very long symbolic result that has several sqrt functions. I
> would like to extract the arguments of each of the sqrt's.
>
> How can I do this? The expression is too complicated to try and read it off.
>
> thanks.
>

<><><><><><><><><><><><><><><><><><>
Johannes Ludsteck
Institut fuer Volkswirtschaftslehre
Lehrstuhl Prof. Dr. Moeller
Universitaet Regensburg
Universitaetsstrasse 31
93053 Regensburg
Tel +49/0941/943-2741

```

• Prev by Date: Re: Can NDSolve find the other solution???
• Next by Date: Re: Simplifying expressions, and Alpha
• Previous by thread: Re: find argument of function inside long result?
• Next by thread: Plotting the histogram