The one calculator

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).

Pages

AuthorTopic: The one calculator
Master
Member # 5977
Profile Homepage #75
Yes, that's it. Although the program is somewhat different than you describe, Sullust:

:1>X // The arrow means store. its about the same as X=1
:1>Y
:Lbl A
:If X>100000000000 // So it wouldn't stop to soon
:Then
:Else
:X+Y>X
:Disp X
:Pause // So you have the time to look at the number
:X+Y>Y
:Disp Y
:Pause
:Go to A
That's about it. Do I have to explain to anybody else what the series of Fibonacci?

Well I just explain:

You start with X=1 and Y=1. Then just start summing up the last X and Y:

1+1=2+ (last Y=1, so) 2+1=3+2=5+3=8+5+13........ You could go on like this for some time, but my calculator does it for me :)

[ Monday, September 12, 2005 06:54: Message edited by: Thralni, emperor of Riverrod ]

--------------------
Thralni's almighty Avernum pages: My webpage, containing scenario's and graphics made by me (And maybe someday the homepage of the almighty chicken gods).

Click here for more information on Olga's fortune teller kiosk

Olga's fortune teller kiosk has been temporarily closed down, but you can contact the prophet with a PM - Was signed by the prophet of the almighty chicken gods, gods of everything that is a chicken.

Work has begun on the Nephilian grammar and vocabulary guide!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Shaper
Member # 32
Profile #76
But why would you do it that way when there is actually a formula for the fibonacci sequence?

IMAGE(http://www.4dsolutions.net/ocn/graphics/fibfunc.gif)
(Obtained from: 1: Getting Serious About Series by Kirby Urner)

[ Monday, September 12, 2005 07:39: Message edited by: Lt. Sullust ]

--------------------
Lt. Sullust
Cogito Ergo Sum
Polaris
Posts: 2462 | Registered: Wednesday, October 3 2001 07:00
Master
Member # 4614
Profile Homepage #77
Hmmm, interesting. I'd like to see how they came up with that formula. Anyway.
#include <iostream>
#include <stdlib.h>
using namespace std;
int Fib(int);
int main()
{
int selection;
cout << "Enter n for Fib(n): ";
cin >> n;
int result = Fib(n);
cout << "\n\nFib(" << n << ") = " << result << ".";
system("pause");
return 0;
}
int Fib(int n)
{
if(n < 0) return -1;
if(n < 3) return 1;
else return Fib(n-1) + Fib(n-2);
}


--------------------
-ben4808

For those who love to spam:
CSM Forums
RIFQ
Posts: 3360 | Registered: Friday, June 25 2004 07:00
Lifecrafter
Member # 1768
Profile #78
An even better question: what is the application?

--------------------
"Oh, North Wind, why frighten others?
In Nature's family all are brothers.
Puff and blow and wheeze and hiss;
You can't frighten Shingebiss.
Bring your frost and ice and snow;
I'm still free to come and go.
You can never frighten me,
One who never fears is FREE!"
-Shingebiss, the mighty duck
Posts: 830 | Registered: Tuesday, August 20 2002 07:00
Shaper
Member # 32
Profile #79
Using the techniques of Linear Algebra it can easily be determined. As for the use of it, the fibonacci sequence shows up in a surprising number of places. The function itself can be shortened to create an estimating function which is almost the exact same for large enough values of n.

[ Monday, September 12, 2005 18:41: Message edited by: Lt. Sullust ]

--------------------
Lt. Sullust
Cogito Ergo Sum
Polaris
Posts: 2462 | Registered: Wednesday, October 3 2001 07:00
Master
Member # 5977
Profile Homepage #80
quote:
Originally written by Benny Boy:

Hmmm, interesting. I'd like to see how they came up with that formula. Anyway.
#include <iostream>
#include <stdlib.h>
using namespace std;
int Fib(int);
int main()
{
int selection;
cout << "Enter n for Fib(n): ";
cin >> n;
int result = Fib(n);
cout << "\n\nFib(" << n << ") = " << result << ".";
system("pause");
return 0;
}
int Fib(int n)
{
if(n < 0) return -1;
if(n < 3) return 1;
else return Fib(n-1) + Fib(n-2);
}

Did you make this on a calculator? I can't make it on mine...

Ho do I put it in the calculator? This is how I wrote it, but it doesn't work entirely (I needed to make adjustments because I can't find all signs on my keyboard, but between ) and X there should be a sort of small roof, you know)

(((1+v(5))/2)X-(-2/(1+v(5))X))/v(5)

[ Tuesday, September 13, 2005 04:01: Message edited by: Thralni, emperor of Riverrod ]

--------------------
Thralni's almighty Avernum pages: My webpage, containing scenario's and graphics made by me (And maybe someday the homepage of the almighty chicken gods).

