Author Topic: Quadratic Formula  (Read 10413 times)

0 Members and 3 Guests are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Quadratic Formula
« on: October 31, 2010, 04:16:08 pm »
Ok, I was programming a few little things in BASIC to learn I got this problem:

Code: [Select]
:ClrHome
:Prompt A,B,C
:(BB-(4AC))->X
:If X<0
:Then
:Disp "NO REAL ANSWER"
:Else
:(-B+sqrt(X))/(2A)->Y
:(-B-sqrt(X))/(2A)->X
:Output(6,2,"RESULTS:
:Output(7,2,X
:Output(8,2,Y

It gives me error in:

Code: [Select]
(BB-(4AC))->X
It's probably a stupid and easy mistake.

Any help?

Thanks :)

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Quadratic Formula
« Reply #1 on: October 31, 2010, 04:17:53 pm »
BB?  Try B^2.  Also, what error? syntax? what does it highlight on the goto?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Quadratic Formula
« Reply #2 on: October 31, 2010, 04:20:59 pm »
Tried B^2 and BB, none works.

Syntax Error, it highlights in B, of B^2-(4AC)->X.

SirCmpwn

  • Guest
Re: Quadratic Formula
« Reply #3 on: October 31, 2010, 04:21:51 pm »
Lowercase B will not work, although I doubt you are doing that.  Try 2.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Quadratic Formula
« Reply #4 on: October 31, 2010, 04:21:52 pm »
B2 should fix the problem... also, this could be optimized into Ti Basic Dev's quadratic formula. or if you like your way:

Code: [Select]
ClrHome
Prompt A,B,C
B^2-4AC->X
If Ans<0:Then
Disp "NO REAL ANSWER
Else
Output(6,2,"RESULTS:
Output(7,2,-B+sqrt(X)/(2A)
Output(8,2,-B-sqrt(X)/(2A)
End


Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Quadratic Formula
« Reply #5 on: October 31, 2010, 04:23:30 pm »
I tried that, B2 (two as an exponent)...

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Quadratic Formula
« Reply #6 on: October 31, 2010, 04:24:03 pm »
are you typing "->" or are you using the [STO] key in the lower lefthand corner?


Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Quadratic Formula
« Reply #7 on: October 31, 2010, 04:24:10 pm »
Ok, sorry if this isn't the problem, but we can't over look this.

You are using the STO button to get the arrow right? Not minus greater than.

Edit:
   Ninja'd
« Last Edit: October 31, 2010, 04:24:40 pm by thepenguin77 »
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Quadratic Formula
« Reply #8 on: October 31, 2010, 04:25:05 pm »
Please post the program.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Quadratic Formula
« Reply #9 on: October 31, 2010, 04:26:27 pm »
Ok, sorry if this isn't the problem, but we can't over look this.

You are using the STO button to get the arrow right? Not minus greater than.

Edit:
   Ninja'd

OF COURSE NOT...

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Quadratic Formula
« Reply #10 on: October 31, 2010, 04:29:44 pm »
so... any other ideas?


Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Quadratic Formula
« Reply #11 on: October 31, 2010, 04:31:50 pm »
so... any other ideas?

Made it working:

Code: [Select]
:ClrHome
:Prompt A,B,C
:B^2-4AC→X
:If Ans<0:Then
:Disp "NO REAL ANSWER
:Else
:Output(6,2,"RESULTS:
:Output(7,2,-B+sqrt(X)/(2A)
:Output(8,2,{-}B-sqrt(X)/(2A)
:End

Thanks

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Quadratic Formula
« Reply #12 on: October 31, 2010, 06:09:53 pm »
Or better yet...

Code: [Select]
:ClrHome
:a+bi                             (Found in the [MODE] menu, allows imaginary numbers)
:2->dim(L₁
:Disp "AX²+BX+C=0
:Prompt A,B,C
:(-B+√(B²-4AC))/(2A->L₁(1
:(-B-√(B²-4AC))/(2A->L₁(2
:Pause L₁

Allows imaginary numbers!  (Scroll for answer, don't keep anything important in L1)

Edited:  Thanks, Qwerty.55
« Last Edit: October 31, 2010, 06:31:23 pm by Michael_Lee »
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Quadratic Formula
« Reply #13 on: October 31, 2010, 06:29:35 pm »
The Superscript and subscript tags don't work in a code block. Try alt codes:

Code: [Select]
:ClrHome
:a+bi                             (Found in the [MODE] menu, allows imaginary numbers)
:2->dim(L₁
:Disp "AX²+BX+C=0
:Prompt A,B,C
:(-B+√(B²-4AC))/(2A->L₁(1
:(-B-√(B²-4AC))/(2A->L₁(2
:Pause L₁

EDIT: Sorry if this shows up a few hours late. I think I'm using the bandwidth for the whole building right now.
« Last Edit: October 31, 2010, 06:31:17 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Quadratic Formula
« Reply #14 on: October 31, 2010, 06:38:53 pm »
So what was the error?