out of bound cases...

i got some trouble when i tried to build large matrix. in my case, notification error out of bound appear when looping stop at 9 from 24 repeatation.

and this is my looping command:

the result of the script was:

how to write better for passing parameter which is...

for example

func1 := proc(system1)

for i from 1 to 100 do

solve([system1[1], system1[2]],[x,y]);

od:

end proc:

func1([diff(y,t) = data[i+t+1], diff(x,t) = data[i+t+1]])

i is depend on the for loop inside a function, but woud like to pass this system into a function with i

this will cause error

how to write better for passing a system as parameter using variable inside a function?

Select part from list...

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

Varying an index in a variable name...

I am writting a program that needs to rename variables by increasing the second index of a variable, all the variables will be named y[something,number].

e.g.

y[a,2]->y[a,3]

If I was doing this outside maple I can see how I could use regular expressions, but I can't see how to do it in maple

Shifting between block...

I have the following command （credit to @Carl Love ), this command will do certain bit shifting with the next block, and the last block will shift with the first block.

B:= Matrix([[0,0,1,1,0,0,1], [0,0,1,1,1,0,0],[0,1,0,1,0,1,0], [1,0,0,1,1,1,0]]):
Bnew:= copy(B):
Bnew[[4,1,2,3], 3..5]:= B[.., 3..5]:
Bnew;

May i know any command can help to reverse the shifting position between the block？

for example,

original block  [0,0,1,1,0,0,1], [0,0,1,1,1,0,0],[0,1,0,1,0,1,0], [1,0,0,1,1,1,0]

i need to shift the 3..5 position of block 1 and change to the 5..3 position of block 2.

Example:

After shifting,

Bnew=[0,0,1,1,1,0,1],[0,0,0,1,0,0,0],[0,1,1,1,0,1,0],[1,0,0,1,1,1,0]

Any command can help to solve? thank you in advance.

Nested for loops...

So, I am working in a partial differeital equations course and we are doing image processing. I am taking an image and pixel by pixel applying the heat equation to smudge out noise. I created a for loop for the equation and it works, I need to itterate it over and over again. Here is my code:

for t from 1 to 20 do

for j from 2 to 149 do

for k from 2 to 149 do

`tile2__j,k`:=dellT/(h^(2))*(`tile__j+1,k`-4*`tile__j,k`+`tile__j-1,k`+`tile__j,k-1`)+`tile__j,k`

end do

end do

for m from 2 to 149 do

for n from 2 to 149 do

`tile__m,n`:= `tile2__m,n`

end do

end do

t := t+1

end do

Sorry, I could not get the Maple Math editor to work so I just copied my code. Apologize. I keep getting the error "Error, Invalid loop statement termination." Help?

How do i sum elements of a matrix modulo a number....

Ok so i have a matrix M filled with complex roots of unity. I want to execute the following code but it seems to be failing to do so correctly

t:=exp(2 Pi I/11);

m := (i, j) -> M[(i mod 11)+1, (j mod 11)+1] ;

Something is wrong with my indexing of the matrix . or when the mod procs.

How to extract matrix A and vectors x,b from displ...

Hi, the display function in the simplex package gives us a nice breakdown of the form Ax<=b, but how do we extract the individual elements, i.e. the matrix A and vectors x and b? Normal indexing into the expression doesn't work, i.e. if for some set of constraints of the form 2x+3y<=21 we enter

res:=display(constraintSet);

this gives us a nice expression, but res[1] etc. doesn't work as we might hope (i.e. by returning the matrix A).

Maple index help...

Hi, i am new to Maple. I was trying to solve some problem and came up with the following difficulty:

When i give input

ai=(1+ki)/(1-ki);

and then do a_1 it gives the proper output as

(1+k1)/(1-k1);

But whenever i try to do

ai,j=(ki-kj)

indexing of matrices and other rtable structures...

I often have large matrices and have to grab only every nth column or row (for plotting

for example). So far I've been doing it this way:

`nthColumns:=proc(v_m, v_n)  `
`v_m[..,[seq(i, i=1..rtable_size(v_m)[2], v_n)]]`
`end;`
`nthRows:=proc(v_m, v_n) `
` v_m[[seq(i, i=1..rtable_size(v_m)[1], v_n)],..]`
`end;`
`A := LinearAlgebra:-RandomMatrix(20, 20, outputoptions = [datatype = float[8]]);`

is there a member() function for Vectors ?...

Hi there,

I have a piece of code that uses lists instead of vectors and recently, it crashed, it ran out of memory. Long story short, if I use vectors instead of lists, the performance is much better and optimal (this I knew but I was lazy to translate all my code). However, there's one single line that I cannot efficiently translate and it's the one that uses the function member(). Before, I had the following (it's an oversimplification of my code in order to easily discuss it in here):

This does not make sense

by: Maple 16

This does not make any sense to me :-)

restart:
A := Matrix([[seq(i, i = 1 .. 10)], [seq(i, i = 11 .. 20)], [seq(i, i = 21 .. 30)]]):
A[.. -1,..] ;
A[.. -2,..] ;

You would assume that A[..-1,..] would remove the last row but that is not the case!
Instead you have to do A[..-2,..] he he it seems a bit odd!

How can I retrieve the indices of specific values ...

I have a matrix (M) and it has both 0 and 1 as entries. I want to have a sequence/list of all indices associated with the entries equal to one (the others are irrelevant to me). I can use a nested for loop with an if statement, but I find that the easy way out and not very pretty. Is there is more sophisticated way, hopefully faster way of achieving this (using sequences, attributes, select/remove)?

Example:

`M:=Matrix([[1,1,0],[0,0,1],[1,0,1]]);`

Creating and displaying arrays with 0 based index...

Hi, I am a student (with some programming background) in desperate need of help.

How can I create a zero based array in Maple and display it?

I am having all kinds of trouble creating vectors and arrays in Maple (the help is cryptic). This is the closest I got:

>F := Array(0 .. 4, 0 .. 4, [0])

That creates a 5x5 array of zeros, with the upper left element indexed by (0,0) (right?).

How do I display the array?