[Date Index]
[Thread Index]
[Author Index]
Re: Sum of terms --> list
*To*: mathgroup at smc.vnet.net
*Subject*: [mg110702] Re: Sum of terms --> list
*From*: Leonid Shifrin <lshifr at gmail.com>
*Date*: Fri, 2 Jul 2010 07:28:05 -0400 (EDT)
There is something more to it however - that is, when you enter 3+4I, it
first does have the head Plus (during the parse stage), and only then
changes to Complex (during evaluation stage only). Therefore, we can achieve
the effect in question using evaluation control:
In[1]:= List @@ Unevaluated[3 + 4 I]
Out[1]= {3, 4 I}
In[2]:= FullForm[Unevaluated[3+4I]]
Out[2]//FullForm= Unevaluated[Plus[3,Times[4,\[ImaginaryI]]]]
Regards,
Leonid
On Thu, Jul 1, 2010 at 11:56 PM, Bill Rowe <readnews at sbcglobal.net> wrote:
> On 7/1/10 at 8:27 AM, nma at 12000.org (Nasser M. Abbasi) wrote:
>
> >it seems in the second case, this happens becuase the
> >expression was evaluated first? By holding evaluation, one can
> >get the same result as in the first case:
>
> >List @@ (a + b*I)
> >{a, I*b}
>
> >List @@ (3 + 4*I)
> >3 + 4*I
>
> >ReleaseHold@(List @@ (3 + Hold@4*I))
> >{3,4 I}
>
> Not quite the right explanation. The key is 3 + 4 I isn't an
> expression in the same sense as 3.4 isn't an expression. That is
> it has no parts. It makes no more sense to have List@@(3+4 I)
> yield {3, 4 I} then it does to have List@@{3.4} yield either
> {3.4} or {3, 4}.
>
> By adding Hold, you create a new expression which has parts. Now
> you can use Apply to change this to a list and rid yourself of
> the Hold part using ReleaseHold.
>
Prev by Date:
**Re: boolean variable with contours**
Next by Date:
** Re: Need to Speed up Position[]**
Previous by thread:
**Re: Sum of terms --> list**
Next by thread:
**ReadList with system command problem ?**
| |