Vic

50 Reputation

5 Badges

6 years, 349 days

MaplePrimes Activity


These are replies submitted by Vic

Thanks Carl, though putting them in a list is a very bad idea since I am using large data and the outputs prints in column form, here is an emaple for i from 1 to 1o do for j from 1 to 10 do print(cat(i,j)):od:od: My lists are however bigger and more complicated than this.

So print(A) above gives me four matrices. Then I do the same thing for another matrix I called B, and print(B) gives me another set of 4 matrices, giving a total of 8 matrices. For each matrix, I want to do the same thing, what is the best way to do this? Is it possible that I can rename them to some thing called C for example,  where print(C) gives the 8 matrices? I am thinking of putting all the matrices in an array and getting them one by one by use of indexing, but I think there is a better way to do this.

I am sorry my questions are basic, I am a beginner.

Thanks. Vic

@Kitonum Thanks, that was helpful.

Vic.

@Carl Love Thanks, that worked perfectly well.

@Vic Hi,

So the cartesian product worked very well. But as the values increases, my number of outputs gets bigger and bigger (the number grows exponentially, getting into millions very very quickly). I however need to read through these outputs, Get position of each element and check if they satisfy a certain condition. I am aiming at producing an efficient code that takes less time and space. Do you think having them as lists is a bad idea? should I use Array? Is there away that I could get the cartesian products one at a time and work on them without them taking up huge memory space?

Thanks,
Vic.

@Carl Love Thanks guys.

I am solving a system of linear equations as the one above, and I want to print something else if the solution exist and do nothing is the solution doesn't exist, how do i do about this?

Sorry about that.

I have a series of lists. My code is complicated, but I will try to simplify it.
One of the lists is for example B. Here is what I am doing with B.


B:=[02,03,13,14,24,20,30,31,41,42]: T:={seq(e,e=0..4)}:
for i from 0 to 4 do V:={i,(i+1)mod 4,(i-1)mod 4}: K:=T minus V:
for k in K do A:=SearchAll(cat(j,i),B)-SearchAll(cat(i,j),B):od:od:
  So A here prints in a coloumn, yet I want the values in a listy so that I can check if it satisfies some condition.

Thanks,
Vic






A is not a sequence. print(A) gives a
                                                 b
                                                 c
                                                 d


I want this output as [a,b,c,d]

@Carl Love Thanks so much Carl. This was very helpful. I am a beginner and therefore struggle a lot. Your answer made me read about cartprod and i found that i didn't have to convert my list of lists into a matrix!
Problem solved.

Thanks again.

Hi Carl,

Thanks, though it isn't working for me. I am using maple 2015 and I get this error, `Iterator` does not evaluate to a module. Is there a way to fix this?

Vic.

1 2 Page 2 of 2