This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
mr. sir


Newbie


Joined: 21 Feb 2008
Posts: 41

Posted: 15 Aug 2009 06:22:40 pm    Post subject:

I have created a program to generate the first N cyclotomic polynomials. The point of this was to test a remark I read on Wikipedia, that 105 is the first number whose cyclotomic polynomial contains a non -1, 0, 1 digit. Unfortunately my calc can't hold all the lists necessary, so I had to make do with in the 50's. Another problem with the program is that it is necessary to repeatedly recall Ans, delete the quotes, and press enter again. Maybe there is some way to do it without using customized lists?

The necessary program is prgmO (sp.?), here.


Code:
:SetUpEditorL001
:If not(dim(∟L001
:Then
:Prompt N
:"
:For(C,1,N
:Ans+sub("0123456789",int(C/100)+1,1)+sub("0123456789",10fPart(C/100)-fPart(C/10)+1,1)+sub("0123456789",10fPart(C/10)+1,1)+"+1"+Str2+"dim(∟L"+sub("0123456789",int(C/100)+1,1)+sub("0123456789",10fPart(C/100)-fPart(C/10)+1,1)+sub("0123456789",10fPart(C/10)+1,1)+":
:End
:sub(Ans,2,length(Ans)-1)+"prgmO
:Return
:End
:If ∟L001(1)=0
:Then
:"
:For(C,1,N
:Ans+"1"+Str2+"∟L"+sub("0123456789",int(C/100)+1,1)+sub("0123456789",10fPart(C/100)-fPart(C/10)+1,1)+sub("0123456789",10fPart(C/10)+1,1)+"(1):‾1"+Str2+"∟L"+sub("0123456789",int(C/100)+1,1)+sub("0123456789",10fPart(C/100)-fPart(C/10)+1,1)+sub("0123456789",10fPart(C/10)+1,1)+"("+sub("0123456789",int((C+1)/100)+1,1)+sub("0123456789",10fPart((C+1)/100)-fPart((C+1)/10)+1,1)+sub("0123456789",10fPart((C+1)/10)+1,1)+"):
:End
:sub(Ans,2,length(Ans)-1)+"prgmO→Str1
:2→C
:Return
:End
:If C>N
:Then
:DelVar L1DelVar L2DelVar L3Disp "DONE!
:Stop
:End
:"∟L"+sub("0123456789",int(C/100)+1,1)+sub("0123456789",10fPart(C/100)-fPart(C/10)+1,1)+sub("0123456789",10fPart(C/10)+1,1)
:expr(Ans)→L1
:For(D,1,C-1)
:If not(fPart(C/D
:Then
:"∟L"+sub("0123456789",int(D/100)+1,1)+sub("0123456789",10fPart(D/100)-fPart(D/10)+1,1)+sub("0123456789",10fPart(D/10)+1,1)
:expr(Ans)→L2
:dim(L1)-dim(L2)+1→dim(L3
:dim(L1→dim(L2
:For(E,1,dim(L3
:L1(E)
:For(X,2,E
:Ans-L2(X)L3(E+1-X
:End
:Ans/L2(1)→L3(E
:End
:dim(L1)-dim(L3)+1→dim(L2
:L3→L1
:End
:End
:"L1"+Str2+"∟L"+sub("0123456789",int(C/100)+1,1)+sub("0123456789",10fPart(C/100)-fPart(C/10)+1,1)+sub("0123456789",10fPart(C/10)+1,1)
:If C=N:Ans+":Clear Entries
:Ans+":prgmO"→Str1
:C+1→C
:Return


Here is prgmOPENME, the training program:


Code:
:ClrHome
:Disp "FIRST THING TO","DO IS TO READ","ALL THESE IN-","STRUCTIONS. THEN","OPEN prgmO."
:Output(8,1,"PRESS ENTER NOW."
:Pause
:ClrHome
:Disp "N IS THE NUMBER","YOU WANT TO GO","TO. WHEN THE","PROGRAM SAYS","DONE, PRESS 2ND,","STO"+Str2+", 2ND, Ans."
:Output(8,1,"PRESS ENTER NOW."
:Pause
:ClrHome
:Disp "Then PRESS ENTER","ERASE THE QUOTES","AROUND IT THEN","HIT ENTER AGAIN.","TRY THAT NOW."
:Repeat Str5="GOOD
:"GOOD
:Input "",Str5
:If Str5≠"GOOD
:Disp "TRY AGAIN."
:End
:DelVar Str5ClrHome
:Disp "NICE. NEXT, WHEN","IT SAYS DONE","AGAIN, PRESS 2ND","STO"+Str2+", VARS, 7,1."
:Output(8,1,"PRESS ENTER NOW."
:Pause
:ClrHome
:Disp "THEN REMOVE THE","QUOTES FROM","AROUND IT. THERE","ARE NONE HERE."
:Output(8,1,"PRESS ENTER NOW."
:Pause
:ClrHome
:Disp "TRY THIS NOW."
:Repeat Str5="WELL DONE
:"WELL DONE"→Str1
:Input "",Str5
:If Str5≠"WELL DONE"
:Disp "TRY AGAIN."
:End
:ClrHome
:Disp "GREAT! NOW KEEP","REPEATING THIS","STEP UNTIL IT","SAYS DONE! WITH","A ! AT THE END."
:Output(8,1,"PRESS ENTER NOW."
:Pause
:ClrHome
:Disp "TRY IT NOW."
:For(C,1,5
:sub("COOLNICEGOODOKAYFINE",4C-3,4→Str1
:Input "",Str5
:If Str5≠sub("COOLNICEGOODOKAYFINE",4C-3,4
:Then
:0→C
:Disp "TRY AGAIN."
:End
:End
:DelVar Str5
:Disp "DONE!


Str2 contains →, just the store arrow.

Here's the group all contained in one file. How can I make it so that I don't have to keep recalling Ans?


Last edited by Guest on 15 Aug 2009 06:29:15 pm; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 16 Aug 2009 08:54:44 am    Post subject:

Uh... I just took the straightforward approach.

{1:For(K,1,N
If 1=gcd(K,N
augment(Ans,{0})-augment({0},Ans)[font="times new roman"]e
^(2[font="times new roman"]πi
K/N
End
round(Ans,0

Go ahead and see that it will also work with non-unit coefficients (A013594).

Last edited by Guest on 05 Jul 2010 08:12:45 am; edited 1 time in total
Back to top
mr. sir


Newbie


Joined: 21 Feb 2008
Posts: 41

Posted: 16 Aug 2009 02:04:27 pm    Post subject:

Aw man, I could've come up with that, but I was stuck in the definition that



and

.

That's the equation my whole program was based on. If I had just remembered that the cyclotomic polynomial is just the polynomial with the primitive roots, it would have been much easier. Thanks Weregoose. :blush:

Also, sorry about the weird product thing. Do you, the reader, know an online TeXer that does not use dynamic webpages and supports \displaystyle?
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 16 Aug 2009 03:41:07 pm    Post subject:

You could just save the equations as images and attach them to the post if you so desire.

Also, I suggest sticking real( on the answer, since the polynomial only has real coefficients anyway: every primitive root has a primitive conjugate. And real lists are nicer to deal with, not to mention being half the size.


Last edited by Guest on 05 Jul 2010 08:13:18 am; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 16 Aug 2009 11:39:06 pm    Post subject:

DarkerLine wrote:
Also, I suggest sticking real( on the answer, since the polynomial only has real coefficients anyway: every primitive root has a primitive conjugate. And real lists are nicer to deal with, not to mention being half the size.
I concur, which is why I had it written that way in a later generation of the program that TraditionalForm'd the output. I then recognized that tripling the program size wouldn't be necessary, and scrapped it in favor of real(round(Ans,0:DrawF sum(AnsX^(dim(Ans)-cumSum(not(0Ans.

Last edited by Guest on 05 Jul 2010 08:12:15 am; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement