Jabz

433 Reputation

5 Badges

14 years, 116 days

MaplePrimes Activity


These are replies submitted by Jabz


 

M:=Matrix([[1,2,3],[2,3,4],[3,7,5]]);
                                   [1    2    3]
                                   [           ]
                              M := [2    3    4]
                                   [           ]
                                   [3    7    5]

what if i wanted to work out the diagonal from the other side. For example

 

3+3+3 = 9
2+2 = 4

1 = 1

4 +7 = 11

5 = 5

Is that possible?
The func with(MTM):=Diag works it out the normal way i want it to do it the other way.
1+3+5 = 9 -> diag(m)
2+4=6 -> diag(m,1)
2+7= -> diag(m,-1)
 

That's fantastic thank you

That's fantastic thank you

That's a great technique and much more efficient than my proc. I thot it only applies to matrices (symmetry,rotation etc).

 

Thank you


 

That's a great technique and much more efficient than my proc. I thot it only applies to matrices (symmetry,rotation etc).

 

Thank you


 

oh sory. I was trying to make a procedure which swaps the first two elements in the list and shift the third element to the end of the list. My procedure does this but it's quite long. I was wondering if it could be done more efficiently

 

L:= [ 1, 2, 3, 4, 5, 6] = > [ 2, 1, 4 , 5, 6, 3]

oh sory. I was trying to make a procedure which swaps the first two elements in the list and shift the third element to the end of the list. My procedure does this but it's quite long. I was wondering if it could be done more efficiently

 

L:= [ 1, 2, 3, 4, 5, 6] = > [ 2, 1, 4 , 5, 6, 3]

I tried looking for it but its not in the database of maple 12's help?

I tried looking for it but its not in the database of maple 12's help?

If i code this in maple would it work for any size grid or will it only work an 8 by 8 grid??
 

  1. Divide n by 12. Remember the remainder (n is 8 for the eight queens puzzle).
  2. Write a list of the even numbers from 2 to n in order.
  3. If the remainder is 3 or 9, move 2 to the end of the list.
  4. Append the odd numbers from 1 to n in order, but, if the remainder is 8, switch pairs (i.e. 3, 1, 7, 5, 11, 9, …).
  5. If the remainder is 2, switch the places of 1 and 3, then move 5 to the end of the list.
  6. If the remainder is 3 or 9, move 1 and 3 to the end of the list.
  7. Place the first-column queen in the row with the first number in the list, place the second-column queen in the row with the second number in the list, etc.

 I just want to create a simple procedure that produces one of the unique solutions.

If i code this in maple would it work for any size grid or will it only work an 8 by 8 grid??
 

  1. Divide n by 12. Remember the remainder (n is 8 for the eight queens puzzle).
  2. Write a list of the even numbers from 2 to n in order.
  3. If the remainder is 3 or 9, move 2 to the end of the list.
  4. Append the odd numbers from 1 to n in order, but, if the remainder is 8, switch pairs (i.e. 3, 1, 7, 5, 11, 9, …).
  5. If the remainder is 2, switch the places of 1 and 3, then move 5 to the end of the list.
  6. If the remainder is 3 or 9, move 1 and 3 to the end of the list.
  7. Place the first-column queen in the row with the first number in the list, place the second-column queen in the row with the second number in the list, etc.

 I just want to create a simple procedure that produces one of the unique solutions.

Ok . that looks  very complecated to code lol. i want to code a similar program to this but i dnt really know how to go about it (still an amature at programming). I just want to create a program that displays a n*n matrix with ' n  ' number of   'Q''s on board. For example for a 4*4 matrix it displays 2 uniqe matrixes with for 4 queens  Q ' s (representin the number of qeens) and '0' 's (empty spaces)  or it displays a matrix with any unique solution and prints the total number of unique solutions. Any help would be greatly appreciated.

Thanks  in advance

 

Ok . that looks  very complecated to code lol. i want to code a similar program to this but i dnt really know how to go about it (still an amature at programming). I just want to create a program that displays a n*n matrix with ' n  ' number of   'Q''s on board. For example for a 4*4 matrix it displays 2 uniqe matrixes with for 4 queens  Q ' s (representin the number of qeens) and '0' 's (empty spaces)  or it displays a matrix with any unique solution and prints the total number of unique solutions. Any help would be greatly appreciated.

Thanks  in advance

 

I asked the same question earliar this week. It was a question asked by the lecturer as an exercise (nothing major). The procedure has to be explained completely tho. So a code is useless if it is just used from any of these forums 'copy and paste' not explained fully (Only the creator of the program can explain their program step-by-step). The reason why i asked this question(and other questions) was because i am not very 'maple literate' and do not know how to start coding and get confused with simple commands others find really easy( loops,iteration etc), i see how programmers(such as your self) code it  and then I make my own procedure and when i get stuck i get idea's from the procedures you  have created. The only time i use these forums is when i am really stuck and do not have any other option.

The lecturer has a very strict policy of copy n paste of codes which results in a automatic fail and every procedure  has to be explained step-by-step it dose not matter if a procedure works or not if you cannot explain how you coded it you get no marks. simple. I really hope you do not stop helping (Doug) because you have helped me understand so much and you are definately one of  the best helper's on this site. Most people don't even reply on student forums so thank you .I hope you continue with your kind support.

I asked the same question earliar this week. It was a question asked by the lecturer as an exercise (nothing major). The procedure has to be explained completely tho. So a code is useless if it is just used from any of these forums 'copy and paste' not explained fully (Only the creator of the program can explain their program step-by-step). The reason why i asked this question(and other questions) was because i am not very 'maple literate' and do not know how to start coding and get confused with simple commands others find really easy( loops,iteration etc), i see how programmers(such as your self) code it  and then I make my own procedure and when i get stuck i get idea's from the procedures you  have created. The only time i use these forums is when i am really stuck and do not have any other option.

The lecturer has a very strict policy of copy n paste of codes which results in a automatic fail and every procedure  has to be explained step-by-step it dose not matter if a procedure works or not if you cannot explain how you coded it you get no marks. simple. I really hope you do not stop helping (Doug) because you have helped me understand so much and you are definately one of  the best helper's on this site. Most people don't even reply on student forums so thank you .I hope you continue with your kind support.

1 2 3 4 5 6 7 Page 2 of 9