LeeHoYeung

Mr. Ho Yeung Lee

535 Reputation

10 Badges

12 years, 236 days

Social Networks and Content at Maplesoft.com

Seldom to ask question after retired math hobby Welcome August, February, July, May born girl And waited for her email to mavio@protonmail.com

MaplePrimes Activity


These are questions asked by LeeHoYeung

how to merge two lists without repetitions?

input [x,y,z] [a,b,x]

return [x,y,z,a,b]

how to get the power of monomials

 

if input x, return 1

if input x*y^2, return [1,2]

http://www.maplesoft.com/applications/view.aspx?SID=5083&view=html&L=F

Error, (in hanoi) cannot determine if this expression is true or false: 0 < n

N:=n:moves:=[];
hanoi:=proc(N,source,dest,aux) global moves;
if N>0 then
hanoi(N-1,source,aux,dest):
moves:=[moves[],[N,source,dest]]:
hanoi(N-1,aux,dest,source);
end if:
end proc:
sol:=hanoi(n,1,3,2);

There is million items in list, 

what is the difference between seq and for loop ?

is seq faster than for loop?

it is very slow when running code below, how to speed up this part of code?

 

https://gist.github.com/LovelyYanki/c0b61fbb9d5954b34e03#file-gistfile1-txt

HSKeyIn := Table();
for ij from 1 to 1685159 do
s := solve([mm[ij][1,1]=1,mm[ij][1,2]=1,mm[ij][1,3]=1],[a,b,c]):
if nops(s) > 0 then
if (rhs(s[1][1]) = 1 or rhs(s[1][1]) = 0) and (rhs(s[1][2]) = 1 or rhs(s[1][2]) = 0) and (rhs(s[1][3]) = 1 or rhs(s[1][3]) = 0) then
#print(lhs(indices(T3, pairs)[ij])):
#print("***"):
h := HilbertSeries([mm[ij][1,1],mm[ij][1,2],mm[ij][1,3]], {a,b,c}, z):
#print(h):
if not assigned(HSkeyIn[h]) then
if mod(ij, 100) = 0 then
print(ij):
end if:
HSkeyIn[h] := [[mm[ij][1,1],mm[ij][1,2],mm[ij][1,3]]]:
else
if mod(ij, 100) = 0 then
print(ij):
end if:
HSkeyIn[h] := [op(HSkeyIn[h]), [mm[ij][1,1],mm[ij][1,2],mm[ij][1,3]]]:
end if:

end if:
end if:
od:

mm := [[a, 1], [a, b]];
mmseq := {seq(mm[ij],ij=1..2)};

how to filter above in seq when any items in the [] has 1

criteria is below

if mm[ij][1] = 1 or mm[ij][2] = 1 or mm[ij][3] = 1 then
Dummy := 0:
else
mm2 := [op(mm2), mm[ij]]:
end if

 

First 70 71 72 73 74 75 76 Last Page 72 of 141