Jimmy19001

128 Reputation

2 Badges

15 years, 175 days

MaplePrimes Activity


These are questions asked by Jimmy19001

Below is my attempt at a cocktail sort, there are two lines of code missing as i am unsure as what to put there. I think the rest is correct.

Please check and see if you can spot what i need to include.

I have programmed a bisection procedure below, and i was just wondering how i would change this into a recursive version of the method. I don't really understand what is ment by recursive?

bisection:=proc(f,X,Y,Z)
local a,b,c,d;
a:=X:
b:=Y:
d:=Z:
while(abs(b-a)>d) do
c:=(a+b)/2:
if sign(f(c))=sign(f(a)) then a:=c else b:=c
fi:
od:
print(evalf((a+b)/2)):
end proc:

Many thanks!!!

If i have two lists L:=({1,2,5},{3,4,6},{1,2,3}) and G:=({2,1,3},{3,5,1},{1,5,2})

How would i write a procedure to put these two lists into one as {1,1,1,1,1,2,2,2,2,3,3,3,4,5,5,5,6} i now there is a method in maple help but it doesnt meet what i need.

Any help would be appreciated.

1 2 Page 2 of 2