## 20 Reputation

13 years, 198 days

## l := convert(l, 'list')...

I got it! I need to convert this false "list" (which is actually table) into real list!

yes yes yes! merci!!!

## l := convert(l, 'list')...

I got it! I need to convert this false "list" (which is actually table) into real list!

yes yes yes! merci!!!

## subsop issue...

hey Doug,

I  put a variable to guard the size in order not to make it out of bound. and it works now;
Now I have another problem

#### I try to remove from the list a as long as i come across a same value in list b, i used " subsop", but it removes all the values in list a:

let me put it simple: in maple if I do

#### Then I print(l) the result is l:=[2,3]

However, if i do l := list(30); l[1] := 2; l[2] := 2; l[3] := 3; l[4] := 3; l[5] := 5; l[6] := 7

then I print l out it shows

table([1 = 2, 2 = 2, 3 = 3, 5 = 5, 4 = 3, 6 = 7])

and then after i do l := subsop(1 = NULL, l); print(l), it shows

() = ()

## subsop issue...

hey Doug,

I  put a variable to guard the size in order not to make it out of bound. and it works now;
Now I have another problem

#### I try to remove from the list a as long as i come across a same value in list b, i used " subsop", but it removes all the values in list a:

let me put it simple: in maple if I do

#### Then I print(l) the result is l:=[2,3]

However, if i do l := list(30); l[1] := 2; l[2] := 2; l[3] := 3; l[4] := 3; l[5] := 5; l[6] := 7

then I print l out it shows

table([1 = 2, 2 = 2, 3 = 3, 5 = 5, 4 = 3, 6 = 7])

and then after i do l := subsop(1 = NULL, l); print(l), it shows

() = ()

## subsop issue...

hey Alec,

