[VA] SRC #009 - Pi Day 2021 Special - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: [VA] SRC #009 - Pi Day 2021 Special (/thread-16473.html) |
[VA] SRC #009 - Pi Day 2021 Special - Valentin Albillo - 03-14-2021 07:00 PM Welcome to my SRC #009 - \(\pi\) Day 2021 Special, a small affair to commemorate that most universal and ubiquitous constant \(\pi\), The Mother of All Constants. Why, \(\pi\) is such an über-ubiquitous constant that it appears everywhere in everything from pure math to applied sciences to stochastic processes and beyond, embedded in the very fabric of the Universe. You'll find \(\pi\) as the result of an uncountable infinity of non-trivial mathematical expressions, including finite and infinite series and integrals and as a root of equations (not polynomial, mind you, \(\pi\) 's a transcendent constant), you'll find it in the innards of fractal sets such as the Mandelbrot set, you'll find it by throwing needles on a grid, you'll find it by rounding numbers, you'll find it when dealing with quantum mechanics or financial instruments, ... Thus, though it would seem difficult to find new, interesting appearances of \(\pi\), actually that's not the case at all and I can tap that uncountable infinite set of appearances I mentioned to get new ones for this SRC, so get your HP calculator (physical or virtual as you see fit) and use its built-in manual and/or programming capabilities to deal with what follows, you don't need anything else ...
New assorted appearances of \(\pi\) and other trivia:
V. RE: [VA] SRC #009 - Pi Day 2021 Special - J-F Garnier - 03-15-2021 08:19 PM Equations (a) and (b) would be good candidates for benchmarking the combined solve and integrate features on various calculators but I can't really solve them between [3,4] because the expressions to integrate are not defined outside [0,\(\pi\)] however I was able to check that \(\pi\) is indeed a solution of (a), up to 30 decimals or so with Free42. Nice expressions, I have no idea of how they were built. For point (c), well ... it's a nice identity J-F RE: [VA] SRC #009 - Pi Day 2021 Special - J-F Garnier - 03-15-2021 08:59 PM More on item (c): (03-14-2021 07:00 PM)Valentin Albillo Wrote: We know that \(\pi\) and e are related by e i \(\pi\) + 1 = 0, but we may ask ourselves: is there any other simpler way to get \(\pi\) from e which does not involve complex numbers ? I don't think we can say that the equation e i \(\pi\) + 1 = 0 can be used to get \(\pi\) from e. If you try to get \(\pi\) from this expression, you will just end with \(\pi\) = acos(-1). I don't know -and don't think there is - any relation that can be used to get \(\pi\) from e. J-F RE: [VA] SRC #009 - Pi Day 2021 Special - Gerson W. Barbosa - 03-15-2021 09:33 PM (03-15-2021 08:19 PM)J-F Garnier Wrote: For point (c), well ... it's a nice identity A nice multi-purpose identity, I would say. Replace e with c, where c is the speed of light (in m/s, mi/s, whatever) and see what you get. It “relates” π to any constant greater than -1. For constants less than -1 divide the result by -3. RE: [VA] SRC #009 - Pi Day 2021 Special - Albert Chan - 03-15-2021 11:06 PM (03-15-2021 09:33 PM)Gerson W. Barbosa Wrote: For constants less than -1 divide the result by -3. The reason for this is because atan(x) only return principle angle, between ±pi/2 Let the constant is x, instead of e: atan((x-1)/(x+1)) = atan((x - tan(pi/4)) / (1 + tan(pi/4)*x) = atan(tan(atan(x) - pi/4)) If atan(x) - pi/4 ≥ -pi/2 (equivalent to 4*(atan(x) - atan((x-1)/(x+1)) = 4*(atan(x) - (atan(x) - pi/4)) = pi If atan(x) - pi/4 < -pi/2 (equivalent to x < -1): 4*(atan(x) - atan((x-1)/(x+1)) = 4*(atan(x) - (atan(x) - pi/4 + pi)) = -3*pi (*) Correction: At x=-1, atan((x-1)/(x+1)) = atan(±∞) is undefined. RE: [VA] SRC #009 - Pi Day 2021 Special - PeterP - 03-15-2021 11:10 PM (03-14-2021 07:00 PM)Valentin Albillo Wrote: This is astounding I have to say and now I want to go out and publish papers very Sunday as well. Has academic publishing really come to this? I was recently teaching a class here at university on Space Entrepreneurship and during that class one team build a crowd sourced publishing company for academic papers. While their idea had little to do with Space I felt it had a lot of merit given the exorbitant fees academic publishing houses extract from readers without giving anything back to the creators (or the funders of the creators) of that content. Now, where was my simple proof of Fermat's Last Theorem again? Gotta get that published lest someone steals my brilliant idea... RE: [VA] SRC #009 - Pi Day 2021 Special - PeterP - 03-15-2021 11:12 PM (03-15-2021 11:06 PM)Albert Chan Wrote:(03-15-2021 09:33 PM)Gerson W. Barbosa Wrote: For constants less than -1 divide the result by -3. Thank you Albert for that explanation to the mere mortals like myself of something which is obviously trivial to Gerson (and you). Very neat. RE: [VA] SRC #009 - Pi Day 2021 Special - Albert Chan - 03-16-2021 01:08 AM (03-15-2021 08:19 PM)J-F Garnier Wrote: Equations (a) and (b) would be good candidates for benchmarking the combined solve and integrate features on various calculators but I can't really solve them between [3,4] because the expressions to integrate are not defined outside [0,\(\pi\)] ... Just search for [3, pi] instead ... RE: [VA] SRC #009 - Pi Day 2021 Special - robve - 03-16-2021 02:38 PM Quote:Last, for a really good laugh have a look at just a sample of modern papers on ? published in what they say are reputable, peer-reviewed journals: Predatory journals like these aim to make money by publishing pretty much anything as long as you pay. Predatory and hijacked journals are popping up like bad mushrooms: https://predatoryjournals.com/journals/ Also well-known reputable conferences are hijacked. I remember attending an IEEE conference to give a technical talk. Some of the expected attendees did not show up because they travelled to the hijacked conference in Seattle. Read the confusion here: https://academia.stackexchange.com/questions/109314/how-do-i-determine-which-of-two-international-conference-on-web-services-icws-2 It takes some due diligence to read and cite journal and conference proceeding papers, i.e. look for reputable publishers and professional societies such as AMS and IEEE. Reputable journals are indexed. No data is reported on "IOSR Journal of Mathematics". It is doubtful that these papers are peer reviewed by academics. - Rob RE: [VA] SRC #009 - Pi Day 2021 Special - robve - 03-16-2021 04:59 PM Quote:a. Find a real root x in [3, 4] of the following equation:The LHS is an improper integral with the integrand defined on (0,π). The improper integral can be evaluated for x in [3,pi], for example with the excellent HP PRIME or by using a vintage HP or SHARP BASIC calculator using Romberg with midpoint quadrature (for open intervals, see e.g. NR2 Ch4.4). For example, Romberg open interval integration gives 15.93599534 for x=3.141592654 on my SHARP PC-1350. Edit: I should add that this value is the same as x^x/Gamma(x)=15.93599533 for x=3.141592654 on my SHARP PC-1350 with X=PI: GOSUB "GAMMA": PRINT X^X/Y. Rewrite the equation to $$ \int_0^x \left( \frac{\sin t}{t} \mathrm{e}^{t/\tan t} \right)^x\,dt - \frac{x^x}{\Gamma x} = 0 $$ After some hunting on the interval [3,π] we find the root x=π. That makes this a remarkable equation, which I am not yet sure where it came from. SHARP BASIC: ' ROMBERG QUADRATURE FOR IMPROPER INTEGRALS WITH OPEN INTERVALS ' Functions to integrate are defined with label "F1", "F2",... should return Y given X ' VARIABLES ' A,B range ' F$,F function label (or number) to integrate ' Y result ' E relative error: integral = Y with precision E (attempts E = 1E-10) ' H step size ' N max number of Romberg steps (=10) ' I iteration step ' U current row ' O previous row ' J,S,X scratch ' A(27..26+2*N) scratch auto-array 100 "QROMO" INPUT "f=F";F 110 INPUT "a=";A 120 INPUT "b=";B ' init and first midpoint step 130 E=1E-9,N=7,F$="F"+STR$ F,H=B-A,X=A+H/2: GOSUB F$: O=27,U=O+N,A(O)=H*Y,I=1 ' next midpoint step 140 H=H/3,S=0 150 FOR J=1 TO 3^I STEP 3: X=A+(J-.5)*H: GOSUB F$: S=S+Y,X=A+(J+1.5)*H: GOSUB F$: S=S+Y: NEXT J ' integrate 160 A(U)=H*S+A(O)/3,S=1 170 FOR J=1 TO I: S=9*S,A(U+J)=(S*A(U+J-1)-A(O+J-1))/(S-1): NEXT J ' loop until convergence 180 IF I>5 LET Y=A(U+I): IF ABS(Y-A(O+I-1))<=E*Y+E PRINT Y: END 190 J=O,O=U,U=J,I=I+1: IF I<N GOTO 140 ' no convergence, output result with error estimate 200 E=ABS((Y-A(U+N-2))/(Y+E)): PRINT Y,E: END 300 "F1" Y=(SIN X/X*EXP(X/TAN X))^B: RETURN 400 "GAMMA" IF X<=0 LET Y=9E99: RETURN 410 Y=1+76.18009173/(X+1)-86.50532033/(X+2)+24.01409824/(X+3) 420 Y=Y-1.231739572/(X+4)+1.208650974E-3/(X+5)-5.395239385E-6/(X+6) 430 Y=EXP(LN(Y*2.506628275/X)+(X+.5)*LN(X+5.5)-X-5.5): RETURN b. Find a real root x in [3, 4] of the following equation: Again we have an improper integral. We could follow the same strategy as a. to numerically solve it. However, due to Poisson we already know that $$ W(x) = \frac{1}{\pi}\int_0^\pi \log\left(1+x\frac{\sin t}{t}\mathrm{e}^{t\cot t} \right) dt $$ Hence, $$ \Omega = W(1) = \frac{1}{\pi}\int_0^\pi \log\left(1+\frac{\sin t}{t}\mathrm{e}^{t\cot t} \right) dt $$ Rewrite the given equation and take x=π. By Poisson we have $$ \frac{1}{\Omega} \int_0^\pi \log\left( 1+\frac{\sin t}{t} \mathrm{e}^{t\cot t} \right) dt = \pi $$ Hence the root of the given equation is at x=π. QED RE: [VA] SRC #009 - Pi Day 2021 Special - Valentin Albillo - 03-16-2021 06:36 PM Hi all: Thanks to J-F Garnier, Gerson W. Barbosa. Albert Chan, PeterP and robve for your interesting posts, much appreciated. This isn't my final results and comments yet but a few intermediate comments to things you say in your posts, read on ... J-F Garnier Wrote:For point (c), well ... it's a nice identity If you say so ... this means you think that 2 + 2 = 4 is a "nice identity" too ? J-F Garnier Wrote:I don't think we can say that the equation e^(i π) + 1 = 0 can be used to get π from e. If you try to get π from this expression, you will just end with π = acos(-1). Well, you can isolate \(\pi\) in the equation and you get \(\pi\) = loge(-1) / i, which apart from constants -1 and i features a logarithm base e as a fundamental part of it, and which your Emu71+Math ROM readily evaluates as: >LOG((-1,0))/(0,1) (3.14159265359, 0), i.e.: \(\pi\) and I see no cosine in that evaluation. J-F Garnier Wrote:I don't know -and don't think there is - any relation that can be used to get π from e. Paraphrasing Hamlet: "There are more things in heaven and earth, Jean-François, than are dreamt of in your philosophy" In other words, you bet there are. Gerson W. Barbosa Wrote:A nice multi-purpose identity, I would say. Thanks for your appreciation of the expression (not identity, unless like J-F you consider 2 + 2 = 4 an identity). PeterP Wrote:This is astounding I have to say and now I want to go out and publish papers very Sunday as well. Has academic publishing really come to this? Some of it, regrettably yes. See robve comments immediately below and my comments on it. robve Wrote:Predatory journals like these aim to make money by publishing pretty much anything as long as you pay. Predatory and hijacked journals are popping up like bad mushrooms: This blog entry explains it all in great detail and also includes a long list of such journals. Science Spammers The list includes many IOSR journals like the two featuring the four papers I cited. robve Wrote:No data is reported on "IOSR Journal of Mathematics". It is doubtful that these papers are peer reviewed by academics. It isn't "doubtful" at all: they aren't, period. It's quite impossible that any paper claiming that \(\pi\) is actually a simple algebraic value would pass any kind of peer review by real academics, it would be immediately thrown to the garbage bin to keep company with papers solving the quadrature of the circle and other such nonsense. robve Wrote:The improper integral can be evaluated [...] using a vintage HP or SHARP BASIC calculator using Romberg with midpoint quadrature I seem to remember that in some other post in another thread you said something along the lines of "every programmer should write their own integration procedure". Well, I could agree in principle with that statement, writing quadrature programs is fun, but I've never bothered to write Romberg-based ones, as they are extremely inefficient in my not-so-humble opinion. Said procedures were OK for very limited HP calcs of old such as the slow, RAM-starved HP-34C, but for powerful models such as the HP-71B, say, there are much, much better, faster alternatives, some of which I've programmed in the far past, with excellent results. I don't know why the Math ROM creators used Romberg in the ROM instead of a better, faster method but then again, they made many questionable decisions and glaring omissions as well (J-F has remedied some of that in his awesome Math Pac 2 and he's not done with it yet.) My final results/comments in a few days. Let me remind all interested people that point d hasn't been addressed by anyone yet. As it's my long-standing policy, if it finally goes utterly unaddressed I won't comment on it either. Best regards. V. RE: [VA] SRC #009 - Pi Day 2021 Special - Maximilian Hohmann - 03-16-2021 06:36 PM Hello! (03-14-2021 07:00 PM)Valentin Albillo Wrote: All your comments are welcome and appreciated No solution to your challenges, just comments... (03-14-2021 07:00 PM)Valentin Albillo Wrote: e. \(\pi\) also features in a song by Kate Bush ... Yes, wonderful, isn't it. What an artist. Seeing and hearing her perform live is one of the top ten items in my bucket list. Unfortunately, at her rate of playing one concert every decade or so, this is probably not going to happen. Not long ago I stumbled across the Wikipedia entry about her song "Cloudbusting" which has a very interesting scientific (or pseudo- or para- scientific) background. And regarding Pi and Pi day, my favorite science explainer on Wikipedia (not by coincidence his ph.d thesis is "Designing Effective Multimedia for Physics Education") just today realeased a video for the mathematically illiterates (like myself) about how Isaac Newton revolutionsnised the way Pi is calculated: https://www.youtube.com/watch?v=gMlf1ELvRzc Regards Max RE: [VA] SRC #009 - Pi Day 2021 Special - Albert Chan - 03-16-2021 06:50 PM For (a), (b), it is simpler to setup as iterative formula, X=F(X), instead of searching in range [3, pi] >X=3 @ P=1E-10 @ W1=.56714329041 >INTEG(0,X,P,(SIN(IX)/IX*EXP(IX/TAN(IX)))^X) * GAMMA(X)/X^(X-1) 3.1415926536 >INTEG(0,X,P,LOGP1(SIN(IX)/IX*EXP(IX/TAN(IX)))) / W1 3.14159265358 Both (a),(b) already converged to X=PI (confirmed by X=PI, and run integral again) RE: [VA] SRC #009 - Pi Day 2021 Special - Albert Chan - 03-16-2021 07:17 PM (03-14-2021 07:00 PM)Valentin Albillo Wrote: [*]d. Conversely, the volume enclosed by the n-dimensional sphere of radius R is given by: sum = 1 + pi/1! + pi²/2! + pi³/3! + ... = e^pi sum ^ (1/pi) = e Comment: formula give 1 for volume of 0-dimensional sphere, which seems weird. RE: [VA] SRC #009 - Pi Day 2021 Special - robve - 03-16-2021 08:28 PM (03-16-2021 06:36 PM)Valentin Albillo Wrote:robve Wrote:The improper integral can be evaluated [...] using a vintage HP or SHARP BASIC calculator using Romberg with midpoint quadrature Which ones you wrote are better? Adaptive Simpson is one of my favorites, but does not allow open intervals, at least not "out of the box". It easily beats Romberg in terms of speed for most integrands as long as they are well behaved. However, compared to other methods it may require much more memory for the recursive calls (with up to 9 parameters!) or a stack to simulate recursion. Recursive calls are typically 20 levels deep and typically more to get a decent accuracy. Newton-Cotes formulas such as Romberg variants are quite popular. The methods also allow you to monitor the convergence error closely. The HP 71B appears to use a modified version of Romberg to avoid evaluating the endpoints, like my "QROMO" version. Monte Carlo methods of integration with quasi random number generators are good for integrals over multiple dimensions. When implementing algorithms, be aware that high-quality numerical analysis code is hard to find. Rolling out your own method that differs from existing methods is risky. My versions closely follow the methods published in NR and elsewhere in the literature (not in fake journals, LOL). I never posted "every programmer should write their own integration procedure". as the quotation suggests. What post are you referring to? I may have encouraged code because the challenges are also about writing and reusing code as you've stated. - Rob RE: [VA] SRC #009 - Pi Day 2021 Special - J-F Garnier - 03-16-2021 08:41 PM (03-16-2021 06:36 PM)Valentin Albillo Wrote:J-F Garnier Wrote:For point (c), well ... it's a nice identityIf you say so ... this means you think that 2 + 2 = 4 is a "nice identity" too ? By identity, I meant that the expression is independent from the 'e' value, and always produces \(\pi\), quite similar to arctan(1/x) = \(\pi\)/2 - arctan(x) (for x>0). I'm ready to admit that identity not the correct word, if you think so. Quote:J-F Garnier Wrote:I don't think we can say that the equation e^(i π) + 1 = 0 can be used to get π from e. If you try to get π from this expression, you will just end with π = acos(-1). Right but how, practically, do you compute a complex logarithm ? log(z) = log(abs(z)) + i.arg(z) [1] for z=(-1,0) , log(abs(z)) = 0 and arg(z)=atan2(0,-1) [ANGLE(-1,0) in HP-71's BASIC ] So, we get \(\pi\) = loge(-1) / i = atan2(0,-1) No 'e' value involved anywhere. [1] This is the method used to compute log(z) in the HP-71's Math ROM, and all RPN/RPL descendants, and very likely the 15C too. Quote:J-F Garnier Wrote:I don't know -and don't think there is - any relation that can be used to get π from e. Looking forward to see examples, if included in your final comments ! J-F RE: [VA] SRC #009 - Pi Day 2021 Special - Albert Chan - 03-16-2021 08:48 PM (03-16-2021 04:59 PM)robve Wrote: Rewrite the equation to From identity: \(\displaystyle \int_0^{\pi} \left( \frac{\sin t}{t} \mathrm{e}^{t/\tan t} \right)^x\;dt = {\pi x^x \over x!}\qquad\) , x ≥ 0 AN INTEGRAL REPRESENTATION FOR THE LAMBERT W FUNCTION RE: [VA] SRC #009 - Pi Day 2021 Special - robve - 03-16-2021 09:09 PM Quote:c. Another most famous transcendental constant also appearing everywhere is e = 2.718... is there any other simpler way to get π from e which does not involve complex numbers? Yes, there is, simply evaluate: $$ \pi = 4(\arctan \mathrm{e} - \arctan \frac{\mathrm{e}-1}{\mathrm{e}+1}) $$ My HP-71B gives: >RADIANS >4*ATAN(EXP(1))-ATAN((EXP(1)-1)/(EXP(1)+1)) 3.1415926536 Looks good for sure! Why is this equal to π? Use the famous identity and the corresponding series $$ \frac{\pi}{4} = \arctan 1 = \sum_{k=0}^\infty \frac{(-1)^k}{2k+1} $$ We also have $$ \arctan u - \arctan v = \arctan\frac{u-v}{1+uv} $$ Therefore $$ \arctan \mathrm{e} - \arctan \frac{\mathrm{e}-1}{\mathrm{e}+1} = \arctan \frac{\mathrm{e}-(\mathrm{e}-1)/(\mathrm{e}+1)}{1+\mathrm{e}(\mathrm{e}-1)/(\mathrm{e}+1)} $$ Multiplying both sides by e+1 then expanding and cancelling terms: $$ \arctan \frac{\mathrm{e}(\mathrm{e}+1)-(\mathrm{e}-1)}{\mathrm{e}+1+\mathrm{e}(\mathrm{e}-1)} = \arctan \frac{\mathrm{e}^2+1}{\mathrm{e}^2+1} = \arctan 1 $$ Bingo! - Rob RE: [VA] SRC #009 - Pi Day 2021 Special - Gerson W. Barbosa - 03-16-2021 09:26 PM (03-16-2021 06:36 PM)Maximilian Hohmann Wrote: And regarding Pi and Pi day, my favorite science explainer on Wikipedia (not by coincidence his ph.d thesis is "Designing Effective Multimedia for Physics Education") just today realeased a video for the mathematically illiterates (like myself) about how Isaac Newton revolutionsnised the way Pi is calculated: https://www.youtube.com/watch?v=gMlf1ELvRzc Thanks for the link! Isaac Newton did this and much more during 1665 and 1666, when students were sent home because of a pandemic. Too good there was no Distance Education back then and his professors left him alone for such a long time. The wp-34s program in this 10-year old thread is an implementation of Newton’s method to compute \(\pi\): https://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv020.cgi?read=187663 Regards, Gerson. RE: [VA] SRC #009 - Pi Day 2021 Special - Gerson W. Barbosa - 03-16-2021 09:43 PM (03-14-2021 07:00 PM)Valentin Albillo Wrote: e. \(\pi\) also features in a song by Kate Bush ... Speaking of Art, it features also in a poem by Literature Nobel Prize winner Wisława Szymborska: Liczba pi (Number pi) Regards, Gerson. |