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

Click For Summary
SUMMARY

The discussion centers on the challenges faced when attempting to save the result of an embedded function to a variable in the TI-89 calculator. The user describes issues with storing function outputs, specifically when using the syntax `:Funct(10,12)=>k`, which results in storing the function call instead of the output. The user has explored various methods, including using `expr(string)` and defining functions with `Define`, but continues to encounter execution order problems. The primary need is to execute a function and store its result for further calculations without resorting to programming workarounds.

PREREQUISITES
  • Understanding of TI-89 calculator programming syntax
  • Familiarity with function definitions and local variables in TI-89
  • Knowledge of execution order in programming
  • Experience with mathematical functions and their outputs
NEXT STEPS
  • Research TI-89 function execution and variable storage techniques
  • Explore the use of `expr()` in TI-89 programming for dynamic evaluations
  • Learn about defining and using local variables in TI-89 functions
  • Investigate alternative methods for capturing function outputs in TI-89
USEFUL FOR

Mathematicians, physicists, and TI-89 users who are programming complex functions and need to effectively store and manipulate function results for advanced calculations.

qqqqq
Messages
1
Reaction score
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
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?
 

Similar threads

Replies
1
Views
5K
  • · Replies 2 ·
Replies
2
Views
29K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
65
Views
5K
  • · Replies 22 ·
Replies
22
Views
2K
Replies
3
Views
23K
  • · Replies 4 ·
Replies
4
Views
9K
Replies
10
Views
5K