0

Okay, I just ended up creating a list of the digits of pi and collecting the correct digit from that list. I am going to leave this up in case anyone wants to play around with the equation.

This was graphed in desmos and should work there without an reconfiguring.

I created the following equation below in order to be able to represent each individual digit of pi using graphing software. I should specify that this is one part of a larger equation. The reason that I need it to work in graphing software is so that I don't get errors when I plug it into the larger equation. Unfortunately, certain terms of this equation tend to balloon into incredibly large numbers very quickly resulting in the program causing rounding errors as the values increase and causing the program to stop working after around digit 16. Is there some simpler way to represent this without causing the program to short out after so many digits. $y=\operatorname{floor}\left(10\operatorname{round}\left(\pi\left(10\right)^{\operatorname{round}\left(x-2\right)},2\right)\right)-10\operatorname{floor}\left(10\operatorname{round}\left(\frac{\left(\pi\left(10\right)^{\operatorname{round}\left(x-2\right)}\right)}{10},2\right)\right)$

This causes the program to multiply pi such that the digit number x is shifted to the 1/10 place and the program then rounds the x-1 digit of pi so our x digit is not affected.

$\operatorname{round}\left(\pi\left(10\right)^{\operatorname{round}\left(x-2\right)},2\right)$

This causes the x digit to shift to the 1 place and floor gets rid of the rounded digit.

$\operatorname{floor}\left(10\operatorname{round}\left(\pi\left(10\right)^{\operatorname{round}\left(x-2\right)},2\right)\right)$

This causes the function shift the x+1 digit to the 1/10 digit and then rounds to the x digit.

$\operatorname{round}\left(\frac{\left(\pi\left(10\right)^{\operatorname{round}\left(x-2\right)}\right)}{10},2\right)$

This then shifts the x digit to the 1/10 place and floor makes the x digit equal to 0. The extra multiple by 10 is so that both this and the second equation are both to the same power which will line up all of our digits of pi

$10\operatorname{floor}\left(10\operatorname{round}\left(\frac{\left(\pi\left(10\right)^{\operatorname{round}\left(x-2\right)}\right)}{10},2\right)\right)$

We finally combine the two parts where the left will have the x digit of pi in the ones place and the right will have a 0 in the ones place. Thus all of the digits of pi cancel out except for the ones place which will show up on our graph.

$y=\operatorname{floor}\left(10\operatorname{round}\left(\pi\left(10\right)^{\operatorname{round}\left(x-2\right)},2\right)\right)-10\operatorname{floor}\left(10\operatorname{round}\left(\frac{\left(\pi\left(10\right)^{\operatorname{round}\left(x-2\right)}\right)}{10},2\right)\right)$

  • 1
    I don't get why you are trying to graph $\pi$ to find its digits, since the underlying representation of $\pi$ is just preprogrammed digits... – Rushabh Mehta Apr 14 '21 at 18:07
  • I was trying to create a equation that would recover a specific digit of pi as part of a larger equation. All I need the equation to do is look up and recover digit x of pi. However since I couldn't find any equation that does that except for actual programming languages I made my own. – Rex.zip Apr 14 '21 at 18:19
  • but desmos just has a floating point value assigned to $\pi$, so that's just counterproductive.... if you are deadset on an equation, the $n$th decimal place is given by $10^n\pi-\lfloor10^n\pi\rfloor$... – Rushabh Mehta Apr 14 '21 at 18:24
  • As the link in LinAlg's answer says, "The 53-bit significand precision gives from 15 to 17 significant decimal digits precision", so you simply can't get more than that many correct digits by manipulating a standard double-precision value of pi. OTOH, there are many ways to compute more decimal digits of pi, if you want to do that. It's easiest if you have access to an arbitrary precision arithmetic package, but that's not necessary. It can even be done just using integer arithmetic, as I showed here. – PM 2Ring Apr 14 '21 at 18:41
  • But anyway, I'm curious to know what your graphic representation of the digits of pi actually looks like. – PM 2Ring Apr 14 '21 at 18:45
  • Don Thousand - Is there any way to directly recover the x digit of pi from its floating point value in desmos? In other words is there some way to say get the 3rd digit of pi which is 4 as a part of a larger equation. Also your comments get cut off so I can't read them. – Rex.zip Apr 14 '21 at 19:21
  • PM 2Ring - It looks similar to a step function with each step being 1 long along the x axis centered around the x digit( 1 is the 1rst place, 2 is the second place....) of pi with y equal to the actual value of the x digit(when x= 1 y=3, when x=2 y=1 ....). – Rex.zip Apr 14 '21 at 19:32
  • @Rex.zip please see my answer. As the Wikipedia page explains, floating point values do not have more than 16 significant digits, so there is no way to recover them. – LinAlg Apr 15 '21 at 00:16
  • Wow, this is actually really cool. Nice construction. – K.defaoite Apr 16 '21 at 00:10
  • LinAlg - You are correct. I just didn't know how to create a string in Desmos and had to play around with the list in order to make it work. – Rex.zip Apr 16 '21 at 15:58
  • Why did you use such a strange equation? This is a much simpler one. $$f\left(n\right)=\operatorname{floor}\left(\pi10^{\operatorname{floor}\left(n\right)}\right)-10\operatorname{floor}\left(\pi10^{\operatorname{floor}\left(n-1\right)}\right)$$ – Aaron Speedy Dec 25 '21 at 03:25

1 Answers1

1

No formula will work when the input $\pi$ is provided in double precision floating point format. You can either treat $\pi$ as a string (and perform string indexing instead of arithmetic operations) or use an arbitrary precision library that provides the required level of accuracy.

LinAlg
  • 20,093