MathGroup Archive 2011

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

Search the Archive

Re: Selecting round parentheses arguments

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118072] Re: Selecting round parentheses arguments
  • From: JJ <wateronwildfire at gmail.com>
  • Date: Mon, 11 Apr 2011 07:07:40 -0400 (EDT)

I see, thank you again for the explanations.

> The problem is once you hit enter so as to make the assignment
> to p, Mathematica will evaluate the RHS of your expression. That
> will eliminate the unneeded paratheses and re-arrange the order
> of the sub terms to a canonical order. That is
>
> In[2]:= p = {a b (c 3 d) + a c (b^2 5), b (c + d 4) - a, -(a^3
> d) c}
>
> Out[2]= {5 a b^2 c+3 a b c d,b (c+4 d)-a,-a^3 c d}
>
> So, the information needed to accomplish what you want is lost.
>
> The simplest way I know to do what you are asking in Mathematica
> is to enter the RHS as a string, use the various string
> functions in Mathematica to extract the desired portion and
> finally use ToExpression to convert the extracted portion of the
> strings to expressions.
>
> The other approach would be to use Hold to prevent evaluation of
> the RHS, then manipulate the result.
>
> But neither of these strike me as being "a quick way" to achieve
> your desired goal.
>
>



> First, if you want to do this by hand, it is possible to click inside an
> expression, and then spread the selection to cover successively larger
> sub-expressions using Ctrl-. This would allow you to select, and then
> copy particular parenthesised expressions.
>
> Alternatively, you could write code to read a cell in BoxForm, and seek
> out sub expressions of the BoxForm of the form RowBox[{"("........ I
> don't know that this would really be worth the effort.
>


  • Prev by Date: Re: Recognize multiple outputs
  • Next by Date: Re: Managing your notebooks
  • Previous by thread: Re: Selecting round parentheses arguments
  • Next by thread: Importing text file as machine-precision array