Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 99 users online: 6 members, 67 guests and 26 bots. Members: ACagliano, geekboy1011, HOMER-16, tifreak8x, tr1p1ea. Bots: VoilaBot (1), Spinn3r (2), MSN/Bing (1), VoilaBot (3), Googlebot (18), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
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.
 TI-Basic Brain Teasers => TI-BASIC
| Author |
Message |
|
thornahawk μολών λαβέ
Active Member

Joined: 27 Mar 2005 Posts: 569
|
Posted: 11 Mar 2009 01:23:31 am Post subject: |
|
|
Given a list of length N stored in L₁ , write a short program that generates the associated circulant matrix in [A].
thornahawk |
|
| Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)

Joined: 25 Nov 2004 Posts: 3976
|
Posted: 11 Mar 2009 02:47:46 am Post subject: |
|
|
Initial results: 66 bytes.
[whiteout]List[font="courier new"]►matr(L1,[A]
For(X,2,dim(L1
augment(∆List(cumSum(L1)),{L1(1→L1
List[font="courier new"]►matr(Ans,[B]
augment([B],[A]→[A]
End
Ans[font="arial"]т[/whiteout]
[EDIT]
After rereading the directions, the third For() argument can be replaced with N, leaving the program at a total of 64 bytes.
Last edited by Guest on 12 Jul 2010 01:15:44 am; edited 1 time in total |
|
| Back to top |
|
|
elfprince13 Retired
Super Elite (Last Title)

Joined: 11 Apr 2005 Posts: 3500
|
Posted: 11 Mar 2009 02:48:58 am Post subject: |
|
|
[s]Untested, but I think it should work.[/s] Works. Don't pick on my rusty skills too much. 80 byte for prgmC, so 79 without the filename?
[whiteout]
List>matr(L1,[A]
[A]
For(I,2,dim(L1
List>matr(augment(seq(L1(J),J,I,dim(L1)),seq(L1(J),J,1,I-1)),[A]
augment([A],Ans
End
AnsT
[/whiteout]
[edit]
Weregoose...does yours handle any L1, or only L1 when it's sequential?
[edit2]
nvm, I see what you did there. Tricksy beast.
Last edited by Guest on 12 Jul 2010 01:15:31 am; edited 1 time in total |
|
| Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)

Joined: 25 Nov 2004 Posts: 3976
|
Posted: 11 Mar 2009 03:08:23 am Post subject: |
|
|
List►matr( doesn't update Ans. I tried to make use of this to reduce the number of bytes, but alas, I couldn't.
Last edited by Guest on 11 Jul 2010 06:05:56 pm; edited 1 time in total |
|
| Back to top |
|
|
thornahawk μολών λαβέ
Active Member

Joined: 27 Mar 2005 Posts: 569
|
Posted: 11 Mar 2009 09:12:43 am Post subject: |
|
|
At this point, Goose would seem to have bested us yet again. I want to see at least one more attempt before I reveal my (unfortunately, longer than Goose's) solution.
thornahawk |
|
| Back to top |
|
|
elfprince13 Retired
Super Elite (Last Title)

Joined: 11 Apr 2005 Posts: 3500
|
Posted: 11 Mar 2009 12:18:59 pm Post subject: |
|
|
| Weregoose wrote: | | List►matr( doesn't update Ans. I tried to make use of this to reduce the number of bytes, but alas, I couldn't. |
actually, that's exactly how I did mine :D
also, I didn't realize the VAT entry took up 9 bytes even without the name, so that puts my actual code at 70 bytes. Not too shabby.
Last edited by Guest on 11 Jul 2010 06:06:17 pm; edited 1 time in total |
|
| Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)

Joined: 25 Nov 2004 Posts: 3976
|
Posted: 11 Mar 2009 03:08:57 pm Post subject: |
|
|
Ah ha. So, the problem I encountered is because of the [A] in your program in place of [B]. (Fifth line.)
Last edited by Guest on 11 Jul 2010 06:06:31 pm; edited 1 time in total |
|
| Back to top |
|
|
woodswolf
Advanced Newbie

Joined: 26 Feb 2009 Posts: 53
|
Posted: 11 Mar 2009 03:58:25 pm Post subject: |
|
|
| One question! It can be a random list right? |
|
| Back to top |
|
|
elfprince13 Retired
Super Elite (Last Title)

Joined: 11 Apr 2005 Posts: 3500
|
Posted: 11 Mar 2009 05:44:09 pm Post subject: |
|
|
| Weregoose wrote: | | Ah ha. So, the problem I encountered is because of the [A] in your program in place of [B]. (Fifth line.) |
oh woops, I typed that wrong off my calculator.
Last edited by Guest on 11 Jul 2010 06:03:54 pm; edited 1 time in total |
|
| Back to top |
|
|
bfr
Member

Joined: 13 Feb 2006 Posts: 108
|
Posted: 11 Mar 2009 09:23:51 pm Post subject: |
|
|
60 bytes:
[whiteout]
{N,N->dim([A]
For(A,1,N
For(B,1,N
L1(1+NfPart(N-1(N+B-A-1->[A](A,B
End
End
[/whiteout]
Last edited by Guest on 12 Jul 2010 01:15:16 am; edited 1 time in total |
|
| Back to top |
|
|
thornahawk μολών λαβέ
Active Member

Joined: 27 Mar 2005 Posts: 569
|
Posted: 11 Mar 2009 09:25:26 pm Post subject: |
|
|
Yes, L₁ does not necessarily have to be {1,2,3,...}; so {6,3,4} should have the corresponding circulant matrix
Code: [[4,6,3]
[3,4,6]
[6,3,4]]
I'm posting my solution later if there are no other takers...
thornahawk |
|
| Back to top |
|
|
woodswolf
Advanced Newbie

Joined: 26 Feb 2009 Posts: 53
|
Posted: 12 Mar 2009 02:46:25 am Post subject: |
|
|
| bfr wrote: | 60 bytes:
[whiteout]
{N,N->dim([A]
For(A,1,N
For(B,1,N
L1(1+NfPart(N-1(N+B-A-1->[A](A,B
End
End
[/whiteout] |
N is not given yet, You should add dim(L1->N
And replace {N,N->dim([A] with identity(N
Last edited by Guest on 12 Jul 2010 01:15:03 am; edited 1 time in total |
|
| Back to top |
|
|
thornahawk μολών λαβέ
Active Member

Joined: 27 Mar 2005 Posts: 569
|
Posted: 12 Mar 2009 04:11:13 am Post subject: |
|
|
My solution was awfully similar to bfr's. :)
| Quote: |
dim(L₁→N
identity(Ans→[A]
For(I,1,N
For(J,1,N
J-I
L₁(Ans-Nint(Nֿ¹(Ans-1→[A](I,J
End:End
|
thornahawk |
|
| Back to top |
|
|
woodswolf
Advanced Newbie

Joined: 26 Feb 2009 Posts: 53
|
Posted: 12 Mar 2009 09:37:50 am Post subject: |
|
|
My first try = 64 bytes nameless
is also awfully similiar to others but still 1 byte less...
| Quote: |
:dim(L1->N
:identity(Ans->[A]
:For(A,0,N-1
:For(B,1,N
:L1(A+B-N(A+B>N->[A](N-A,B
:End
:End
|
I could shave of another 2 bytes, which does make the program make the matrix, but the program ends because of an error. Is that legit?
Last edited by Guest on 12 Mar 2009 10:18:50 am; edited 1 time in total |
|
| Back to top |
|
|
elfprince13 Retired
Super Elite (Last Title)

Joined: 11 Apr 2005 Posts: 3500
|
Posted: 12 Mar 2009 01:41:57 pm Post subject: |
|
|
New version
I got mine down to 66.
[whiteout]
List>matr(L1,[A]
augment(L1,L1->L2
[A]
For(I,2,dim(L1
List>matr(seq(L2(J),J,I,I-1+dim(L1)),[A]
augment([A],Ans
End
AnsT
[/whiteout]
Last edited by Guest on 12 Jul 2010 01:14:40 am; edited 1 time in total |
|
| Back to top |
|
|
darkstone knight
Advanced Member

Joined: 07 Sep 2008 Posts: 438
|
Posted: 12 Mar 2009 03:10:33 pm Post subject: |
|
|
70 bytes:
[whiteout]
dim(L1->N
identity(ans->[A]
augment(L1,augment(L1,L1
for(Y,1,N
for(X,1,N
L1(X-Y+N -> [A](Y,X
end
end[/whiteout]
edit: 63 bytes, pwned woodswolf by 1 byte
[whiteout]dim(L1->N
identity(ans->[A]
for(Y,1,N
for(X,1,N
L1(1+NFpart(N-1(X-Y-1+N->[A](Y,X
end
end
[/whiteout]
edit: it apears to work for any size list except 3 and 7 o_O
edit: AARGH, pwned by rounding errors:
3fpart(3-1 = 0,999999999

Last edited by Guest on 12 Jul 2010 01:14:20 am; edited 1 time in total |
|
| Back to top |
|
|
thornahawk μολών λαβέ
Active Member

Joined: 27 Mar 2005 Posts: 569
|
Posted: 12 Mar 2009 08:46:58 pm Post subject: |
|
|
| Quote: | AARGH, pwned by rounding errors:
3fpart(3-1 = 0,999999999 |
That little quirk is exactly why I did not use fPart( in my implementation, as short as it would make the program. ;)
thornahawk |
|
| Back to top |
|
|
woodswolf
Advanced Newbie

Joined: 26 Feb 2009 Posts: 53
|
Posted: 13 Mar 2009 09:14:45 am Post subject: |
|
|
| fpart ftl |
|
| Back to top |
|
|
|
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
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.027911 seconds.
|