Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
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
Ed H


Member


Joined: 30 Nov 2007
Posts: 138

Posted: 02 Feb 2010 08:17:07 pm    Post subject:

So you wanna perform the Extended Euclidean algorithm on two numbers A and B, eh?

Code:
:{1,i,A+Bi
:While imag(Ans(3
:iconj(Ans-imag(Ans)int(real(Ans(3)/imag(Ans(3
:End
:real(Ans
You'll end up with a list {X,Y,C} with XA + YB = C, where C is the GCD of A and B.

On a related note,

Code:
:Ans+i
:While E-9<imag(Ans
:iconj(Ans-imag(Ans)int(real(Ans/imag(Ans
:End
:real(Ans
will pull out the denominator out of a fraction. Not sure if this is new.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 02 Feb 2010 09:54:28 pm    Post subject:

Aside from my swapping every real( and imag( in this post, we used the exact same method. Smile

Last edited by Guest on 01 Jul 2010 09:51:54 am; edited 1 time in total
Back to top
Ed H


Member


Joined: 30 Nov 2007
Posts: 138

Posted: 04 Feb 2010 12:01:11 am    Post subject:

Haha, sweet. I came up with that idea when I realized how repetitive the operations in the extended Euclidean algorithm were. I wanted to take advantage of this by using lists for the variables X, Y, and A/B, which required me to use complex numbers to store both values in one element.
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 GMT - 5 Hours

 

Advertisement