Adam Ledger

Mr. Adam Ledger

360 Reputation

11 Badges

9 years, 125 days
unemployed
hobo
Perth, Australia

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by Adam Ledger

@Carl Love  ok I think i understand but I just would have thought i would have encountered this this error so much more frequenty than  i have, i think this is the first time i have

@vv  ok that is fine maybe it isnt as significant as i first thought it to be but i still get an uneasy feeling i do know i had completely forgotten how to find characteristic equations and all of that it's has just been a tough week that way 

@vv so do we need to define S(1):=4 rather than the convention i used defining S(0)=4? If you can explain this to me it should be quite fundamental to my i understanding i would imagine

@vv in as much as i am happy this point has been raised in regard to my understanding of how this particular circumstance is handled by maple, it is not a relevant answer to my post.. i did specify that i want the student to be able to focus only on the mathematics in the tools that i am trying to build and have the code excluded from view

@vv ok sweet! so i just assumed that s(n-1)^2 would be taken there as raising n-1 to the exponent 2, seeing you had not yet assigned a definition to s in a prior line for s(x) to be handled as the evaluation of a procedure

 

@acer Thanks again very concise information much appreciated

@acer They are both the totient function though yes? i thought the only difference is that the num theory package phi can compute for much larger integers?

@acer ok so if i specify numtheory[phi] in Ftest GetProperty will pick that up ok easy thanks

@tomleslie  I should to save face delete this entire post but im not going to ill leave it up, maybe next time ill check my basic arithmetic before i announce the sky is falling

@tomleslie yeah its ok for a moment there i think almost had a nervous breakdown i need to remind myself i actually make the choice to worry about this kind of stuff.

 

But fixed signs? i can see you have put a 1 in front of the p's. you must be talking about a different meaning of sign to what i am used to.

i am fixing it up so that i can try an class or arithmetic function tests on a range N for any identity. Sorry i was actually meant to only post things once i had everything in with buttons and user entry fields etc but i kinda had a panic attack with this.

 


 

``

 

 

delta(x, y) = piecewise(x = y, 1, x <> y, 0)

 

{x}*is*the*fractional*part*of*x

 

``

 

 

`&Mscr;`(p, q) = {`mod`(p, q)+(1/4)*p*(q-1)}

"`&Dscr;`(p,q)="
1-delta({(1/4)*p}, 0)-delta({(1/4)*q}, 0)+delta({(1/4)*q}, 0)*delta({(q-1)*(1/4)}, 0)+1/2*(delta({(q-2)*(1/4)}, 0)+delta({(1/4)*q}, 0)-delta({(q-2)*(1/4)}, 0)*delta({(q-3)*(1/4)}, 0))

 

"For all natural numbers p,q congruent to either 0,1,2 or 3 mod 4"

 

NULL

NULL

WHEN ALL TERMS ARE PLACED ON THE LHS AND 0 ON THE OTHER, THE OUTPUT PLACES ALL p,q IN THE SET T, AS I EXPECTED.

restart; S := {}; with(combinat); with(numtheory); T := {}; F := {}; C := {}; AlphaTotal := {}; BetaTotal := {}

delta := proc (x, y) options operator, arrow; piecewise(x = y, 1, x <> y, 0) end proc

Identity := proc (p, q) options operator, arrow; frac(`mod`(p, q)+(1/4)*p*(q-1))+delta(frac((1/4)*p), 0)+delta(frac((1/4)*q-1/4), 0)-delta(frac((1/4)*q), 0)*delta(frac((1/4)*q-1/4), 0)+(1/2)*delta(frac((1/4)*q-1/2), 0)+(1/2)*delta(frac((1/4)*q-3/4), 0)-(1/2)*delta(frac((1/4)*q-1/2), 0)*delta(frac((1/4)*q-3/4), 0)-1 = 0 end proc

AFunction := proc (N) options operator, arrow; piecewise(frac((1/4)*N-1/2) = 0, N, NULL) end proc

GenerateNumberPairs := proc (N) options operator, arrow; choose([seq(AFunction(k), k = 1 .. N)], 2) end proc

AssignToTrueOrFalseSet := proc (x, y) global T, F; if is(Identity(x, y)) = true then T := `union`({[x, y]}, T) else F := `union`({[x, y]}, F) end if end proc

QueryIdentity := proc (N) local P, k; P := GenerateNumberPairs(N); for k to nops(P) do AssignToTrueOrFalseSet(P[k][1], P[k][2]) end do end proc

