bastorer

15 Reputation

3 Badges

11 years, 122 days

MaplePrimes Activity


These are questions asked by bastorer

Hello,

I'm trying to evaluate an integral (code snippet and screen-shot included below) assuming that certain parameters and integers. Using assume statements the integral evaluates to 0. However, if I evaluate the integral for a specific set of integers, the integral evaluates as non-zero.

Can anyone clarify why the two int statements return different values?

Thanks!

assume(K::integer);
assume(L::integer);
assume(M::integer);
int(sin(K*x)*sin(L*x)*cos(M*x), x = 0 .. Pi);
     returns: 0
int(sin(14*x)*sin(2*x)*cos(12*x), x = 0 .. Pi);
     returns: Pi/4

Hello,

As a means of encoding information, I'm working with nested array objects (I had originally used lists, but they became too large and Maple suggested that I use arrays). The nesting should be at most four deep, but the nested arrays can have varying lengths. In order to work with the arrays, I have a series of procedures that manipulate a given array and update the existing array object to contain the result. The issue that I have is that one of my procedures needs to simultaneously use both the original array and a modified version of the array, but once the modification is performed, the original version no longer exists.

Ultimately, my issue boils down to this: is there a clean (or messy, I'm not picky) way to duplicate an array so that there are two copies of the array in memory? Just writting Array2 := Array1 just creates another pointer to the same array in memory from what I can tell, so that doesn't work. There is a function copy, but it doesn't seem to work on nested arrays. 

For example, running the following does not modify Array2.

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

Indeed, neither does

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

Unfortunately, the latter case would seem to mean that I can't just write a procedure to recurse through my layers of arrays and copy piecewise either.

Thanks in advance for any help.

Page 1 of 1