Question: Strange behavior when copying a vector

Dear Maple Users

I have encountered some strange behavior when trying to copy a vector:

In the first section I define a vector a and try to copy that vector and assign it to an variable b. Then changing the first coordinate in the copied vector b actually change the original vector as well. I found that behavior rather counter-intuitive. Is it working something like a Pointer in certain programming languages? I mean no extra memory is allocated for the "copy"?

In my second section I am trying to do the job in another way, using the package ArrayTools. Doing it this way seems to work the way I want: Only the copy b is changed. However something really disturbing happens, when I try to assign a value to the variable y. In writing the actual values of the vectors a and b, the value of y isn't substituted in b only a.  

 I am rather confused. I hope someone can bring some light into the issue!

Regards,

Erik

Please Wait...