TI 83/84
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   Dev Hardware ForumsSOFTWARETI 83/84

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Hardware Forums Sponsor:
  Trader Rating: 0 · #16  
Old April 17th, 2008, 12:57 PM
zilchonum zilchonum is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 35 zilchonum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 53 m 31 sec
Reputation Power: 1
ok, larkins

I'll try my best to do it. If it doesn't work, my best source for the info is Wikipedia.

So, you take you fraction. We'll do 1/19 as an example. Now, discard the 9. That's not important.
Then, add one to whatever else is in the denominator. Hence the name "by one more than the one before". In this case, we get 2.
Here's the tricky part. You take the numerator and divide by that number. If there is a remainder, it carries. More on that later. Now what we have is the start of our decimal:

1/2= 0 remainder 1
decimal= .0 (for now)

The next "numerator" in the sequence is 10*remainder + quotient, in this case, 10.

10/2= 5 remainder 0
decimal= .05

Now we continue, and don't forget the remainders.

5/2= 2 remainder 1
decimal= .052

12/2= 6 remainder 0
decimal= .0526

=.05263
=.052631
=.0526315
=.05263157

does it check? yes. 1/19=.05263157

this algorithm could definitely be used for fractions, in my opinion. There's also some calculus thing for any number 1/x, but it's slow and recursive, and I don't know it very well.

Reply With Quote
  Trader Rating: 0 · #17  
Old April 18th, 2008, 09:52 AM
MrLarkins's Avatar
MrLarkins MrLarkins is offline
The HS Math Teacher
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Location: Central Arkansas
Posts: 46 MrLarkins User rank is Corporal (100 - 500 Reputation Level)MrLarkins User rank is Corporal (100 - 500 Reputation Level)MrLarkins User rank is Corporal (100 - 500 Reputation Level)MrLarkins User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 8 h 12 m 20 sec
Reputation Power: 2
Send a message via ICQ to MrLarkins
what if the denominator is a single digit, like 2/7? do i discard the seven? if so, what do i consider "the one before"...zero?

Reply With Quote
  Trader Rating: 0 · #18  
Old April 18th, 2008, 10:48 AM
Jagraffamel's Avatar
Jagraffamel Jagraffamel is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Location: Small Town America.
Posts: 87 Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Day 1 h 6 m 53 sec
Reputation Power: 440
Send a message via MSN to Jagraffamel
I'm sitting here in English class so I can't do too much.

The first thing you need is a special programming program I created with the help of zilchonum.

I deemed the Stringverter.

It is short and simple, turning any number stored in the 'z' variable into string 7.

