## 155 Reputation

12 years, 150 days

## Sort list of lists...

Maple 2015

Hi,

My question is related to this one http://www.mapleprimes.com/questions/37447-How-Can-I-Sort-A-List-Of-List-According

but not exactly the same.

Suppose I have lists

***

f[1]:=[1,3,2];
f[2]:=[2,1,3];
f[3]:=[1,2,3];
f[4]:=[2,3,1];
f[5]:=[3,2,1];
f[6]:=[3,1,2];

***

The aim of sorting is first, arrange by ascending order of the first variable, then the second, then the third.

I could program manually by explicitly comparision, is there any robust way in maple can do it (possibly a few build-in function)?

Thank you very much!

## Determine dimension of array...

Maple 2015

Hi,

I have the following input in order to obtain the dimension of an array, by means of the values has been assigned

with(ArrayTools):
with(LinearAlgebra):
f[1]:=1:
f[2]:=2:
nops(f);
Size(f);
Dimension(f);

The result is

---

1
[ 1 1 ]
Error, invalid input: LinearAlgebra:-Dimension expects its 1st argument, A, to be of type {Matrix, Vector} or coercible via `~Simplify`, but received f

---

I cannot get number "2", which is expected. Is there any way to obtain that? I looked for help and mapleprime, without any simple solution ......

Thank you very much!

## Is that element of array?...

Maple 2015

Hi,

Suppose I have an array

A[1]:=a;

A[2]:=b;

A[3]:=c;

I would like to check if an element, e.g. "c", belong to this array. I can contrsuct a "for... end do" command to compare each element and/or construct a subroutine.

Is there any build-in function in maple can do that? Perferably return true/false

Thank you!

## Generating all permutation of an array...

Maple 2015

Hi,

Excuse me, I have the following code

###########################

with(combinat);
with(LinearAlgebra);
f:=([1,2,3]);
permute(f);

n:=3;
g:=array(1..n);

for i from 1 to n do
g[i]:=i;
end do;

permute(g);

###########################

The output ends up with

Error, (in combinat:-permute) 1st argument must be a list, set or a non-negative integer

It seems that maple will not generate permutation of g... How to generate the permutation of array g? i.e. by assigning all variables automatically.

Thank you very much!

## Substract location in the maximum of a f...

Maple

Hi,

I have the following input

f:=x^2*exp(-1.2*x);
maximize(f, x=0..100,location);

Maple gives me the location is x=1.25. However, how should I do to obtain this position?  If I write

a:=maximize(f, x=0..100,location);

Seems it do not work :(

I may try fsolve at the maximum value, but it seems to be awkward..

Thank you very much!

 1 2 3 4 5 6 7 Last Page 2 of 10
﻿