I am wondering if anyone has a way to do algebra in a program with multiple X's and covers the most things as possible because I made one that tries but doesn't use strings if anyone could help that would be appreciated Thanks!
Right now I have strings in a beta but I need to turn all X's into Y's but I'm having difficulty with data type errors.
Can you give an example (code) of what you are trying to do? I might have a way to do it, but I want to make sure that I'm doing the correct thing.
Here is the latest version. It comes in two parts.
Part 1
Title: ALGEBRA2
ClrHome
While 1
0->M
0->X
0->Y
Repeat inString(Str1,"X") and inString(Str1,"="
Input Str1
End
Str1->v
Output(8,1,"1"
prgmALGEBRAB
Output(8,1,"2"
Str4->w
Str5->u
Repeat v or w or u
X+1->X
Y-1->Y
End
If v
Disp X
If w
Disp Y
If u
Disp 0
Output(8,1," " //1 Space
End
Part 2
Title: ALGEBRAB
Str1->Str4
"X"->Str2
"Y"->Str3
length(Str2->J
1->W
While inString(Str4,Str2,W
inString(Str4,Str2,W->W
Str3
If W>1
sub(Str4,1,W-1)+Ans
If W+J<1+length(Str4
Ans+sub(Str4,W+J,1+length(Str4)-(W+J
Ans->Str4
W+length(Str3->W
End
Str1->Str5
"X"->Str2
"M"->Str3
length(Str2->J
1->W
While inString(Str4,Str2,W
inString(Str4,Str2,W->W
Str3
If W>1
sub(Str4,1,W-1)+Ans
If W+J<1+length(Str4
Ans+sub(Str4,W+J,1+length(Str4)-(W+J
Ans->Str4
W+length(Str3->W
End
It doesn't try to do it backwards so it can't take decimals as a part of the question and/or answer
I don't know this for sure, but I'm wondering if the error is coming from changing Str4 while the while loop is running.
While inString(Str4,Str2,W
inString(Str4,Str2,W->W
....................................
Ans+sub(Str4,W+J,1+length(Str4)-(W+J
Ans->Str4
Can you tell me where it goes when you hit Goto for the error? Usually it will be somewhere around there and could help us find where to look. I hope you can get it figured out!
I am not experiencing the error from there but I did fix it with whats in there but I'm just having trouble with decimals and time that it takes to finish
I guess I'm a little confused still; Can you maybe provide some examples of inputs and expected outputs?
I'm trying to make a program that can solve algebra (find x) and tell me what it is but it only can give an output that is a whole number. (ex. x5=25 x=5) But when the answer is a decimal it goes over it (ex. x5=25.5 x=?) and I am having trouble doing it. The furthest I've gotten is allowing it to have x in multiple places but that's the furthest I've gotten so far.
TI-BASIC has a built in function for solving algebra equations. This program will solve for X and output it as a fraction if it is not an integer. If you want decimal output, get rid of the "▶Frac." (Y0 means Y0, the graphing variable)
PROGRAM:SOLVE
:Input "0=",Str0
:Str0→ Y0
:Disp "X=
:solve(Y0,X,0)▶Frac
However, this program requires that the equation is in "0=" form. To fix this, we can use string manipulation:
:Input Str0
:inString(Str0,"=
:sub(Str0,1,Ans-1)+"-("+sub(Str0,Ans+1,length(Str0)-Ans→Y0
:Disp "X=
:solve(Y0,X,0)▶Frac
If you use this program, make sure to match all parentheses, otherwise it will behave weirdly.
Here are some sample runs:
prgmA
?X5=25
X=
5
prgmA
?7X-2=2(X+3)
X=
8/5
Edit: This program and many others are contained in my Math Program. If you have a link cable, you can download it.
Thank you for your help! This program is really useful!