MathGroup Archive 2012

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

Search the Archive

Re: List manipulation?

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

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

>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

>Here is the Example file:

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

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


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


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