TI-89 PAY program, infinite loop problem?

In summary: So, I guess what I'm trying to say is that the program is supposed to do these things, but I don't think it does because it didn't work on my own calculator.In summary, the program is supposed to generate a payment schedule based on input of loan amount, APR, and payment amount, but when I tried to run the program on my own TI-89, it gave me an error that said "Warning: overflow replaced by infinity or negative infinity." When I broke the program's functioning by pressing "ON" it consistently took me to the same place.
  • #1
TTPW
4
0
TI-89 "PAY" program, infinite loop problem?

I have tried to write a program required for class (Math Analysis, junior in high school, everyone else has an 83 or 82 but my grandmother bought me this one...so nobody else has been able to help yet) but after solving one error message (I had to unlock a variable) another problem comes up. "Warning: overflow replaced by infinity or negative infinity." When I break the program's functioning by pressing ON it consistently takes me to the same place. Here's the entire program. I bolded the spot where Error: Break takes me to. I used lowercase letters, if there is an upper case letter that's because the lower case was easy to confuse with a number.
:pay()
:Prgm
:Input "loan", b
:Input "apr", r
:Input "payment", p
:b->L
:While p (less than or equal to sign goes here)btimesr/1200
:Disp "payment too small"
Input "payment=", p
EndWhile
0->n
1+r/1200->m
While b>p
btimesp-p->b
n+L->n
EndWhile
ptimesn+b->t
t-L->i
Disp "number payments", n
Disp "last payment", b
Disp "total paid", t
Disp "interest", i
EndPrgm
 
Computer science news on Phys.org
  • #2


TTPW said:
I have tried to write a program required for class (Math Analysis, junior in high school, everyone else has an 83 or 82 but my grandmother bought me this one...so nobody else has been able to help yet) but after solving one error message (I had to unlock a variable) another problem comes up. "Warning: overflow replaced by infinity or negative infinity." When I break the program's functioning by pressing ON it consistently takes me to the same place. Here's the entire program. I bolded the spot where Error: Break takes me to. I used lowercase letters, if there is an upper case letter that's because the lower case was easy to confuse with a number.
I don't have any experience with TI-89 programming, so I'm not sure what it allows you to do. Can you have variable names with more than one letter? Your program would be easier to follow if the variable names were more suggestive of what they represent.

Also, put code inside [ code] and [ /code] tags (without the extra space that I included)
TTPW said:
Code:
:pay()
:Prgm
:Input "loan", b
:Input "apr", r
:Input "payment", p
:b->L
:While p (less than or equal to sign goes here)btimesr/1200
Does your code actually use btimesr? I would think it would be something like b * r/1200
TTPW said:
Code:
:Disp "payment too small"
Input "payment=", p
EndWhile
0->n
1+r/1200->m
While b>p
[B]btimesp-p->b[/B]
Should this be b * p - p -> b?
If you have an infinite loop here, it is because b > p and the line below isn't decrementing b to the point where b <= p.
TTPW said:
Code:
n+L->n
EndWhile
ptimesn+b->t
p * n + b -> t ?
TTPW said:
Code:
t-L->i
Disp "number payments", n
Disp "last payment", b
Disp "total paid", t
Disp "interest", i
EndPrgm
 
  • #3


Since the loop implies B>P, it's likely that B*P-P = P(B-1) > B unless P is small. Thus, B continually increases causing the infinite loop.

Mark, FYI the TI-89 uses a limited version of BASIC called TI-BASIC. (I remember the language fondly from my high school days with a TI-84, in the way that horrible experiences are sometimes remembered fondly after being done with them. It's a great language to tinker with, but once you've used a full programming language you wonder how you ever managed with it...)
 
Last edited:
  • #4


whenever I put "times" i meant the symbol. I knew using x would have made things horribly confusing and I didn't put much thought into what else I could use. Its weird how the math wouldn't come out right because it works on the 82 and 83, I'd think that they would have the same problem
 
  • #5


TTPW said:
whenever I put "times" i meant the symbol. I knew using x would have made things horribly confusing and I didn't put much thought into what else I could use. Its weird how the math wouldn't come out right because it works on the 82 and 83, I'd think that they would have the same problem
Typically, "*" is used for the multiplication symbol.

Does it work now, or is it still giving the same error? If it's still not working, I can help. But, it would be helpful to know exactly what the program is supposed to do.
 
  • #6


What is your test case? I ran your code on an 84 and ended up with an overflow.
 
  • #7


Yes its still giving the same error. What is a test case?
And the program is supposed to tell you the number payments, last payment, total paid, and the amount of interest spent after you plug in the info requested at the beginning. We're in a finance unit. Well, we were, the test is over (I borrowed another person's calculator with the working program).
 
  • #8


I.e. the inputs you used with a known answer to test the program.
 
  • #9


Ah, well thank you. APR: 18 Monthly Payment: 100 Loan: 1500
The answers weren't whole numbers. I memorized the inputs because I tested it so many times trying to figure out how to make it work. If you get answers that aren't even numbers I'll search through my homework to find the problem.
 

Related to TI-89 PAY program, infinite loop problem?

1. What is the "TI-89 PAY program, infinite loop problem?"

The "TI-89 PAY program, infinite loop problem" refers to a common issue encountered by users of the TI-89 calculator when using the built-in "PAY" program. This program is used to calculate loan payments, but it can sometimes get stuck in an infinite loop, causing the calculator to freeze and become unresponsive.

2. Why does the "TI-89 PAY program, infinite loop problem" occur?

The "TI-89 PAY program, infinite loop problem" is caused by a bug in the calculator's programming. Specifically, it occurs when the program encounters a loan with certain input values, such as a large number of payments or a high interest rate.

3. How can I fix the "TI-89 PAY program, infinite loop problem?"

There are a few potential solutions for the "TI-89 PAY program, infinite loop problem." One option is to reset the calculator by pressing the "2nd", "7", and "1" keys simultaneously. Another option is to manually end the program by pressing the "2nd" and "QUIT" keys. If these methods do not work, you may need to update your calculator's operating system or seek assistance from the manufacturer.

4. Can I prevent the "TI-89 PAY program, infinite loop problem" from happening?

While there is no guaranteed way to prevent the "TI-89 PAY program, infinite loop problem," there are a few steps you can take to reduce the likelihood of encountering it. These include updating your calculator's operating system, avoiding using the "PAY" program with very large or extreme values, and regularly resetting your calculator.

5. Is there an alternative to using the "PAY" program on the TI-89 calculator?

Yes, there are alternative loan payment calculators available for the TI-89 calculator, such as the "Mortgage Solver" program. Additionally, there are many online loan calculators that can be accessed through a computer or smartphone. These may be more reliable options for calculating loan payments than the built-in "PAY" program on the TI-89 calculator.

Similar threads

  • Computing and Technology
Replies
1
Views
2K
  • Programming and Computer Science
Replies
2
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
2K
  • Programming and Computer Science
Replies
6
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
6K
  • Programming and Computer Science
Replies
8
Views
6K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
Back
Top