Click here for more information on Olga's fortune teller kiosk

Olga's fortune teller kiosk has been temporarily closed down, but you can contact the prophet with a PM - Was signed by the prophet of the almighty chicken gods, gods of everything that is a chicken.

Work has begun on the Nephilian grammar and vocabulary guide!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
...b10010b...
Member # 869
Profile Homepage #81
That's not a calculator program, that's C++. :P

--------------------
My BoE Page
Bandwagons are fun!
Roots
Hunted!
Posts: 9973 | Registered: Saturday, March 30 2002 08:00
Infiltrator
Member # 5576
Profile Homepage #82
If you want to put it on your TI calculator, you will want something like this:
PROGRAM:FibMain
:Prompt N
:1 [store] dimL FIBS
:Fib
:DISP FIBS (1)
PROGRAM:Fib
:If FIBS(dimL FIBS)<0
:Then
:-1 [store] FIBS(dimL FIBS)
:Return
:End
:If FIBS(diml FIBS)<3
:Then
:1 [store] FIBS(dimL FIBS)
:Return
:End
:1+(dimL KS) [store] dimL KS
:(FIBS((dimL FIBS)-1))-1 [store] FIBS(dimL FIBS)
:Fib
:FIBS(dimL FIBS) [store] KS(dimL KS)
:(FIBS((dimL FIBS)-1)-2) [store] FIBS(dimL FIBS)
:Fib
:(FIBS(dimL FIBS))+(KS(dimL KS)) [store] FIBS((dimL FIBS)-1)
:(dimL FIBS)-1 [store] dimL FIBS
:(dimL KS)-1 [store] dimL KS
:Return
(NOTE: [store] means the store operation, the little arrow pointing to the right.
Also, this is two seperate programs; Fib is called as a subrountine by FibMain)

These programs work on my TI-85 and may need minor modification for the TI-83

--------------------
Überraschung des Dosenöffners!
Posts: 627 | Registered: Monday, March 7 2005 08:00
Law Bringer
Member # 2984
Profile Homepage #83
What language does a calculator use anyway? Basic?

--------------------
The Encyclopaedia Ermariana <-- Now a Wiki!
"Polaris leers down from the black vault, winking hideously like an insane watching eye which strives to convey some strange message, yet recalls nothing save that it once had a message to convey." --- HP Lovecraft.
"I single Aran out due to his nasty temperament, and his superior intellect." --- SupaNik
Posts: 8752 | Registered: Wednesday, May 14 2003 07:00
Master
Member # 4614
Profile Homepage #84
Yeah. Something BASIC. I'm thinking TI BASIC.

Anyway, my program is not by any means compatible with calculators, but rather with my trusty compiler. Even then, I see I forgot a better form of error correction. Type in anything negative and you get -1. Anyway, that's all right.

EDIT: Oof, whoops, I also forgot that my variable in main() was declared as selection and then used as n. As it turns out, that program is not compatible with anything. Always happens. :P

[ Tuesday, September 13, 2005 15:31: Message edited by: Benny Boy ]

--------------------
-ben4808

For those who love to spam:
CSM Forums
RIFQ
Posts: 3360 | Registered: Friday, June 25 2004 07:00
Infiltrator
Member # 5576
Profile Homepage #85
I'm told that TI does use a form of Basic, but with numerous special functions added that relate to the calculator's abilities.
I don't like Ti Basic much, but I do like being able to program my calculator to do useful things (like determine that 86464324567 is prime, which took only about 4 hours).
Yay for C++!

--------------------
Überraschung des Dosenöffners!
Posts: 627 | Registered: Monday, March 7 2005 08:00
Shaper
Member # 32
Profile #86
You could just see if the remainder is zero when divided by any number less than the square root of that number. It is definitely less coding. Of course, it may take a bit longer...

--------------------
Lt. Sullust
Cogito Ergo Sum
Polaris
Posts: 2462 | Registered: Wednesday, October 3 2001 07:00
Law Bringer
Member # 2984
Profile Homepage #87
Taking the square root of a number is definitely less work for the calculator than trying out all the numbers above it - especially for large numbers.

That said, I didn't find a remainder function for TI BASIC (or whatever it is). That makes the process much slower: Calculating the remainder for two large numbers takes a fraction of the time used for division.

Maybe I didn't look hard enough? Not being able to calculate remainders is a strange shortcoming...

[ Tuesday, September 13, 2005 21:08: Message edited by: Arancaytar ]