{0,1}->L1
{0,Z}->L2
LinReg(ax=b) Y1
Equ>String(Y1,string7)
Sub(Str7,1,inString(Str7,"X")-1->Str7
""->Y1

I would recommend making this called ZSTRVRT, as I did, since that is what I will use. It is necessary and vital.

Now that yo have this, the real program comes into play.

To be continued... (teacher is back)

Reply With Quote
  Trader Rating: 0 · #19  
Old April 18th, 2008, 02:16 PM
zilchonum zilchonum is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 35 zilchonum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 53 m 31 sec
Reputation Power: 1
Quote:
Originally Posted by MrLarkins
what if the denominator is a single digit, like 2/7? do i discard the seven? if so, what do i consider "the one before"...zero?


you multiply by a fraction equivalent to 1, in this case 7/7. That would make the fraction 14/49, which works.

I tried a program using this last night. It didn't work for most things. I think the problem was in predicting the denominator.

I can't post the source on here, it's just a bit too long for me. But basically what I did was split the digits up into a list. Then I looked at the last two digits and found some possible ratios between them. (This is probably the problem, because I also have to guess a carry amount, and test it with the other decimals) I go from right to left, trying the different ratios and carry values. I like to compare it to finding a regression line, of sorts. Very much a stat program. But not working.

As for Jag's program... I've seen it work, and it's beautiful. I love the Stringverter. But it uses strings, and I want to figure out a mathematical way. It's not hard for most fractions... it's those ones like 1/6 and 16/19 that'll kill you. I'm going back to my programming hole. Goodbye, all. I hope I see you again with my working fraction program.

Reply With Quote
  Trader Rating: 0 · #20  
Old April 18th, 2008, 02:19 PM
zilchonum zilchonum is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 35 zilchonum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 53 m 31 sec
Reputation Power: 1
more answer

Sorry, Larkins. I didn't read your question very carefully. When the denominator is a single digit, like 2/9, you can put a "0" in front of the nine.
0+1=1, and it works.

2/1=2 remainder 0
decimal=.2

etc...

decimal=.222222222

Reply With Quote
  Trader Rating: 0 · #21  
Old April 18th, 2008, 03:31 PM
Jagraffamel's Avatar
Jagraffamel Jagraffamel is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Location: Small Town America.
Posts: 87 Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Day 1 h 6 m 53 sec
Reputation Power: 440
Send a message via MSN to Jagraffamel
And now for the juicy stuff.

The program essentially multiplies the original decimal by increasing powers of 10 until the decimal times the power of ten subtracted by the original decimal is no longer a repeating decimal.

Code:
Input N
N->Z                            //just to have a second variable
For(B,1,20                     //In this case, 20 is arbitrary, it could be any number, the program stops looking for repeaters after 20 digits.
N10^(B)-N->Z
prgmZSTRVERT             //turning the decimal multiplied by the power of ten and subtracted by itself into Str7
length(Str7->L
If L<15                       //check to see if it is still an infinadecimal
Then
B->A
20->B                        //ends the 'for' command
End 
End
L-inString(Str7,"."->L   //actual number of digits in the fPart
(10^(A)-1)10^(L->B     //this finds the denominator
Z10^(L->A                //this is the numerator 
If A=1                      //for some reason, it was unable to find the gcd of 1 and 90, so I just created a bridge if it met that situation
Then
1->L
Goto A2
End
gcd(A,B->L
Lbl A2
A/L->Z
prgmZSTRVERT
Str7->Str1
prgmZSTRVERT
Str7->Str2


That's it, the rest is pretty self explanatory...

After reading many things, I found out you are a math teacher. That is really cool. I want to do that when I grow up...I'm in classes that you teach... My teacher was pretty proud of me when I wrote this bad boy. It pretty much puts the TI's fraction converter to shame. It needs a little work with what to do if the number is unable to be fractionalized (i.e. pi, root 2 e.g. irrationals) but other than that it is nifty. I need to assembly it and see if I can't squeeze TI out of some money for staying quiet...

Reply With Quote
  Trader Rating: 0 · #22  
Old April 20th, 2008, 09:21 AM
Jagraffamel's Avatar
Jagraffamel Jagraffamel is offline
Contributing User
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Location: Small Town America.
Posts: 87 Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Jagraffamel User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Day 1 h 6 m 53 sec
Reputation Power: 440
Send a message via MSN to Jagraffamel
Quote:
Originally Posted by zilchonum
you multiply by a fraction equivalent to 1, in this case 7/7. That would make the fraction 14/49, which works.

I tried a program using this last night. It didn't work for most things. I think the problem was in predicting the denominator.

I can't post the source on here, it's just a bit too long for me. But basically what I did was split the digits up into a list. Then I looked at the last two digits and found some possible ratios between them. (This is probably the problem, because I also have to guess a carry amount, and test it with the other decimals) I go from right to left, trying the different ratios and carry values. I like to compare it to finding a regression line, of sorts. Very much a stat program. But not working.

As for Jag's program... I've seen it work, and it's beautiful. I love the Stringverter. But it uses strings, and I want to figure out a mathematical way. It's not hard for most fractions... it's those ones like 1/6 and 16/19 that'll kill you. I'm going back to my programming hole. Goodbye, all. I hope I see you again with my working fraction program.


All that I need is a mathamatical way to calculate the length of the decimal. The most efficient way to perform this is by using strings...I don't exactly see it as "un mathematical," unless the way a real human being turns a decimal into a fraction is "un-mathematical"...

Reply With Quote
Reply

Viewing: Dev Hardware ForumsSOFTWARETI 83/84 > How to use Output to display value in fraction


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway