Items tagged with list

I have a list of sample values and I want to remove just one maybe two of them. 


How could I remove just one 25 from the list? 


I have a list of equations. I would like to display this list in column.
Problem : as each term of my list is an equation, i can not transform my list in a vector.
How can I do to display a list of equations in column ?

Thank you for your help.

Hi all, i have a problem someone help me.

Define per(f(a,b,c)) = {f(a,b,c), f(b,c,a), f(c,a,b)}. I want to write a function removePer() that removes the permutations, example:

ds := {a, b, a^2, b^2, c, c + 2a, a - b, c^2, a + 2b, b + 2c}

then removePer(ds) return {a, a^2, c + 2a, a - b} because per(a) = {a, b, c}, per(a^2)  = {a^2, b^2, c^2} and per(c+2a) ={a+2b, b+2c, c+a}. Note that removePer(ds) can return {b, a^2, c + 2a, a - b} or {c, a^2, c + 2a, a - b}, ...  but just one result.

ds := {ab, bc, a - b^2, b - c^2, a^2, c - a^2},

then removePer(ds) return {ab, a - b^2, a^2}.

Thank you very much.

Dear All

For six parameters, I have corresponding list of their values and there are eight values for every parameter. I need to put these values in a formula to obtain a list of output values. There are two formulas one for 'P' and next is for 'RL'. I have used value of 'P' to calculate value of 'RL'. There are some complex number too, for which I have used modulus and final value is calculated by using 'evalf', but this command is not returning proper values for list as required. But this command works fine when I use single value from every list to calculate RL.

The Maple sheet attached herewith.


I am new to Maple.

If i have a list (or a table) A:=[[1,2],[3,4],[5,6]

how can i split it into two lists B:=[1,3,5] and C:=[2,4,6] ? (all the 1st numbers in one list, and all 2nd numbers in another list).


I want to solve this equation and looking at the plot there are at least 3 solutions. I want the greatest/smallest negative solution. Unfortunately using solve with assumptions produces no results and solve without assumptions only finds two solutions.

Can you please help me?

#select greatest negative value from solution


expr:= ax*cos(lambda)+ay*sin(lambda)-(a+b*lambda)



ax:=1:ay:=2:a:=0.5:b:=0.25: #examplanatory values




assume(-2*Pi<lambda,lambda<0): #does not work


sol_lambda:=[solve(expr=0,lambda, useassumptions)];# returns empty list even though without assumption one solution is found

Warning, solutions may have been lost




sol_lambda:=[solve(expr=0,lambda)]; #returns only two solutions even though looking at the plot 3 are there

Warning, solve may be ignoring assumptions on the input variables.


Warning, solutions may have been lost


[2.190357220, -.2688724573]


sol_l_v:=evalb~(sol_lambda<~0); #dirty workaraound

[false, true]


sol_l_add:=[ListTools:-SearchAll(true,sol_l_v)] ; #this seems overly complicated




lambda:=sol_lambda[sol_l_add[-1]];  #to select the last entry




expr; #test








how to convert (a+b)^3 to a list [a+b, a+b, a+b]?

for example

(a+b)^2 to [a+b, a+b]

how to count how many terms or items are equal when compare two lists of polynomial terms when length of two list may not be equal

I have this lists and I have written a program to process these lists and produce only the lists that certisfy a certain condition. Instead of printing these lists, I want just the total number of the lists produced. How can I do these? The only thing I can think of now is to append the lists in an Array and get the number of elements in the array, but this will be very inefficient since I am looking at a very big number here.


Any help is appreciated,




I would like to thank everyone who takes their time to respond to posts on this page. I have another question.

I have about 11 trillion lists that are of the form A shown below. The lists ofcourse have more elements than A (about 50 elements). What I want is to compute this value I call f, and the moment this value is found to be 1, we stop, and if all the values of f are 0, then we print(A). Here is my code, which has a problem and doesn't give me the result I want. How do I modify this so that if any value of f=1, then we stop, elif no 1 is found, we print just one value for A and not for every 0 produced?

A := [[1, 2], [1, 7], [5, 6], [1, 6], [1, 9], [6, 5], [9, 1], [2, 1], [7, 1], [6, 1], [5, 6]]; n := 9;
for i to n do for j to n do for k to nops(A) do if [i, j] = A[k] then a := Search([i, j], A); b := Search([j, i], A); if a < b then f := `mod`(b-a, 2); if f = 1 then break else print(A) end if end if end if end do end do end do;

Presently what I am doing is to Append all values of f into an Array and check that 1 is not an element of that Array. This is however very inconvenient since my lists are huge, and they are many, and we do not have to cpompute all the values of f once we come across a 1. Other than this, is there a way I can make my program run faster? Any suggestions are welcomed.




I have this out put, let me put it simply as a  single variable(call it A) having multiple outputs such that when i print(A) I get         a
How do i put all the values in a single list to get [a,b,c,d]?

This is what I did: aa:=[]: for i in A do aa:=[op(aa),i]:od:
The output is [a]

How do I get [a,b,c,d] without doing a lot of op???



I have this 5 by 2 matrix, and I want to form  lists of lengths 5, whereby the ith entry in my list should be any of the elements from the ith row of the matrix. How do i get all the possible lists? (I am expecting a total of 32lists, each of length 5):


First question is, given a list of some positive integers, how can I normalize this list? Normalize here is in the sense that, for example, if 

L := [1,3,4,4,5,7,7,7,8]

then there really are only 6 different integers appear, so I would like to assign each part an integer from 1 to 6 in ascending order. So 1 becomes 1, 3 becomes 2, 4 becomes 3, 5 becomes 4, 7 becomes 5 and so on. Normalized list will be

NormalizedL := [1,2,3,3,4,5,5,5,6]


Second question is given a list, let's say [1,3,1,3,2,2,4,4], how can I normalize it in a similar way but now we assign each integer upon occurrence of a part. So [1,3,1,3,2,2,4,4] will be [1,2,1,2,3,3,4,4]. This is necessary for me because lists have repeating parts. 

Another example will be [2,4,4,1,2,2,3,3] will be [1,2,2,3,1,1,4,4]. 

Thank you 

Dear Community,

How could I specify a list of random colors using some kind of an RGB function, which then could be used in another command for coloring? I think of something like this:

myColors := [ seq( RGB ( [rint(0,255) , rint(0,255) , rint(0,255)] ) , j = 1 .. 20 ) ] :

which does not work of course :-)  This should produce me a list of 20 random colors.  What would be the right RGB color function?

Tx for the kind help in advance

best regards


I have the following command.

message := `Kajian ini mempunyai tiga objektif pertama seperti yang ditunjukkan dalam bahagian 1.11. Objektif tersebut harus`;

m := convert(message, bytes);

block := map(convert, m, binary);
block := map2(nprintf, "%08d", block);
block := map(proc (t) options operator, arrow; [seq(parse(convert(t, string)[i]), i = 1 .. length(convert(t, string)))] end proc, block);

block := [[0, 1, 0, 0, 1, 0, 1, 1], [0, 1, 1, 0, 0, 0, 0, 1], [0, 1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0, 0, 1], ........]

for i to l do
for j from 3 to 7 do
block[i][j] := 1-block[i][j];  //used to flip bit in between 3rd to 7th bit in a block
end do;
c_block[i] := block[i];
end do;
c_block1 := [seq(c_block[i], i = 1 .. l)];

Error, assigning to a long list, please use Arrays

May i know how to solve this problem? I need to change some bit in a list but receive error when there is more than 100 elements in a list. Thank you.

1 2 3 4 5 Page 1 of 5