I don't know if this is possible already, but something like this:
vars A, B, and C are equal to 1, 2, and 3 respectively.
Can you turn that data into string1 equaling "123"?
Yes. Step 1: Use NumToString to convert each number into a string. Step 2: Concatenate them.


Code:
Disp det(1,A)+det(2,B)+det(3,C
Thanks, KermM! I will use this on a program.
I found this thread contained exactly the question I wanted to post. So thanks for the answer from me too!

The trouble is, when I try to store det(1,C) into Str3 it produces
ERROR: DATA TYPE.

C is a real variable (in fact, a positive integer in the examples I've tried). Why can the det(1 command display the value of C as a string, but not (apparently) store it as a string? Or is there a way round this?
Are you doing this in a program or from the homescreen? It will only work in a program. Are you saying that ":Disp det(1,C" in a program shows the string for C but ":det(1,C0>Str3" in a program generates that DATA TYPE error? Also, if you get "ERR", it sounds like you might not have Doors CS installed and/or running.
Yes, it's in a program; yes, Doors CSE 8 is running with Hybrid Libraries enabled; and yes, the det command works with Disp but not with ->.
In fact, experimenting with it, I even got :Disp det(1,C will display the value of Z instead of C, if Z is the last number calculated, but works correctly if I place it earlier in the program, directly after C is calculated.

?!?
OldMathTeacher wrote:
Yes, it's in a program; yes, Doors CSE 8 is running with Hybrid Libraries enabled; and yes, the det command works with Disp but not with ->.
In fact, experimenting with it, I even got :Disp det(1,C will display the value of Z instead of C, if Z is the last number calculated, but works correctly if I place it earlier in the program, directly after C is calculated.

?!?
Ohhh, Doors CSE rather than Doors CS. Doors CSE does not have the same det(1) command (see the Doors CSE hybrid library list), so you'll have to use this widely-exploited pure TI-BASIC trick that converts the real number N into the string Str1:
Code:
:{0,1→L₁
:{0,N→L₂
:LinReg(ax+b) Y₁
:Equ►String(Y₁,Str1
:sub(Str1,1,length(Str1)-3→Str1
Brilliant! I can see why that would work, but could never have thought of it myself. Many thanks. I was basically seeking to reverse the expr( command so I could display C on the graph screen using Text(.

Thanks again.
Wait a second, you can still display C on the graphscreen without converting it to text. All of these work:
Code:
:Text(1,1,"C=",C
:Text(21,1,C
:Text(31,1,C,"=C
Yes, but it was not so easy to concatenate the value of C into a longer string like that. Or so it seemed to me anyway. Sorry for not making it clearer.

Code:
:Str0
:If C!=abs(C
:Ans+"-
:For(X,1,1+int(log(abs(C
:Ans+sub("0123456789",1+int(10fpart(.1abs(C)^X)),1
:End


Of course, there is always this too. Smile
Any way works, really.

EDIT: Added '-' functionality: Thanks Kerm!
The limitation of that is that it only works with non-negative integers. It could be extended to all integers and then to all reals, but it would end up being a lot more code than the LinReg solution. Thanks for another way to do it, though, as that might certainly help some people.
  
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
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement