- How to Enter the Value of a Variable into a String?
- 02 Nov 2014 07:50:04 am
- Last edited by msbmteam on 02 Nov 2014 09:11:34 am; edited 2 times in total

Hey, everyone! While writing a polynomial differentiation program, I've come across a problem that I can't figure out. Say I have "4AX^3" set to Str1, and A = 3. How can I set the string to "12X^3" with TI-BASIC?

Here is the beginning of my program:

Next, the program stitches these strings together to create an equation. This is bulky, so I didn't write out the code in this post. Ultimately, some variant of "AX^4+BX^3+CX^2+DX+E" is set to Str6 and then to y1. (If any of the coefficients equal 0, then the term is removed from the string.)

Here is why I used strings. Next, I want the program to calculate the derivative of the equation using the Power Rule. So here is what follows:

I run the string stitching part of the program again, and ultimately, some variant of "4AX^3+3BX^2+2CX+D" is set to Str6 and then to y2.

Notice that the variables stay in y1 and y2, and I want the values of these variables in there rather than the letters.

If I try

then string 1 is literally "4AX^3".

If I try

then there is a data type mismatch error.

I've also looked at the commands expr, inString, but they also give me data type mismatches when I try to set them to a string. My final plan was to edit some lists, run a cubic regression, set RegEQ to y1, and use Equ►String to set it to a string. However, [RegEQ] is only available on the Cemetech SourceCoder 3, and when it's evaluated, it gives me something like "0.3rr0207," where r is the radian sign. I have a TI-84 Plus Silver Edition.

Any ideas?

Here is the beginning of my program:

**Code:**```
:Disp "X^4 COEFFICIENT:"
```

:Input A

:Disp "X^3 COEFFICIENT:"

:Input B

:Disp "X^2 COEFFICIENT:"

:Input C

:Disp "X COEFFICIENT:"

:Input D

:Disp "Y-INTERCEPT:"

:Input E

:

:"AX^4"→Str1

:"BX^3"→Str2

:"CX^2"→Str3

:"DX"→Str4

:"E"→Str5

Next, the program stitches these strings together to create an equation. This is bulky, so I didn't write out the code in this post. Ultimately, some variant of "AX^4+BX^3+CX^2+DX+E" is set to Str6 and then to y1. (If any of the coefficients equal 0, then the term is removed from the string.)

Here is why I used strings. Next, I want the program to calculate the derivative of the equation using the Power Rule. So here is what follows:

**Code:**```
:"4AX^3"→Str1
```

:"3BX^2"→Str2

:"2CX"→Str3

:"D"→Str4

:"0"→Str5

I run the string stitching part of the program again, and ultimately, some variant of "4AX^3+3BX^2+2CX+D" is set to Str6 and then to y2.

Notice that the variables stay in y1 and y2, and I want the values of these variables in there rather than the letters.

If I try

**Code:**`"4AX^3"→Str1`

If I try

**Code:**`4AX^3→Str1`

I've also looked at the commands expr, inString, but they also give me data type mismatches when I try to set them to a string. My final plan was to edit some lists, run a cubic regression, set RegEQ to y1, and use Equ►String to set it to a string. However, [RegEQ] is only available on the Cemetech SourceCoder 3, and when it's evaluated, it gives me something like "0.3rr0207," where r is the radian sign. I have a TI-84 Plus Silver Edition.

Any ideas?