QueryIdentity(20); T; F

``

seq(Identity(T[k][1], T[k][2]), k = 1 .. nops(T))

seq(Identity(F[k][1], F[k][2]), k = 1 .. nops(F))

``

``

restart; S := {}; with(combinat); with(numtheory); T := {}; F := {}; C := {}; AlphaTotal := {}; BetaTotal := {}

delta := proc (x, y) options operator, arrow; piecewise(x = y, 1, x <> y, 0) end proc

Identity := proc (p, q) options operator, arrow; frac(`mod`(p, q)+(1/4)*p*(q-1))+delta(frac((1/4)*p), 0)+delta(frac((1/4)*q-1/4), 0)-delta(frac((1/4)*q), 0)*delta(frac((1/4)*q-1/4), 0)+(1/2)*delta(frac((1/4)*q-1/2), 0)+(1/2)*delta(frac((1/4)*q-3/4), 0)-(1/2)*delta(frac((1/4)*q-1/2), 0)*delta(frac((1/4)*q-3/4), 0)-1 = 0 end proc

AFunction := proc (N) options operator, arrow; piecewise(frac((1/4)*N-3/4) = 0, N, NULL) end proc

GenerateNumberPairs := proc (N) options operator, arrow; choose([seq(AFunction(k), k = 1 .. N)], 2) end proc

AssignToTrueOrFalseSet := proc (x, y) global T, F; if is(Identity(x, y)) = true then T := `union`({[x, y]}, T) else F := `union`({[x, y]}, F) end if end proc

QueryIdentity := proc (N) local P, k; P := GenerateNumberPairs(N); for k to nops(P) do AssignToTrueOrFalseSet(P[k][1], P[k][2]) end do end proc

QueryIdentity(40); T; F

{[3, 7], [3, 11], [3, 15], [3, 19], [3, 23], [3, 27], [3, 31], [3, 35], [3, 39], [7, 11], [7, 15], [7, 19], [7, 23], [7, 27], [7, 31], [7, 35], [7, 39], [11, 15], [11, 19], [11, 23], [11, 27], [11, 31], [11, 35], [11, 39], [15, 19], [15, 23], [15, 27], [15, 31], [15, 35], [15, 39], [19, 23], [19, 27], [19, 31], [19, 35], [19, 39], [23, 27], [23, 31], [23, 35], [23, 39], [27, 31], [27, 35], [27, 39], [31, 35], [31, 39], [35, 39]}

 

{}

(1)

{seq(T[k][1], k = 1 .. nops(T))}

{3, 7, 11, 15, 19, 23, 27, 31, 35}

(2)

{seq(T[k][2], k = 1 .. nops(T))}

{7, 11, 15, 19, 23, 27, 31, 35, 39}

(3)

{seq(F[k][2], k = 1 .. nops(F))}

{}

(4)

seq(Identity(T[k][1], T[k][2]), k = 1 .. nops(T))

0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0

(5)

restart; S := {}; with(combinat); with(numtheory); T := {}; F := {}; C := {}; AlphaTotal := {}; BetaTotal := {}

delta := proc (x, y) options operator, arrow; piecewise(x = y, 1, x <> y, 0) end proc

Identity := proc (p, q) options operator, arrow; frac(`mod`(p, q)+(1/4)*p*(q-1))+delta(frac((1/4)*p), 0)+delta(frac((1/4)*q-1/4), 0)-delta(frac((1/4)*q), 0)*delta(frac((1/4)*q-1/4), 0)+(1/2)*delta(frac((1/4)*q-1/2), 0)+(1/2)*delta(frac((1/4)*q-3/4), 0)-(1/2)*delta(frac((1/4)*q-1/2), 0)*delta(frac((1/4)*q-3/4), 0)-1 = 0 end proc

AFunction := proc (N) options operator, arrow; piecewise(frac((1/4)*N) = 0, N, NULL) end proc

GenerateNumberPairs := proc (N) options operator, arrow; choose([seq(AFunction(k), k = 1 .. N)], 2) end proc

AssignToTrueOrFalseSet := proc (x, y) global T, F; if is(Identity(x, y)) = true then T := `union`({[x, y]}, T) else F := `union`({[x, y]}, F) end if end proc

QueryIdentity := proc (N) local P, k; P := GenerateNumberPairs(N); for k to nops(P) do AssignToTrueOrFalseSet(P[k][1], P[k][2]) end do end proc

QueryIdentity(20); T; F