--------------------
The Encyclopaedia Ermariana <-- Now a Wiki!
"Polaris leers down from the black vault, winking hideously like an insane watching eye which strives to convey some strange message, yet recalls nothing save that it once had a message to convey." --- HP Lovecraft.
"I single Aran out due to his nasty temperament, and his superior intellect." --- SupaNik
Posts: 8752 | Registered: Wednesday, May 14 2003 07:00
Infiltrator
Member # 5576
Profile Homepage #88
[quote=Lt. Sullust
You could just see if the remainder is zero when divided by any number less than the square root of that number. It is definitely less coding. Of course, it may take a bit longer... [/quote]That is exactly what I did]

:Prompt P
:(iPart ([sqrt]P)) [store] N
:For(Q,2,N,1)
:P/Q [store] K
:fPart K [store] K
:If (K==0)
:Then:Disp "NOT PRIME":Disp Q:Stop
:End
:End
:Disp "PRIME"
However, the square root of 86464324567 is 294048, which takes a long time for a TI-85.

Also, fPart is good for checking remainders (to see if they are zero at least. To get the actual remainder you could do P%Q = (fPart(P/Q))*Q I think).

--------------------
Überraschung des Dosenöffners!
Posts: 627 | Registered: Monday, March 7 2005 08:00
Lifecrafter
Member # 1468
Profile Homepage #89
I had to write my own code to get remainders
Here's what I did:

Number1 -> Z
Number2 -> Y
Z/Y -> A
A -> B
round(A,0) -> A
If A>B
Then
A-1 -> A
End
A*Y -> X
Z-X -> X

Making X the remainder.
But, the (fPart(P/Q)*Q) formula seems to work too.

[ Wednesday, September 14, 2005 04:28: Message edited by: Eldibs ]

--------------------
"We can learn a lot from crayons. Some are short, some are dull, some are sharp, some are tall. Some have funny names and they are all different colors, but they all learn to live in the same box."

"Happy is the man that has wisdom and gets discernment. For having wisdom as gain is better than having silver as gain and having wisdom as produce is better than gold itself" Proverbs 3:14-3:15

The horrible part about life is, you'll never get out of it alive.

Currently boycotting: AngelFire, GameFAQ's
Everybody should go to this site at least once.
Posts: 818 | Registered: Tuesday, July 9 2002 07:00
Master
Member # 5977
Profile Homepage #90
I managed to put it in the calculator. Apparently, I missed a right bracket, giving very strange answers. Now that I fixed that everything works fine.

I don't know the name of the program language. i just know I'd rather work on Avernumn script ona big computer screen, then such a small calculator display.

--------------------
Thralni's almighty Avernum pages: My webpage, containing scenario's and graphics made by me (And maybe someday the homepage of the almighty chicken gods).

Click here for more information on Olga's fortune teller kiosk

Olga's fortune teller kiosk has been temporarily closed down, but you can contact the prophet with a PM - Was signed by the prophet of the almighty chicken gods, gods of everything that is a chicken.

Work has begun on the Nephilian grammar and vocabulary guide!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Lifecrafter
Member # 1468
Profile Homepage #91
Personally, I prefer UnrealScript on a big computer screen.

--------------------
"We can learn a lot from crayons. Some are short, some are dull, some are sharp, some are tall. Some have funny names and they are all different colors, but they all learn to live in the same box."

"Happy is the man that has wisdom and gets discernment. For having wisdom as gain is better than having silver as gain and having wisdom as produce is better than gold itself" Proverbs 3:14-3:15

The horrible part about life is, you'll never get out of it alive.

Currently boycotting: AngelFire, GameFAQ's
Everybody should go to this site at least once.
Posts: 818 | Registered: Tuesday, July 9 2002 07:00
Master
Member # 4614
Profile Homepage #92
C++ is best, though. ;)

Anyway, I'm going to need to learn TI Script sometime, probably as soon as a get a calculator. Good boring lecture-beater. :P Well, graphing calculators in general are.

[ Wednesday, September 14, 2005 17:06: Message edited by: Benny Boy ]

--------------------
-ben4808

For those who love to spam:
CSM Forums
RIFQ
Posts: 3360 | Registered: Friday, June 25 2004 07:00
Lifecrafter
Member # 1468
Profile Homepage #93
I'm told UnrealScript is incredibly similar to C++.
I'm not sure how similar it is, because I haven't learned C++ yet.
Visual Basic 6 is kinda fun too.

[ Thursday, September 15, 2005 05:58: Message edited by: Eldibs ]

--------------------
"We can learn a lot from crayons. Some are short, some are dull, some are sharp, some are tall. Some have funny names and they are all different colors, but they all learn to live in the same box."

"Happy is the man that has wisdom and gets discernment. For having wisdom as gain is better than having silver as gain and having wisdom as produce is better than gold itself" Proverbs 3:14-3:15

The horrible part about life is, you'll never get out of it alive.

Currently boycotting: AngelFire, GameFAQ's
Everybody should go to this site at least once.
Posts: 818 | Registered: Tuesday, July 9 2002 07:00

Pages