bastorer

15 Reputation

3 Badges

11 years, 96 days

MaplePrimes Activity


These are replies submitted by bastorer

@Carl Love 

Interesting, it must be the Copy from LinearAlgebra. I had thought that since by with(ArrayTools) came after with(LinearAlgebra) that the ArrayTools version would `win', is that not the case?

@Carl Love 

Hmm, good point. Using copy recursively is one way around that. Unfortunately that could mean a lot of calls to copy.

restart;
Array1 := Array([Array([1, 2]), Array([3, 4])]);
Array2 := copy(Array1);
Array2[1] := copy(Array1[1]);
Array2[2] := copy(Array1[2]);
Array1[1][1] := 11;
Array1;
Array2;

@Thomas Richard 

 

Unfortunately Copy(Array1,Array2) doesn't seem to do anything with nested arrays, but Array2:=Copy(Array1) does.

Thanks!

@Preben Alsholm 

 

Thank you, yes, that works perfectly. Writing copy(Array1, Array2) doesn't work, but Array2:=copy(Array1) does.

Page 1 of 1