{[4, 8], [4, 12], [4, 16], [4, 20], [8, 12], [8, 16], [8, 20], [12, 16], [12, 20], [16, 20]}

 

{}

(6)

{seq(T[k][1], k = 1 .. nops(T))}

{4, 8, 12, 16}

(7)

{seq(T[k][2], k = 1 .. nops(T))}

{8, 12, 16, 20}

(8)

{seq(F[k][2], k = 1 .. nops(F))}

{}

(9)

seq(Identity(T[k][1], T[k][2]), k = 1 .. nops(T))

0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0

(10)

seq(Identity(F[k][1], F[k][2]), k = 1 .. nops(F))

restart; S := {}; with(combinat); with(numtheory); T := {}; F := {}; C := {}; AlphaTotal := {}; BetaTotal := {}

delta := proc (x, y) options operator, arrow; piecewise(x = y, 1, x <> y, 0) end proc

Identity := proc (p, q) options operator, arrow; frac(`mod`(p, q)+(1/4)*p*(q-1))+delta(frac((1/4)*p), 0)+delta(frac((1/4)*q-1/4), 0)-delta(frac((1/4)*q), 0)*delta(frac((1/4)*q-1/4), 0)+(1/2)*delta(frac((1/4)*q-1/2), 0)+(1/2)*delta(frac((1/4)*q-3/4), 0)-(1/2)*delta(frac((1/4)*q-1/2), 0)*delta(frac((1/4)*q-3/4), 0)-1 = 0 end proc:

AFunction := proc (N) options operator, arrow; piecewise(frac((1/4)*N-1/4) = 0, N, NULL) end proc

GenerateNumberPairs := proc (N) options operator, arrow; choose([seq(AFunction(k), k = 1 .. N)], 2) end proc:

AssignToTrueOrFalseSet := proc (x, y) global T, F; if is(Identity(x, y)) = true then T := `union`({[x, y]}, T) else F := `union`({[x, y]}, F) end if end proc:

QueryIdentity := proc (N) local P, k; P := GenerateNumberPairs(N); for k to nops(P) do AssignToTrueOrFalseSet(P[k][1], P[k][2]) end do end proc:

QueryIdentity(20):

{[1, 5], [1, 9], [1, 13], [1, 17], [5, 9], [5, 13], [5, 17], [9, 13], [9, 17], [13, 17]}

 

{}

(11)

{seq(T[k][1], k = 1 .. nops(T))}

{1, 5, 9, 13}

(12)

{seq(T[k][2], k = 1 .. nops(T))}

{5, 9, 13, 17}

(13)

{seq(F[k][2], k = 1 .. nops(F))}

{}

(14)

seq(Identity(T[k][1], T[k][2]), k = 1 .. nops(T))

0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0, 0 = 0

(15)

seq(Identity(F[k][1], F[k][2]), k = 1 .. nops(F))

``

``

 


 

Download KRONECKER_delta_RECIPROCITY3.mw

@vv 

Yes i agree that indeed there is only q dependance here, but the concern i have is that the results should be the same in the context of the code i have used.

 

q is congruent to 0 or 1 mod 4 will give D(q)=1/2 and M(p,q)= 1/2 

q is congruent to 2 or 3 mod 4 will give D(q) = 0 and M(p,q)= 0

Either way,  is(1/2=1/2) and is(0=0) should be returning true here, this is an issue with the programming of the "is" function not a problem with the identity itself

 

@Preben Alsholm  ok ill have a read thanks

@tomleslie 

fine i guess i need to remember it is still just a proc anyway  but how is the do loop infinite that part escapes me i typed end do: that usually indicates to maple that it should end do not repreat do infinitely 

@tomlesliesure i mean this example shows a case where the arrow is far superior (first one using proc will go forever, could be improved )

GeneratePrimeNumberPairs1 := proc (N) do choose([seq(ithprime(k), k = 2 .. N)], 2) end do end proc;

proc (N) do choose([seq(ithprime(k), k = 2 .. N)], 2) end do end proc

(1)

GeneratePrimeNumberPairs2 := proc (N) options operator, arrow; choose([seq(ithprime(k), k = 2 .. N)], 2) end proc:

``

Download ARROW_IS_AWESOME.mw

@tomleslie thats fine i think i see the reason for the efficiency now. kinda feel like thats cheating. also did the garbage collector go on strike when i started to post here? :-P

First 11 12 13 14 15 16 17 Last Page 13 of 30