Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
United-TI Archives -> TI-Basic
 
    » Goto page 1, 2  Next
» View previous topic :: View next topic  
Author Message
MeBeatYou


Member


Joined: 29 Sep 2005
Posts: 178

Posted: 05 Apr 2006 01:35:21 pm    Post subject:

Ok, I am making a code to split the middle terms of quadratic equations. The original equation will look like:
Ax(squared) + Bx + C
The resulting equation should like like this:
Ax(squared) + Bx + Cx + D
This basically splits the middle term into 2 seperate terms which can be added together to make the middle term of the first equation, and that can be multiplied together to give you the product of the first and last terms. Here is the code I have made, but for some reason it does not work at all :dry: I'm getting tired of my codes being retarded and not working Mad 0x5


Code:
ClrHome
Disp "AX+BX+C","To","AX+BX+CX+D"
Prompt A,B,C
ACZ
For(,1,Z
Z/Y
If Y+=B:Goto A
End
For(J,1,Z
JS
Z/SU
If S+U=B:Goto A
End
Lbl A
ClrHome
Disp "MIDDLE TERMS ARE"
Output(2,1,
Output(2,8,Y
Pause
ClrHome


( is the squared symbol, is the sto symbol, is the theta symbol. Sorry, for some reason Brazucs' Code thing would not work for me at all, I couldn't get the page to come up)

Some help with this would be nice... And if somebody optimizes my code, please explain it because I do not know most of the commands yet...


Last edited by Guest on 05 Apr 2006 04:32:38 pm; edited 1 time in total
Back to top
Plague


Member


Joined: 28 Mar 2006
Posts: 242

Posted: 05 Apr 2006 05:32:48 pm    Post subject:


Code:

ClrHome
Disp "AX[color=red]^2[/color]+BX+C
Disp "To
Disp "AX[color=red]^2[/color]+BX+CX+D
Prompt A,B,C
AC[color=red]->[/color]Z
DelVar Q
For(Q,1,Z
Z/Q[color=red]->[/color]Y
If (Y+Q)=B
Goto A
End
DelVar J
For(J,1,Z
Z/([color=red]-[/color]J[color=red]->[/color]U
If ([color=red]-[/color]J+U)=B
Goto A
End
Lbl A
ClrHome
Disp "MIDDLE TERMS ARE
Output(2,1,Q
Output(2,8,Y
Pause
ClrHome

*Red -> is the sto button, and red - is the negetive symbol, red ^2 is squared.

This is a more optimized code, but im not sure if it does what you want. Let me mess with it some more.

EDIT:
This is my input and the answer it gave me, is it what it should be?

A=2
B=3
C=5
Answer was: 11 1


Last edited by Guest on 05 Apr 2006 05:48:45 pm; edited 1 time in total
Back to top
MeBeatYou


Member


Joined: 29 Sep 2005
Posts: 178

Posted: 05 Apr 2006 06:11:32 pm    Post subject:

No... if you input
A-2
B-3
C-5
That should not factor at all anyways.. It only works on factorable trinomials o_O ... but its supposed to multiply A and C (and A*C=Z)... and then its supposed to find 2 numbers that multiply together to give you Z, but add together to give you B.. It's not doing this at all and I'm not sure why

SOMEBODY PLEASE HELP Mad


Last edited by Guest on 05 Apr 2006 06:55:45 pm; edited 1 time in total
Back to top
MeBeatYou


Member


Joined: 29 Sep 2005
Posts: 178

Posted: 05 Apr 2006 07:13:58 pm    Post subject:


Code:
Input "ADDS TO ",A
Input "MULTIPLYS TO ",B
-1->C:-1->D
While C<0
Input "LOWER BOUND ",C
End
While D<0
Input "UPPER BOUND ",D
End
C->X
C->Y
While Ans
ClrHome
Disp X,Y,X+Y,XY
If X+Y=A:Then
If XY=B:Then
Output(1,8,"-->"
Output(2,8,"-->"
Disp "","     > SUCCESS <"
Output(1,1,"
Return
End:End
X+1->X
If X>D:Then
C->X:Y+1->Y
End
If Y>D:Then
Disp "","        > FAIL <"
Output(1,1,"
Return
End
End


What exactly does this do? It doesn't make much sense to me

P.S. I put in the STO signs Plague :biggrin:
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 05 Apr 2006 07:54:40 pm    Post subject:

Where did you get it? Do you not understand the code or the concept?
Back to top
MeBeatYou


Member


Joined: 29 Sep 2005
Posts: 178

Posted: 05 Apr 2006 08:15:09 pm    Post subject:

i got it from ticalc.org under TI-83 plus\basic\programs\math\algebra\add2multiply

It's supposed to do what i need to do, as i posted a couple posts before now, but i cant figure out how it works. I don't know what the bounds or for or what this does at all... and the upper bound input doesnt even work :hmpf:

Think you could right me a code to do what i need? Ax^2 + Bx + C ... it needs to multiply A and C and find 2 numbers which multiply together to give u (A*C) and they add up to give you B... I can't figure out how to do it.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 05 Apr 2006 08:47:58 pm    Post subject:

You could've provided an actual link to click on. :)

[font="courier new"]Prompt A,B,C
solve(BX-X-AC,X,0
Disp Ans
B-Ans
Back to top
MeBeatYou


Member


Joined: 29 Sep 2005
Posts: 178

Posted: 06 Apr 2006 10:41:16 am    Post subject:

Is there a different way that your code can be put? I put in the problem (just as an example) which I picked at random. I came across one that said 81X^2+108X+36 and when i put it into the program, I got "54.00002812" and "53.99997188"... And I know it factors into (9x + 6)(9x + 6)

Does it not work on square trinomials? What I'm simply looking for is a program that can factor all polynomials FOR me, and your code is as close as I have right now... It worked perfect until I used this one example. Any help?
Back to top
trigkid213


Member


Joined: 30 Mar 2006
Posts: 208

Posted: 06 Apr 2006 01:36:16 pm    Post subject:

Do you have either the app PolySmlt or the Casio fx-115MS scientific calculator? Both of these will factor polynomials.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 06 Apr 2006 01:49:48 pm    Post subject:

But they offer no programming experience. ;)

[font="courier new"]ClrHome
Disp "ax+bxy+cy","
Input "a=",A
Input "b=",B
Input "c=",C
abs(A
For(D,Ans,‾Ans,‾1
D-not(D→D
If not(fPart(A/Ans
Then
int(√(abs(C
For(E,‾Ans,Ans
E+not(E→E
If B=AnsD+AC/(AnsD) and not(fPart(C/Ans
Goto 0
End
End
End
Output(7,4,"NO FACTORS
Stop
Lbl 0
gcd(abs(D),abs(C/Ans
{Ans,D/Ans,C/E/Ans,A/D[color=gray]/
E That last / should be a comma!
ClrHome
Disp "a(bx+cy)(dx+ey)","
For(A,1,5
Disp sub("abcde",A,1)+"=
Output(A+2,3,Ans(A
End
[/color]

Be warned that this won't factor by grouping, but see if it works.

Last edited by Guest on 20 Apr 2006 10:20:41 am; edited 1 time in total
Back to top
MeBeatYou


Member


Joined: 29 Sep 2005
Posts: 178

Posted: 06 Apr 2006 02:47:48 pm    Post subject:

*Sigh* no, it does not work... I'm sorry to be difficult, but I really need this. PLYSMLT App does not factor polynomials, just gives the answer to them :dry: ... and I prefer it in a program anyways.

EQUATION: AX^2 + BX + C
CALC OUTPUT: (AX +- B)(CX +- D)

Does this make any sense?


Last edited by Guest on 06 Apr 2006 03:10:34 pm; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 06 Apr 2006 03:14:20 pm    Post subject:

Great. Could you please tell me what part of it doesn't work? ;)

Is (ax+b)(cx+d) so far from a(bx+cy)(dx+ey)?

Give me an example input that fails.

[EDIT]

Just so you know, (9x+6)(9x+6) is not fully factored. Any math teacher would agree.


Last edited by Guest on 06 Apr 2006 03:18:17 pm; edited 1 time in total
Back to top
MeBeatYou


Member


Joined: 29 Sep 2005
Posts: 178

Posted: 06 Apr 2006 03:25:11 pm    Post subject:

I realize that... about (9x + 6)^2 ...

everytime I run your program I got ERR: Break, for starters... and when i press GOTO, it takes me to


Code:
Output(A+2,3,Ans(A
And im not sure why...

[EDIT] I put ther numbers 1, 5, 6 in for a,b,c and my answers (from a to d because E is where i get error) are 1,1,3,.5. I do believe that the best factoring for that is (x+2)(x+3) which means D would be wrong.

And, i dont need it for equations with more than 1 variable, just trinomials with 1 variable. I'm not sure if the program's output answers are confusing me because of the setup, or if its just not what im trying to do Wink sorry


Last edited by Guest on 06 Apr 2006 03:28:33 pm; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 06 Apr 2006 03:38:27 pm    Post subject:

ERR:BREAK can only be caused by the user; it's never the program's fault. ;)

But you're right, I screwed up.

[font="courier new"]{Ans,D/Ans,C/E/Ans,A/D/E


...should be:

[font="courier new"]{Ans,D/Ans,C/E/Ans,A/D[color=red],E[/color]

For 1, 5, and 6, I get 1(1x+3y)(1x+2y).

If you're not worried about two variables now, you will be later.

Last edited by Guest on 06 Apr 2006 03:38:42 pm; edited 1 time in total
Back to top
MeBeatYou


Member


Joined: 29 Sep 2005
Posts: 178

Posted: 06 Apr 2006 03:46:51 pm    Post subject:

ok thanks 0x5 that would've been nice about 3 days ago because I just finished my own (not sure if it works or not though... granted it probably doesn't)... But thanks for your help... it works great : :biggrin:
Back to top
trigkid213


Member


Joined: 30 Mar 2006
Posts: 208

Posted: 07 Apr 2006 02:34:56 pm    Post subject:

For one thing, it's really easy to find the factors if you have the solutions. Here is a program I wrote that does it:


Code:
:ClrHome
:Input "ROOT 1:",P
:Input "ROOT 2:",Q
:P:prgmFRAC:Ans -> L1
:If P>0
:Then
:"- -> Str2
:Else
:"+ -> Str2
:End
:Q:prgmFRAC:Ans -> L2
:If Q>0
:Then
:"- -> Str5
:Else
:"+ -> Str5
:End
:abs(L1(2:prgmNS
:Ans -> Str1
:abs(L1(1:prgmNS
:Ans -> Str3
:abs(L2(2:prgmNS
:Ans -> Str4
:abs(L2(1:prgmNS
:Ans -> Str6
:"("
:If expr(Str1)≠1
:Ans+Str1
:Ans+"X"+Str2+Str3+")("
:If expr(Str4)≠1
:Ans+Str4
:Ans+"X"+Str5+Str6+")
:Output(3,1,Ans
:For(K,1,int(length(Ans)/16)+1
:Disp "
:End
:Output(1,1,"


But if you still want a program that factors a quadratic, here's another one I wrote. It will give you two factors or tell you if it is not factorable. If it can, it will factor out a constant and display it in front of the factors.


Code:
:ClrHome
:Disp "Finds factors of","factorable","polynomial","AX^2+BX+C
:Prompt A
:Prompt B
:Prompt C
:A:prgmFRAC:Ans -> L1
:B:prgmFRAC:Ans -> L2
:C:prgmFRAC:Ans -> L3
:abs(A),abs(B)),abs(B),abs(C)))((A>0)-(A<0)) -> G
:If not(G
:abs(A),abs(B) -> G
:If not(G
:abs(A),abs(C) -> G
:If not(G
:1 -> G
:Ans:prgmNS
:Ans -> Str9
:a+bi
:(-B+sqrt(B^2-4AC))/(2A -> P
:(-B-sqrt(B^2-4AC))/(2A -> Q
:If imag(P) or imag(Q
:Goto X
:P:prgmFRAC:Ans -> L1
:If P>0
:Then
:"- -> Str2
:Else
:"+ -> Str2
:End
:Q:prgmFRAC:Ans -> L2
:If Q>0
:Then
:"- -> Str5
:Else
:"+ -> Str5
:End
:If abs(L1(1))+abs(L1(2))+abs(L2(1))+abs(L1(2))>E8
:Then
:Lbl X
:Disp "Not factorable."
:Output(1,1,"
:Stop
:End
:abs(L1(2:prgmNS
:Ans -> Str1
:abs(L1(1:prgmNS
:Ans -> Str3
:abs(L2(2:prgmNS
:Ans -> Str4
:abs(L2(1:prgmNS
:Ans -> Str6
:"(
:If expr(Str9)≠1
:Ans+Str9+")("
:If expr(Str1)≠1
:Ans+Str1
:Ans+"X"+Str2+Str3+")("
:If expr(Str4)≠1
:Ans+Str4
:Ans+"X"+Str5+Str6+")
:ClrHome
:Output(1,1,Ans
:For(K,1,int(length(Ans)/16)+1
:Disp "
:End
:Output(1,1,"


For some reason, if I put my code in scrolling format, it started displaying smileys and copyright symbols and other unintended characters, so sorry about the length. :confused:

NS and FRAC are programs that I found the code for on these forums and edited a little. NS converts a number to a string, and FRAC converts a decimal to a fraction and stores the numerator and denominator in a list.

These programs could probably use some optimization, but they work.

All four programs are in the group in the attachment.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 07 Apr 2006 04:52:44 pm    Post subject:

You may find this useful when posting:



As for copyright symbols, this FAQ will take care of that.


Last edited by Guest on 07 Apr 2006 04:55:13 pm; edited 1 time in total
Back to top
MeBeatYou


Member


Joined: 29 Sep 2005
Posts: 178

Posted: 18 Apr 2006 08:05:03 pm    Post subject:

Weregoose wrote:
But they offer no programming experience. ;)

[font="courier new"]ClrHome
Disp "ax+bxy+cy","
Input "a=",A
Input "b=",B
Input "b=",C
abs(A
For(D,Ans,‾Ans,‾1
D-not(D→D
If not(fPart(A/Ans
Then
int(√(abs(C
For(E,‾Ans,Ans
E+not(E→E
If B=AnsD+AC/(AnsD) and not(fPart(C/Ans
Goto 0
End
End
End
Output(7,4,"NO FACTORS
Stop
Lbl 0
gcd(abs(D),abs(C/Ans
{Ans,D/Ans,C/E/Ans,A/D[color=gray]/
E That last / should be a comma!
ClrHome
Disp "a(bx+cy)(dx+ey)","
For(A,1,5
Disp sub("abcde",A,1)+"=
Output(A+2,3,Ans(A
End
[/color]

Be warned that this won't factor by grouping, but see if it works.
[post="74426"]<{POST_SNAPBACK}>[/post]


Does anyone know how I can "port" this to the 89 Titanium? I forgot to mention that this is for the 89 Titanium Sad My mistake... If anyone could help me out, that would be great.
Back to top
programmer_to_be
Jesus is my Lord and Saviour.


Elite


Joined: 07 Feb 2006
Posts: 755

Posted: 18 Apr 2006 08:07:51 pm    Post subject:

Do you know most of the commands for the 89? I don't, so I wouldn't be much help. I think though, not 100% sure, or even 50% sure, that the commands are close. Like the output commands. You should be able to "translate" the code just by looking at the 83/84 code and looking through the functions for the 89.
Back to top
MeBeatYou


Member


Joined: 29 Sep 2005
Posts: 178

Posted: 18 Apr 2006 08:22:19 pm    Post subject:

Well, my friend has the 89 and I'm doing this as a favor Neutral Anybody able to take this program and convert it to TI-89 Titanium please?
Back to top
Display posts from previous:   
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
    » Goto page 1, 2  Next
» View previous topic :: View next topic  
Page 1 of 2 » All times are GMT - 5 Hours

 

Advertisement