Author Topic: Quadratic Formula  (Read 10341 times)

0 Members and 1 Guest are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Quadratic Formula
« Reply #15 on: October 31, 2010, 06:40:24 pm »
Yeah, I knew that it allowed imaginary numbers, but I haven't learn them at school yet =P

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Quadratic Formula
« Reply #16 on: October 31, 2010, 06:42:57 pm »
Oh.  If this isn't too intrusive, may I ask what math level you're currently taking?
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 Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Quadratic Formula
« Reply #17 on: October 31, 2010, 06:45:16 pm »
Oh.  If this isn't too intrusive, may I ask what math level you're currently taking?

10th grade in portugal

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Quadratic Formula
« Reply #18 on: October 31, 2010, 08:12:01 pm »
Out of how many grades? I don't know the Portugal schooling system.

Also, could you post the original program you had instead of nemo's one that fixed the issue. I think we're all still curious about what was originally going on with the error and that would help figure it out.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Quadratic Formula
« Reply #19 on: November 01, 2010, 01:07:38 am »
(sorry, but I had to optimize a little  ;D)

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

This won't use L₁, either. If you do want to store it to L₁, then just do Ans→L₁ after running the program because Ans will contain the results.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Quadratic Formula
« Reply #20 on: November 01, 2010, 08:30:09 pm »
(sorry, but I had to optimize a little  ;D)
And I has to optimize it more. :P Also, your code doesn't work; it would have to be √(B²/4-AC)/A :(
Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:Pause -(B+{1,-1}√(B²+4i²AC))/(2A
Doesn't even change the mode settings ;D
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Quadratic Formula
« Reply #21 on: November 01, 2010, 09:00:47 pm »
Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:Pause -(B+{1,-1}√(B²+4i²AC))/(2A
Doesn't even change the mode settings ;D

O.o
That's hyper-optimized!  If you remove the ClrHome and the Disp, you can get it to be under 50 bytes!
Does using i allow for an imaginary output even if you don't mess with the mode settings?
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 calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Quadratic Formula
« Reply #22 on: November 01, 2010, 09:05:01 pm »
Indeed :) A number that's already "imaginary" (even if that imaginary part is 0) will not give an error when you try to take its square root.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Quadratic Formula
« Reply #23 on: November 01, 2010, 09:05:06 pm »
(sorry, but I had to optimize a little  ;D)
And I has to optimize it more. :P Also, your code doesn't work; it would have to be √(B²/4-AC)/A :(
Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:Pause -(B+{1,-1}√(B²+4i²AC))/(2A
Doesn't even change the mode settings ;D

Two can play the optimization game. :P

Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:-B+{1,-1}√(B²+4i²AC
:Pause Ans/(2A

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Quadratic Formula
« Reply #24 on: November 01, 2010, 09:07:59 pm »
Congratulations, you win. :D
* calcdude, admitting defeat, bows to Runer in acknowledgement of his victory.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Quadratic Formula
« Reply #25 on: November 01, 2010, 09:24:56 pm »
(sorry, but I had to optimize a little  ;D)
And I has to optimize it more. :P Also, your code doesn't work; it would have to be √(B²/4-AC)/A :(
Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:Pause -(B+{1,-1}√(B²+4i²AC))/(2A
Doesn't even change the mode settings ;D

Two can play the optimization game. :P

But only one may win...

Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:B+{1,-1}√(B²+4i²AC
:Pause -2C/Ans


Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Quadratic Formula
« Reply #26 on: November 01, 2010, 09:30:33 pm »
(sorry, but I had to optimize a little  ;D)
And I has to optimize it more. :P Also, your code doesn't work; it would have to be √(B²/4-AC)/A :(
Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:Pause -(B+{1,-1}√(B²+4i²AC))/(2A
Doesn't even change the mode settings ;D

Two can play the optimization game. :P

But only one may win...

Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:B+{1,-1}√(B²+4i²AC
:Pause -2C/Ans

:o that works? In which case...

Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:Pause -2C/(B+{1,-1}√(B²+4i²AC
« Last Edit: November 01, 2010, 09:31:26 pm by Runer112 »

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Quadratic Formula
« Reply #27 on: November 01, 2010, 09:32:00 pm »
oops. how'd i miss that.

but yeah, alternate form of the quadratic formula.


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 #28 on: November 01, 2010, 09:38:56 pm »
But only one may win...
Quote
Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:B+{1,-1}√(B²+4i²AC
:Pause -2C/Ans

:o that works? In which case...

Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:Pause -2C/(B+{1,-1}√(B²+4i²AC

And the winner is...

Code: [Select]
:ClrHome
:Pause "GOOGLE IT

 ;)

Only 11 bytes!
« Last Edit: November 01, 2010, 09:39:40 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Quadratic Formula
« Reply #29 on: November 01, 2010, 09:42:07 pm »
But only one may win...
Quote
Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:B+{1,-1}√(B²+4i²AC
:Pause -2C/Ans

:o that works? In which case...

Code: [Select]
:ClrHome
:Disp "AX²+BX+C=0
:Prompt A,B,C
:Pause -2C/(B+{1,-1}√(B²+4i²AC

And the winner is...

Code: [Select]
:ClrHome
:Pause "GOOGLE IT

 ;)

Only 11 bytes!


Oh really?

Code: [Select]
:ClrHome
:Pause "JFGI"