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. 68k Calculator Basic => TI-BASIC
Author Message
doomlord289


Newbie


Joined: 03 Oct 2005
Posts: 15

Posted: 04 Oct 2005 02:47:42 pm    Post subject:

i need to know whats wrong with this code:

Code:
Lbl  eqocir
ClrIO
Input  "X1=",a
Input  "Y1=",b
Input  "X2=",c
Input  "Y2=",d
Input  "X3=",e
Input  "Y3=",f
{a,c,e}»l1
{b,d,f}»l2
SortA  l1,l2
l2[2]-l2[1]»g
l1[2]-l1[1]»h
If h=0 Then
0»i
Goto  part3
Else
g/h»i
EndIf
If i=0 Then
{0}»l4:2»p:Goto  part3
Else
0»p
ªi^(ª1)»i
Goto  part3
EndIf
Lbl  part3
(l2[2]+l2[1])/2»j
(l1[2]+l1[1])/2»k
j-i*k»l
{ªi}»l3
If p=2 Then
{k}»l5:Goto  part4
Else
{l}»l5:Goto  part4
EndIf
Lbl  part4
l2[3]-l2[1]»g
l1[3]-l1[1]»h
If h=0 Then
0»i:Goto  part5
Else
g/h»i
EndIf
If i=0 Then
1»p:Goto  part5
Else
ªi^(ª1)»i
Goto  part5
EndIf
Lbl  part5
(l2[3]+l2[1])/2»j
(l1[3]+l1[1])/2»k
j-i*k»l
If p=1 Then
{l4[1],0}»l4
{l3[1],1}»l3
Goto  part6
Else
{l4[1],1}»l4
{l3[1],ªi}»l3
Goto  part6
EndIf
Lbl  part6
If p=1 Then
{l5[1],k}»l5
Goto  part7
Else
{l5[1],l}»l5
Goto  part7
Lbl  part7
listÐmat(l3)
listÐmat(l4)
listÐmat(l5)
l3*l4»l6
l6^(ª1)*l5»m1
matÐlist(m1)
m1[1]»m
m1[2]»n
(l1[3]-m)^2+(l2[3]-n)^2»o
ClrIO
Disp  "H=",m
Disp  "K=",n
Disp  "R®=",o
Pause  
EndIf
Goto  end

i get a circular definition error no matter what number i put in. someone please tell me what im doing wrong!!! :confused:

the error occurs here:

Code:
{l4[1],1}»l4
{l3[1],ªi}»l3
Goto  part6
EndIf
Lbl  part6
If p=1 Then
{l5[1],k}»l5
Goto  part7
Else
{l5[1],l}»l5
Goto  part7
Lbl  part7
listÐmat(l3)
listÐmat(l4)
listÐmat(l5)
l3*l4»l6
l6^(ª1)*l5»m1
matÐlist(m1)
m1[1]»m
m1[2]»n
(l1[3]-m)^2+(l2[3]-n)^2»o
ClrIO
Disp  "H=",m
Disp  "K=",n
Disp  "R®=",o
Pause  
EndIf
Goto  end

is it that i cant put list4 item 1 into list4 on the 89? :confused:


Last edited by Guest on 04 Oct 2005 04:35:30 pm; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 04 Oct 2005 03:10:52 pm    Post subject:

As much as I'd like to help, I can't say that I'm familiar with this dialect
of TI-Basic. It's something we haven't seen for a while in these forums.

All I can provide is this: At some point you are trying to assign one variable to itself, and the recursion that results is the issue. See if this happens at one of the places where you work with lists 3 and 4. This is me out on a limb—I have no knowledge that it will work.


Last edited by Guest on 04 Oct 2005 03:13:48 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 04 Oct 2005 04:35:55 pm    Post subject:

There are several problems in that code, which may or may not be what your error is.

1. before you goto part3, in some branches of the code you don't initialize p. Same thing before lbl part5.

2. You're jumping from the Then part of an If statement into the Else part. This may not be causing the error, but isn't a good idea in general.

3. list>mat(L3) and similar statements have no effect by themselves like that. They return a matrix, so you can say "list>mat(L3) -> M3" but as it is the code won't do anything.

4. Not only that, but m1 is not a matrix as you define it in your code. You stored a number to it. So mat>list(m1) will cause an error.

5. In general, the way you use Gotos and Labels is ineffective. For example, the following bits of code do the same thing:


Code:
If foo=1 Then
...
Goto bar
Else
...
Goto bar
EndIf
Lbl bar


Code:
If foo=1 Then
...
Else
...
EndIf
In fact, you can get rid of all of the gotos and labels in that program.
Back to top
doomlord289


Newbie


Joined: 03 Oct 2005
Posts: 15

Posted: 20 Oct 2005 05:51:16 pm    Post subject:

i have changed the code removing all the labels and gotos (except the first and last because this is just a section of a larger program):

Code:
Lbl  eqocir
ClrIO
Input  "X1: ",a
Input  "Y1: ",b
Input  "X2: ",c
Input  "Y2: ",d
Input  "X3: ",e
Input  "Y3: ",f
{a,c,e}»l1
{b,d,f}»l2
SortA  l1,l2
l2[2]-l2[1]»g
l1[2]-l1[1]»h
If h=0 Then
0»i
Else
g/h»i
EndIf
If i=0 Then
{0}»l4:2»p
Else
0»p
ªi^(ª1)»i
EndIf
(l2[2]+l2[1])/2»j
(l1[2]+l1[1])/2»k
j-i*k»l
{ªi}»l3
If p=2 Then
{k}»l5
Else
{l}»l5
EndIf
l2[3]-l2[1]»g
l1[3]-l1[1]»h
If h=0 Then
0»i
Else
g/h»i
EndIf
If i=0 Then
1»p
Else
ªi^(ª1)»i
EndIf
(l2[3]+l2[1])/2»j
(l1[3]+l1[1])/2»k
j-i*k»l
If p=1 Then
{l4[1],0}»l4
{l3[1],1}»l3
Else
{l4[1],1}»l4
{l3[1],ªi}»l3
EndIf
If p=1 Then
{l5[1],k}»l5
Else
{l5[1],l}»l5
EndIf
listÐmat(l3)»m3
listÐmat(l4)»m4
listÐmat(l5)»m5
m3*m4»m6
{l6^(ª1)*l5}»l1
l1[1]»m
l1[2]»n
(l1[3]-m)^2+(l2[3]-n)^2»o
ClrIO
Disp  "H=",m
Disp  "K=",n
Disp  "R®=",o
Pause  
Goto  end

the error comes up here when i hit goto:

Code:
1»p
Else
ªi^(ª1)»i
EndIf
(l2[3]+l2[1])/2»j
(l1[3]+l1[1])/2»k
j-i*k»l
If p=1 Then
{l4[1],0}»l4

that is the display on the screen

this is so far the only bug in my whole program
click here to go to the download page
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 20 Oct 2005 06:46:32 pm    Post subject:

First of all:
Code:
If i=0 Then
{0}»l4:2»p
Else
0»p
ªi^(ª1)»i
EndIf
In one of these alternatives, you don't define what l4 should be. This will cause an error.

Second error that I notice is in

Code:
listÐmat(l3)»m3
listÐmat(l4)»m4
listÐmat(l5)»m5
m3*m4»m6
. This stores a 1x3 matrix to m3, a 1x3 matrix to m4, then tries to multiply them. I don't foresee that working.

You could optimize lots of that, in particular with the when() command (look it up if you don't know it).
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 UTC - 5 Hours

 

Advertisement