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
albisher


Newbie


Joined: 02 May 2006
Posts: 14

Posted: 02 May 2006 03:18:32 am    Post subject:

hi i am new use having problems when i want to enter variables

let .. x1, x2, x3, .... xn
are the variables needed to be input by user

if i want to deal using for loop

i do not know how to do it!
i am usin 89-titanum in programmin numerical methods for engineering

ok ... i have it like this
user will input n,a,b
then calculater find h
and then

for i,0,n
clrio
a+h*i->z
z->x[i]
f(z)->fx[i]
disp "xi=",x[i]
disp "f(xi)=",fx[i]
pause
1+i->i
endfor


but it is giving ERROR:
index out of range

it is reterning me to the line
z->x[i]

any ideas ? pls help ;>
Back to top
IAmACalculator
In a state of quasi-hiatus


Know-It-All


Joined: 21 Oct 2005
Posts: 1571

Posted: 02 May 2006 07:00:08 am    Post subject:

Since you're doing [font="courier new"]For I,0,N, it tries to store Z[font="courier new"] to X[I][font="courier new"], which is, at this moment, zero. Storing to list element zero would definitely cause that error of yours.
Back to top
albisher


Newbie


Joined: 02 May 2006
Posts: 14

Posted: 02 May 2006 09:04:05 am    Post subject:

then how do i need to get it!!

is there any good explenation about the way i deal with arrays?

what i understand ... my error because i start from 0

but when i changed program .. for i,1,n
still there is another error with same line

it is saying : Dimention
Back to top
leofox
INF student


Super Elite (Last Title)


Joined: 11 Apr 2004
Posts: 3562

Posted: 02 May 2006 09:30:07 am    Post subject:

You have to make sure the list you are using has a size. If the size is 0 and you are trying to store to element 1, it will say err:dimension.
You have to enter the 68K equivalent of N->dim(X
Back to top
bukwirm


Member


Joined: 06 Dec 2005
Posts: 233

Posted: 02 May 2006 09:31:16 am    Post subject:

In TI-BASIC list indexes start at 1, not 0. As for the "Dimension" error, make sure the list exists and has at least 1 element.

For more details about TI lists/matrices, see my signature, then ask if you still have specific questions.
Back to top
albisher


Newbie


Joined: 02 May 2006
Posts: 14

Posted: 02 May 2006 11:35:27 am    Post subject:

ok, let me explain it more deeply.

i need to fill

x0, x1, x2, ..... xn

so i chose to use for loop

as a simple thing of what i am doing

input "n=", n @nujmber of segments
input "a=", a @1st element value
input "b=", b @last element value

(b-a)/n -> h @ step size between each element

for i,1,n+1

a+h*(i-1)->z
z->x[i]
1+i->i

endfor

..........

will this be good way of thinking in ti-89 titanium basic programming lang?
Back to top
IAmACalculator
In a state of quasi-hiatus


Know-It-All


Joined: 21 Oct 2005
Posts: 1571

Posted: 02 May 2006 05:12:35 pm    Post subject:

leofox wrote:
You have to enter the 68K equivalent of N->dim(X[post="77774"]<{POST_SNAPBACK}>[/post]
Which is [font="Courier New"]newList(N).
Back to top
albisher


Newbie


Joined: 02 May 2006
Posts: 14

Posted: 04 May 2006 09:18:59 am    Post subject:

:>

finally i unerstod it hehehe thanks friends

input "n=", n
newList(n)

input "a=", a
input "b=", b

(b-a)/n -> h

for i,1,n+1
a+h*(i-1)->z
z->x[i]
endfor


this willll helllllp meeee looooot
;]

i am getting better each day even that is so slow but .. i am being good
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 04 May 2006 09:28:53 am    Post subject:

newList(n)->x.

Actually, {}->x will work too in your case, since storing to an element one past the end of the list will append that element to the end. For example {1,2} -> x: 3 -> x[3] will make x = {1,2,3}.
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