TI-89 how to save result of an embedded funtion to a variable

In summary, the problem the author is having is that whenever he tries to call a function, it stores the function call itself to the variable, rather than the result.
  • #1
qqqqq
1
0
Hello, I do a lot math and physics work, (predominantly advanced fundamental theories), and have consistently been hindered by a particular issue when it comes to a few of my defined functions. I feel like it would be a kind of "order of execution" issue with a simple solution, but though I've scoured the user manual, searched the internet, and even called TI programming support, I haven't been able to figure it out.
Essentially, the Issue I run into is that when I program a function [and part of the issue might be that I do want it to be a "function" and not a "program"], at times, I need to call other functions [or sometimes, recall the function I am currently editing, itself] and actually execute the function completely, and store only the result of the function to a local variable. The problem is that whenever I try to call a function, it stores the function call itself to the variable, rather than the result. For instance, I might have a function like Funct(x,y) which gives let's say {0,1} for x=10, y=12 as an output if executed, so normally, I'd try to store the function/result to a variable like
:Funct(10,12)=>k [assuming of course all the variables are properly defined]
now the issue is that when I go to actually use k in something (the result, I mean; namely {0,1}), like, let's say I want to display the result in a list with other saved variables as an output, it doesn't work right. For instance, if I want to output {k,x,y} which should read {{0,1},10,12} and would seem to be perfectly valid, it would instead give error messages, predominantly b/c (I believe) it's actually trying to execute {Funct(x,y),x,y}, or similar. Now these have just been some examples, however, in other instances for other applications I run into a similar issue.
Is there any way to execute and save some function's (or really any other such statement's) result to a variable, without having to define it as a program and utilize complicated workarounds with external variables (I know such things aren't that complicated, but it's more-so a matter of wanting to call the result as a function for further calculation rather than a programming I/O display)
I have also come up with a few tricks which haven't worked either. For instance, defining my function call as a string, and then using "expr(string)" (which is supposed to immediately execute the string, even within the code), but once again the issue is that saving expr(string)->k or similar just saves the call to the expression, not the actually executed result itself. I believe I've also tried using define to evaluate another function, and return the results of the called function as a result of the defined function (which helps a little in certain cases), but I still end up running into a similar issue when trying to store the result of this newly defined function. For instance, I could use :.Define k(x,y)=Func :Funct(x,y) :EndFunc which might at least execute the internal "Funct(x,y)" part, but I'd still then have to save the result of k(x,y)->kb as I would have had to with Funct(x,y) before.
If it's at all helpful, here's a quick simple function which I ran into the issue with most recently [it simply takes a base idea of numbers, and displays them how they would be coded with regards to an arbitrary radix]. The output should read something like {{{#,#},#},#}, where each # corresponds to the position of a particular symbol in the radix (like (r,n)=(16,12) would mean "12 in hexadecimal" and would output something like {0,12} where 'C' [normal hex symbol for 12] would not be inputted directly, but instead, an arbitrary symbol designation would be outputted, meaning basically 'the 12th symbol in the codec'; Or for example (2,8) would give {{{1,0},0},0}. To clarify, I don't need help with how to program this code in some other way, or how to get this code to work, or other functions which achieve this task more easily/better. All I need help with is the above order of execution question, this is just an example so that whoever needs/wants to, may be able to replicate my issue and see what I mean. [also, as a convention I'm using ":" to indicate line breaks; "=>" to indicate "store"; and (>/=) to indicate "greater than or equal to"]
roll2(r,n) :Func :.Local i,j,k,k2 :0=>i :n=>j :While j (>/=) r :j-r=>j :i+1=>i :EndWhile :n-i*r=>k2 :If n>0 Then :roll2(r,i)=>k :{k,k2} :Else :0=>k :{k,k2} :EndIf :EndFunc
Any help or ideas would be greatly appreciated, this issue has been driving me crazy for a while now, and I keep on running into variants of it.
 
Computer science news on Phys.org
  • #2
Thanks for the post! Sorry you aren't generating responses at the moment. Do you have any further information, come to any new conclusions or is it possible to reword the post?
 

1. How do I save the result of an embedded function to a variable on my TI-89 calculator?

To save the result of an embedded function to a variable on your TI-89 calculator, you can use the "sto>" button. After entering the function and its arguments, press the "sto>" button followed by the variable you want to save the result to. This will store the result in that variable for future use.

2. Can I save the result of an embedded function to a variable using a different method?

Yes, you can also use the "store" command to save the result of an embedded function to a variable. Simply type in "store" followed by the variable name, an "=" sign, and then the function and its arguments. This will store the result in the specified variable.

3. Is there a limit to the number of variables I can save the result of an embedded function to?

No, there is no limit to the number of variables you can save the result of an embedded function to on your TI-89 calculator. You can create and save as many variables as you need to store your results.

4. Can I use previously saved variables in an embedded function?

Yes, you can use previously saved variables in an embedded function on your TI-89 calculator. Simply enter the variable name in place of the argument in the function. The calculator will use the value stored in that variable for the calculation.

5. How do I access the saved result of an embedded function on my TI-89 calculator?

To access the saved result of an embedded function on your TI-89 calculator, simply recall the variable you saved the result to. You can do this by pressing the "2nd" button followed by the "sto>" button to access the variable menu. Then, select the variable you want to recall to view the saved result.

Similar threads

Replies
1
Views
4K
  • Programming and Computer Science
2
Replies
65
Views
2K
  • Programming and Computer Science
Replies
22
Views
872
  • Computing and Technology
Replies
2
Views
28K
  • Programming and Computer Science
Replies
4
Views
500
Replies
3
Views
1K
  • Programming and Computer Science
Replies
31
Views
2K
Replies
4
Views
286
  • Set Theory, Logic, Probability, Statistics
Replies
10
Views
1K
  • Programming and Computer Science
Replies
10
Views
4K
Back
Top