Items tagged with list

Feed
Also available: list

Hi Guys,

 

got my last Problem solved :) Now i do have a new one...

restart; with(RealDomain); with(CodeGeneration); with(ExcelTools); with(plots);
dx1:=133;
dy1:=132;

n := 1; 
for i to 256 do 
for j to 256 do 
r := evalf(sqrt((i-dx1)^2+(j-dy1)^2)); 
Ints := R0[i, j]; 
IntsR[n] := [r, Ints]; 
n := n+1 
end do; 
end do; 
IntsR := [seq(IntsR[i], i = 1 .. n-1)]

The list IntsR consists of unsorted values doublets. Now it would be nice to get some sort of mean value of my Ints over r.  Didnt really find a solution for it until now... do you have any hint?

Experts,

This may sound like a dumb question, but i'm seeking a procedure to do it better.
 

``

 

with(combinat, setpartition) :
P := [$2..5] :

Tours := setpartition(P);M:=nops(Tours)

[[[5], [2, 3, 4]], [[2], [5], [3, 4]], [[3], [5], [2, 4]], [[4], [5], [2, 3]], [[2], [3], [4], [5]], [[2, 3, 4, 5]], [[2, 5], [3, 4]], [[2], [3, 4, 5]], [[2, 4], [3, 5]], [[3], [2, 4, 5]], [[2, 3], [4, 5]], [[4], [2, 3, 5]], [[3], [4], [2, 5]], [[2], [4], [3, 5]], [[2], [3], [4, 5]]]

 

15

(1)

 

number of elements in each 'group'

seq(nops(Tours[i]),i=1..nops(Tours))

2, 3, 3, 3, 4, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3

(2)

 

i need to add 1 to each 'subgroup' : These are the first two:

[[[1,op(Tours[1,1])],[1,op(Tours[1,2])]],[[1,op(Tours[2,1])],[1,op(Tours[2,2])],[1,op(Tours[2,3])]]]

[[[1, 5], [1, 2, 3, 4]], [[1, 2], [1, 5], [1, 3, 4]]]

(3)

 

I need to add 1 to each 'subgroup' in a more automatic way.

``


 

Download add_1.mw

 

To select a piece from a list, for example:

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

I want to get the list piece from second place to fifth place: [2,3,4,5].

Is there a function?

Thanks

I have a list of functions which looks like this:

RR:={F[l, m-2, n-1], F[l, m+2, n], F[l, m+2, n-1], F[l-1, m+1, n-2], ...}

I wish to remove the first and second arguments from the functions, so only leaving the third argument containing the n's. I then wish to group these remaining terms together to shorten the list. i.e.

RR:={F[n-1], F[n], F[n-2]}

I have used the 'subsop' command with 1 and 2 specified as NULL in a loop, but I was wondering if there is a better way to do it? I like to avoid loops where possible and use some inbuilt Maple magic to make it tidier and (usually) more efficient.

-Yeti

 

I have to generate a random list of 30 elements and i have two variables: s, which is a counter for all the list which have got at least a repetition and variable n, for each list who has not repeated values, as in the code below.

I don't understand why, when i sum s and m i get a value which is not 100, why?

for i by 1 to 100 do
		list:=RandomTools[Generate](list(integer(range = 1 .. 365), 30));
		if numelems(FindRepetitions(lista)) >= 1 then
			s:=s+1;
		
		else		n:=n+1;
				
				end if;
				end do;

 

I have a list of univariate polynomials

P:=[x^2-7*x+10, x^2, x^2+2*x+1]

How do I get the gcd of all of these?

It doesn't like it when I do the following:

igcd(P)

 

Thanks

You know we can create readonly Matrix in Maple, Is it possible to create readonly list in Maple?

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

list:=[13,16,16,29,34,33,33,12,22,26,25,25,25,11]:

How could I remove just one 25 from the list? 

Hello,

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.

Hi all, I have a problem someone can help me

F := {a^2, b^2, c^2, ab, bc, ca}

G := [a^2, b^2, c^2, ab, bc, ca]

How to convert F to G and G to F ?

Thanks 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.

List.mw

Regards

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).

Hey,

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

restart:

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

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

(1)

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

plot(expr)

 

 

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

 

[]

(2)

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]

(3)

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

[false, true]

(4)

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

 

[2]

(5)

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

 

-.2688724573

(6)

expr; #test

 

0.

(7)

 


Download select_solution.mw

Thanks!

Honigmelone

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

1 2 3 4 5 Page 1 of 5