MathGroup Archive 2012

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

Search the Archive

Re: List manipulation?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128319] Re: List manipulation?
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sat, 6 Oct 2012 01:52:52 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

On 10/5/12 at 2:48 AM,
=?ISO-8859-1?Q?Andreas_Talmon_l=27Arm=E9e?= at smc.vnet.net wrote:

>I got a problem with List manipulation. I have the following list
>item:

>a = -Subscript[50, 5]

>and I would like to change the value of 50 to 360-50 and also change
>the sign to +. First I tried to change the sign and then the value
>and I got an outcome I didn't understand. Doing the other way round
>I get the outcome I expected. Does anybody know what the difference
>is?

>Here is the Example file: http://dl.dropbox.com/u/4920002/Example.nb

>a = -Subscript[50, 5]
>a[[2, 1]] = 360 - a[[2, 1]]
>a[[1]] = -1*a[[1]]
>a

>b = -Subscript[50, 5]
>b[[1]] = -1*b[[1]]
>b[[1]] = 360 - b[[1]]
>b

Compare

a[[2, 1]] = 360 - a[[2, 1]]

to

b[[1]] = 360 - b[[1]]

Do you not see you are setting a different part of the
expression to 360-50?

Also, your step to change the sign is needlessly complex. That
is doing a = -a is sufficient as demonstrated by:

In[4]:= b = -Subscript[50, 5];
a = -Subscript[50, 5];
b = -b;
a[[1]] = -1*a[[1]];
{a, a == b}

Out[8]= {Subscript[50, 5], True}




  • Prev by Date: Re: Markers in list plot
  • Next by Date: Assuming and Integrate
  • Previous by thread: Re: ordering a group of symbolic operators
  • Next by thread: Assuming and Integrate