Author Topic: Arbitrary precision operations  (Read 9274 times)

0 Members and 1 Guest are viewing this topic.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Arbitrary precision operations
« on: February 16, 2011, 03:03:09 am »


I made this little utility in response to a topic on TI-BASIC Developer. It's an addition utility that can get around the OS imposed arithmetic limit of 14 digits of precision. Nothing special and not worth releasing on Ticalc.org, but I hope someone finds it useful.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Arbitrary precision operations
« Reply #1 on: February 16, 2011, 04:14:41 pm »
What exactly is it doing? I'm having a hard time following the code.
Spoiler For Spoiler:



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

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Arbitrary precision operations
« Reply #2 on: February 16, 2011, 06:45:15 pm »
I'm a bit confused as well...  isn't 123456789+1 perfectly within the realms of what the calc can do?

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: Arbitrary precision operations
« Reply #3 on: February 16, 2011, 07:06:42 pm »
Are you saying it rounds to a certain precision? I'm a bit confused as to how it works, though.




Ashbad

  • Guest
Re: Arbitrary precision operations
« Reply #4 on: February 16, 2011, 07:09:33 pm »
I'm a bit confused as well...  isn't 123456789+1 perfectly within the realms of what the calc can do?

(methinks he just used it as a quick example)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Arbitrary precision operations
« Reply #5 on: February 16, 2011, 07:11:46 pm »
but how could the program have calculated 123456789+1 if he typed that into the homescreen and not into the program?  What is this doing exactly?

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: Arbitrary precision operations
« Reply #6 on: February 16, 2011, 07:19:43 pm »
I used 123456789+1 as an example to prove that the program gets the correct results. If I had used 1E23+1, you would have a more difficult time confirming it. The program basically works by entering digits of the number into the list entries (notice L1(1)=123, L1(2)=456, etc...) and then running the program. It returns the answer in L1.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Arbitrary precision operations
« Reply #7 on: February 16, 2011, 07:23:42 pm »
Oooooh I get it now :D I didn't connect that what was on the homescreen was just a demonstration and not actual program XD Nice!  How high have you tested it with?

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: Arbitrary precision operations
« Reply #8 on: February 16, 2011, 07:26:18 pm »
Oh, I see. I didn't notice L1 changed after running prgmADD :D

EDIT: 3001: Final Odyssey
« Last Edit: February 16, 2011, 07:26:34 pm by Deep Thought »




Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Arbitrary precision operations
« Reply #9 on: February 16, 2011, 08:12:25 pm »
Ah ok. I gotcha. Didn't make the connection that what was in L1 was the number separated. I have no idea what this would be used for really though.

Just curious, but once you reassemble a number that is greater than fourteen digits won't it just round it anyways when it is displayed?
Spoiler For Spoiler:



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

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: Arbitrary precision operations
« Reply #10 on: February 16, 2011, 09:03:12 pm »
Oooooh I get it now :D I didn't connect that what was on the homescreen was just a demonstration and not actual program XD Nice!  How high have you tested it with?

Um, 123456789 :P

The principle is sound as long as the values in each cell don't exceed 14 digits. In theory, it can handle numbers up to 10^13986, which is 10^13786 times larger than a Googleplex. In short, feel free to enumerate all of the atoms in the universe in your calculator  ;D

@Meishe, the number displayed is not the number stored. You can still recall L1(A) and get the proper answer, even if the display is truncated.
« Last Edit: February 16, 2011, 09:04:31 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Arbitrary precision operations
« Reply #11 on: February 16, 2011, 09:05:18 pm »
Then, isn't the max 10^2997 because of the limit of the dimensions of a list?

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: Arbitrary precision operations
« Reply #12 on: February 16, 2011, 09:06:41 pm »
Nope. It's 10^(Precision of list elements*999)

Either way, it's insanely high. 10^2997 is still larger than all of the atoms in the universe.

EDIT: My respect is the answer to Life, the Universe, and Everything.
« Last Edit: February 16, 2011, 09:08:23 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: Arbitrary precision operations
« Reply #13 on: February 16, 2011, 10:37:16 pm »
Nope. It's 10^(Precision of list elements*999)

Either way, it's insanely high. 10^2997 is still larger than all of the atoms in the universe.

EDIT: My respect is the answer to Life, the Universe, and Everything.

Nah, it's a bit more.

But back to the topic, there's still a practical limit based on how much free RAM you have ;)

Still, this is a lot more accurate than the calculator usually holds, great for calculating large operations. Mind if I look in your code? :D




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: Arbitrary precision operations
« Reply #14 on: February 16, 2011, 10:39:01 pm »
Nope. Be prepared to cringe at my abuse of the DSC<( command, though.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