I got you. I need to put a variable to guard the size in order not to make it out of bound. and it works now;
Now I have another problem
In my real code( for a school's assignment) the two lists are obtained from 2 blocks of my other code instead of here I explicitly declared as a:=[2,2,3,3,3,5] and b:=[2,2,2,3,7].

what i did in my other blocks of code was:

I declared list a and list b after the execution of that blocks of code, if i try to print list a and list b out, I got:

table([1 = 2, 2 = 2, 3 = 3, 5 = 3, 4 = 3, 6 = 5]) and table([1 = 2, 2 = 2, 3 = 2, 5 = 7, 4 = 3]) respectively for a and b.

#### My problem is: I try to remove from the list a as long as i come across a same value in list b, i used " subsop", but it removes all the values in list a:

let me put it simple: in maple if I do

#### Then I print(l) the result is l:=[2,3]

However, if i do l := list(30); l[1] := 2; l[2] := 2; l[3] := 3; l[4] := 3; l[5] := 5; l[6] := 7

then I print l out it shows

table([1 = 2, 2 = 2, 3 = 3, 5 = 5, 4 = 3, 6 = 7])

and then after i do l := subsop(1 = NULL, l); print(l), it shows

() = ()

## it is a list, and why it shows table here? thanks!

```

```

## subsop issue...

hey Alec,

I got you. I need to put a variable to guard the size in order not to make it out of bound. and it works now;
Now I have another problem
In my real code( for a school's assignment) the two lists are obtained from 2 blocks of my other code instead of here I explicitly declared as a:=[2,2,3,3,3,5] and b:=[2,2,2,3,7].

what i did in my other blocks of code was:

I declared list a and list b after the execution of that blocks of code, if i try to print list a and list b out, I got:

table([1 = 2, 2 = 2, 3 = 3, 5 = 3, 4 = 3, 6 = 5]) and table([1 = 2, 2 = 2, 3 = 2, 5 = 7, 4 = 3]) respectively for a and b.

#### My problem is: I try to remove from the list a as long as i come across a same value in list b, i used " subsop", but it removes all the values in list a:

let me put it simple: in maple if I do

#### Then I print(l) the result is l:=[2,3]

However, if i do l := list(30); l[1] := 2; l[2] := 2; l[3] := 3; l[4] := 3; l[5] := 5; l[6] := 7

then I print l out it shows

table([1 = 2, 2 = 2, 3 = 3, 5 = 5, 4 = 3, 6 = 7])

and then after i do l := subsop(1 = NULL, l); print(l), it shows

() = ()

## it is a list, and why it shows table here? thanks!

```

```

## they are not sets, but lists....

Hi Doug, Thanks for your reply. They are not sets, but lists.

initially, a := [2, 2, 3, 3, 3, 5] and b := [2, 2, 2, 3, 7]
The real problem of mine is that I want to get the smallest number of 2s 3s or whatever from 2 lists. In this case,

you can see that list a has two '2's and three '3's and one '5'; list b has three '2's, one '1' and one '7',

I want the final list a to be [2,2,3].

My algorithm is : compare b with a with the first element, say here it is 2, if there are the same, print it out, and remove this element (i.e. 2) from a, and break from the inner loop and begin to compare using the second element in b ;

if there are not the same, do no action. and so on... thus ideally eventually i should get [2,2,3], but my code stops after it compares the third '2' in b with [3,3,3,5] ( it already removes the first '2's) due to this subscript error.

In my real code, i didn't use index 10, but used the index not out of bound but i still got this error. Any thoughts?

Also, by the way, do you know how to check the dynamic size of a List??

Thanks!!

## they are not sets, but lists....

Hi Doug, Thanks for your reply. They are not sets, but lists.

initially, a := [2, 2, 3, 3, 3, 5] and b := [2, 2, 2, 3, 7]
The real problem of mine is that I want to get the smallest number of 2s 3s or whatever from 2 lists. In this case,

you can see that list a has two '2's and three '3's and one '5'; list b has three '2's, one '1' and one '7',

I want the final list a to be [2,2,3].

My algorithm is : compare b with a with the first element, say here it is 2, if there are the same, print it out, and remove this element (i.e. 2) from a, and break from the inner loop and begin to compare using the second element in b ;

if there are not the same, do no action. and so on... thus ideally eventually i should get [2,2,3], but my code stops after it compares the third '2' in b with [3,3,3,5] ( it already removes the first '2's) due to this subscript error.

In my real code, i didn't use index 10, but used the index not out of bound but i still got this error. Any thoughts?

Also, by the way, do you know how to check the dynamic size of a List??

Thanks!!

## Not only i want to remove all the elemen...

Hi Alec,

initially, a := [2, 2, 3, 3, 3, 5] and b := [2, 2, 2, 3, 7]
The real problem of mine is that I want to get the smallest number of 2s 3s or whatever from 2 lists. In this case, I want the final list a to be [2,2,3].

My algorithm is : compare b with a with the first element, say here it is 2, if there are the same, print it out, and remove this element (i.e. 2) from a, and break from the inner loop and begin to compare using the second element in b ;

if there are not the same, do no action. and so on... thus ideally eventually i should get [2,2,3], but my code stops after it compares the third '2' in b with [3,3,3,5] ( it already removes the first '2's). due to this subscript error.

In my real code, i didn't use index 10, but used the index not out of bound but i still got this error. Any thoughts?

Also, by the way, do you know how to check the size of a List??

Thanks!!

## Not only i want to remove all the elemen...

Hi Alec,

initially, a := [2, 2, 3, 3, 3, 5] and b := [2, 2, 2, 3, 7]
The real problem of mine is that I want to get the smallest number of 2s 3s or whatever from 2 lists. In this case, I want the final list a to be [2,2,3].

My algorithm is : compare b with a with the first element, say here it is 2, if there are the same, print it out, and remove this element (i.e. 2) from a, and break from the inner loop and begin to compare using the second element in b ;

if there are not the same, do no action. and so on... thus ideally eventually i should get [2,2,3], but my code stops after it compares the third '2' in b with [3,3,3,5] ( it already removes the first '2's). due to this subscript error.

In my real code, i didn't use index 10, but used the index not out of bound but i still got this error. Any thoughts?

Also, by the way, do you know how to check the size of a List??

Thanks!!

 Page 1 of 1
﻿