2

In relationship to this thread, this is also what i am kind of trying to do but i have had a bit more leeway in this.

My problem is i am currently working on a defining program (for my ti-89 titanium) to write out the definitions of variables. However, considering i had indefinite amounts of variables to add, i thought using the define function over and over again would waste memory and processing power. So my thinking was Save the variable to another variable to be defined in a later portion of the program.

prompt x
lbl x_d_r
x_d_r->q:Goto def
lbl def
define expr(q)[1]=x

where x_d_r has no assigned value. So the program was supposed to use the defined string as a list value to be x. However the obvious error came about.

So i played around on the home screen and program screen for a bit and came across entry(1) and ans(1). See back on the ti-83 (or 84) i could basically go (If i remember correctly)

disp q*1
x->ans(1)

However ans(1) on a ti-89 titanium is based upon the last answer submitted to the homescreen. Even then, ans(1) or entry(1) gets replaced in the program by just that. Lucky me, i found a way to avoid this.

Prgm
expr(char(120)&char(22)&char(97)&char(110)&char(115)&char(40)&char(49)&char(41))
EndPrgm

For those that do not know, this is simply expressing x->ans(1) which is a way for the code to transmit ans(1) within a program without removing the code to say so.

But it still does not work as a value needs to be sent to the home screen in order for it to record properly. This is one of those advantages that the ti-84 or ti-83 i wish it still had on the titanium. So i have spent some time searching for ways how i can display values of q to the home screen from within a program. So far i learned that functions when used straight from the home screen return the value of q to the same place. However i have no way of implementing this in an actual program as the function does not wish to transmit the value to the home screen, and its rather useless within the program.

Secondly i have found this website which details methods of such ways to return values to the homescreen. While method 1 seems to hold promise, i do not seem to have any way of accessing that folder/program. Most likely because it is one that he made and has not shared its location on the pdf. I do like the expr("q"&":stop"), but q is not evaluated out so maybe i would have to rework it somehow.

While this was happening, i thought some other ideas could be using the paste key within a program but i have no idea how to implement stuff found from getkey let alone how the second and grab buttons factor in.

Or i could somehow have the ans(1) look to someplace else other than the home screen. Preferably to the i/0 screen but maybe to some other list or data matrix.

Anybody have any ideas on how to relay a value to the homescreen be it through function, pasting or something, and have the program i defined earlier define it as a value?

UPDATE+1 Ok i am beginning to question if maybe i am making it more complex than it needs to be...

After all, i am only going for just x->x_d_r[1], which is already defined elsewhere. So does it beat x->q:Goto def Lbl def Define expr(q)=x

(Or something like that which calls to a history recording program to define values?) in terms of processing speed and memory count?

Community
  • 1
  • 1
Jouster500
  • 762
  • 12
  • 25
  • If you want to refer to a variable by a string representation of its name, use the indirection operator (#). – Timtech Mar 17 '15 at 23:57
  • I tried doing x->#q but it does not appear to work. Can i get the proper syntax as all resources, both here and in the ti-89 titanium manual are vague and unclear to me. – Jouster500 Mar 18 '15 at 11:49

1 Answers1

3

Got it. See here for what i was really trying to do.

So as an explanation of what the main problem was again, i wanted to be able to post a string value of q to be defined by another value of x.

The expr( function is quite a powerful tool on the ti-89 and like the person in that other forum, underestimated it. See what the person was trying to do was

InputStr "Function:",f(x)
expr(f)→f(x)  

And was later answered by reworking it as

InputStr "function", n
expr(n & "->f(x)")

The expression tool just simply expresses what is in the parentheses. So during break periods in school today, i reworked in my head thinking "What if i tried rewriting the parenthesis out so it reads Expr("x->"&String(q))?

Lo-and-behold it works. Tested it with the fuller version of define to get

td()
Prgm
Prompt X
x_d_r->q
expr("x->"&string(q)&"[1]")
Disp x_d_r[1]
Delvar x_d_r
EndPrgm

Tried, tested and true. Works all the way. See what i think is happening is that anything that is not within the quotes is evaluated immediately in an expression while the the quoted objects are simply expressed and added later in response to the "&" key. Furthermore it makes sense if i was to describe it more with english; "Express x to be stored into the string of q's respective table".

While for variables sake i would have to look into ways to make x_d_r local only to the program without compensating the fact that the x_d_r portion is not considered a store value when executing x_d_r->q. But knowing what i know now i could probably do

expr("q"+"x_d_r"&->a)
expr("x->"&string(a)-"q"&"[1]")

In order to bypass that problem.

Jouster500
  • 762
  • 12
  • 25
  • Yay. answered my own question. – Jouster500 Mar 18 '15 at 19:12
  • I could probably share the define program once I am finished with it at some point. Attempt is for me to use the defining program within actual physics programs in order to manage complex or organize simple problem variables. – Jouster500 Mar 18 '15 at 20:40