Jabz

3 years, 96 days


These are questions asked by Jabz

Hi all,

The following is my 'poor' attempt at coding the n by n queen problem. I am an amature programmer. The codes individually seem to work fine but when i put it all together it dose not seem to work and it does not produce an error so i don't know where its going wrong.

I would really really appriciate greatly if someone can help me please.

thank you in advance.
 

Hi
 

i am trying to code a proc that tells me when a certain function is better than another. My proc works fine for functions that have a single crossing point but it does not seem to work for inputs that have multiple crossing points.
 


Hi,
I want to shift  the first two elementsof a list to the end and this is what i've coded i have to run the proc twice. Is there a simpler way of doing this??? for example

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

switch2:=proc(N)
local y,li:
li:=N:
for y from 1 to nops(li)-1 do
(li[y],li[y+1]):=(li[y+1],li[y])
od:
li;
end proc:

Is there another simpler way of doing this aswell??

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

switch:=proc(odd)

Is it possible?

February 11 2010 by Jabz 433 Maple

Is it possible to create a procedure in maple that works out how many 'queens'  can be placed on a board size n * n and plot some sort of a matrix which displays the positions using 1's and 0's without conflicting with each other?? What i mean by 'is it possible' is would it be a efficient algorithm (if it is possible)  or a very long algorithm containing of complex maple code?

sorting

February 10 2010 by Jabz 433 Maple

Hi i am trying to code a procedure which sorts a list such that the smallest element is the first element and the largest element is the second elemnt then the next smallest element is the third element and the next largest element is the fourth element. For example:

 

L:=[ 2, 3, 5, 2, 7, 9 ]:
 

sorted:= [ 2, 9, 2, 7, 3, 5] :
 

this is what i have coded so far how do i make the process continue??
 

Big O of a procedure

February 02 2010 by Jabz 433 Maple

How do i chek what order my procedure is . For example Bubble Sort is O(n^2) merge sort is O(n log n). I have a procedure but i do not know how to chek the order?

Primality Testing??

January 24 2010 by Jabz 433 Maple

I am trying to code a naive method for checking if a number is prime. where it checks if a number is prime by checking if a number 'k' divdes into n.

 

Hi i am trying to code the Merge sort algorithm in maple but i've reached a point where i can't progress further. Any assistance would be greatly appriciated.

This is what i have done so far

FIRST ATTEMPT:

restart:
with(ListTools):
L := rtable(1..6,random(1..50));
n:=convert(L,'list');
E:=[LengthSplit(n,nops(n)/2)];

for j from 1 to nops(E) do
F:=[LengthSplit(E[j],1)];
d:=[]:
smallest:=op(F[1]):

for i from 1 to nops(F) do
if op(F[i]) < smallest then

Is it some kind of a malware or an advertisement virus of some sort?

cocktail sort

December 27 2009 by Jabz 433 Maple

Hi merry xmas and a happy new every1.

I am trying to code the cocktail sort algorithm into maple but having some difficulties.

i coded bubble sort but cnt seem to code the cocktail sort any help would be appricited.

 

restart:
l:=[5,4,3,2,1]:
for j from 1 to nops(l)-1 do:
for i from 1 to nops(l)-1 do:
if l[i] > l[i+1] then
d:=l[i]:
l[i]:=l[i+1]:
l[i+1]:=d:
fi:od:od:
print(l);
 

diagonally dominant matrix???

November 22 2009 by Jabz 433 Maple

How do i code into maple to check if a matrix is diagonally dominant?

s:=Matrix([[2,1,2],[-5/4,-5,5/4],[21/5,-14/5,7]]):
 

s[1,1];

2

s[1,2] + s[1,3];

3


this is what av done so far but i dont think its correct

for i from 1 to 3 do
for j from 1 to 3 do

s[i,i] <= s[i,j] + s[i,j+1]

od:od:

Time[real] keeps on changeing????

November 20 2009 by Jabz 433 Maple

I have a problem i am trying to see how long it takes for my program to give a solution but the time keeps on changeing everytime i press enter. I can't seem to understand why?
 

I was wondering is it possible to make a procedure in maple that works out the Bisection, tri section using a single procedure?

So for example for the bisection method c : =( a + b ) /2
fAnd  trisection method c : = ( 2 * a + b) / 3 and d : = (2 * b + a )/3 etc

For n th section L [ i ] :=( i*b + a ( n - i ) ) / n:
` i ` represents the position in a List.

e.g (Not sure if it would work in a proc)
Trisection
n:=3:
i:=1:
L:= [ c , d ]:

L[ 1 ]:= ( b + 2 * a ) / 3:

Initial conditions,     x(0)=2, D(x(0))= -2

D= differential

D2x +5Dx +4x = delta( t - 2 )
 

 

I want to check my answer in maple but i cant get it to work.

 

This is the answer i gt by hand

 

x = H( t - 2 ) ( ( e ^ - 4 ( t - 2 ) + e ^ - ( t - 2) ) / 3 ) - 4 / 3 e ^ - 4 ( t - 2 ) + 10 / 3 e ^ - ( t - 2 )

 

programming help needed

November 06 2009 by Jabz 433 Maple

I need help on turning this code into a procedure and what changes do i have to make  so it works like the gauss-seidel algorithm. I have tried many times on my own but can't seem to get my head around it. Any help would be appriciated greatly.
 

 

1 2 Page 1 of 2