Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Re: Undiscovered Bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46912] Re: [mg46902] Re: Undiscovered Bug?
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sun, 14 Mar 2004 23:54:27 -0500 (EST)
  • References: <c2u50r$f8i$1@smc.vnet.net> <200403140824.DAA06021@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 14 Mar 2004, at 09:24, Harold Noffke wrote:

> MathGroup:
>
> Thanks to all for help with Part documentation ...
>
>     "When expr is a list, expr[[{i1, i2, ... in ]] gives a list of
> parts. In general, the head of expr is applied to the list of parts."
>
> ReplacePart's behavior, however, produces a different result ...
>
>     Recall, we had for Part ...
>
>     In[5]:= (x/y)[[{2, 1, 1, 0, 2, 2, 0}]]
>
>                  2  2
>             Times  x
>     Out[5]= ---------
>                 3
>                y
>
>     But, we have for ReplacePart ...
>
>     In[1]:= ReplacePart[(x/y), a, {2, 1, 1, 0, 2, 2, 0}]
>
>                                                       x
>     ReplacePart::partw: Part {2, 1, 1, 0, 2, 2, 0} of - does not
> exist.
>                                                       y
>
> Maybe I'm still missing something, but it seems to me Part should be
> revised to detect the same errors as ReplacePart.
>
> Regards,
> Harold
>
>
>
  What errors? There was no error in the syntax in your first (Part) 
example so what should be detected? You made an error but the 
Mathematica syntax was correct and after all Mathematica is not yet 
able to read minds. As for ReplacePart: its syntax is different from 
Part so you get a different result. ReplacePart and Part serve a 
different purpose so why should their syntax be the same? Besides, in 
any case, with ReplacePart you can eqaually well get results to inputs 
that you might enter "by mistake", e.g.:
In[3]:=
  ReplacePart[(x/y), a, Partition[{2, 1, 1, 0, 2, 2, 0},1]]

Out[3]=
a(a,a)

Andrzej Kozlowksi







  • Prev by Date: RE: Graphs of Sequences of Functions:(
  • Next by Date: New Application
  • Previous by thread: Re: Undiscovered Bug?
  • Next by thread: Re: Undiscovered Bug?