Post Reply 
[VA] SRC #009 - Pi Day 2021 Special
03-14-2021, 07:00 PM
Post: #1
[VA] SRC #009 - Pi Day 2021 Special
                
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 ... Smile
  • Note: this SRC isn't intended as a challenge or anything of the sort. If you're like me, you'll probably welcome the chance to check for yourself a surprising evaluation or to calculate an intriguing root or getting to know various math-related trivia. This is what the following is all about.
    Also, please do NOT include CODE panels in your replies to this thread, as it makes it difficult for me to generate the online PDF document from it. I expect you'll kindly comply with this requirement but otherwise you'll risk your carefully crafted code appearing truncated or not at all in the final PDF and thus being irretrievably lost from the online document and making your posting it moot.

New assorted appearances of \(\pi\) and other trivia:

  • a.  Find a real root x in [3, 4] of the following equation:

    [Image: ZZSRC0904.jpg]

    where for aesthetic considerations x! is considered to also apply to real x, not just integers, and the units are in radians.
     
     
  • b.  Find a real root x in [3, 4] of the following equation:

    [Image: ZZSRC0906.jpg]

    where Ω = LambertW(1), the real root of   y ey = 1, log is the natural logarithm and the units are in radians.
     
     
  • c.  Another most famous transcendental constant also appearing everywhere is e = 2.718+. We know that \(\pi\) and e are related by 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 ? Yes, there is, simply evaluate:

                4 * ( Arctan e - Arctan \(\frac{e   -   1}{e   +   1}\) )

     
  • d.  Conversely, the volume enclosed by the n-dimensional sphere of radius R is given by:

    [Image: ZZSRC009D.jpg]

    Go on and evaluate the \(\pi\)-th root of the summation for even dimensions from 0 to \(\infty\) of the volumes enclosed by the respective n-dimensional unit spheres (R = 1).
     
     
  • e.   \(\pi\) also features in a song by Kate Bush (included in her 2005's album "Aerial") about a man who's utterly obsessed with the calculation of \(\pi\) (that could describe some of us here at the MoHPC). She sings more than a hundred digits of \(\pi\) and comments the following about the experience:
     
    • "I really like the challenge of singing numbers, as opposed to words because numbers are so unemotional as a lyric to sing and it was really fascinating singing that. Trying to sort of, put an emotional element into singing about ... a 7 ..., you know, and you really care about that 9.

      I find numbers fascinating, the idea that nearly everything can be broken down into numbers, it is a fascinating thing; and I think also that we are completely surrounded by numbers now, in a way that we weren't, you know, even 20, 30 years ago, we're all walking around with mobile phones and numbers on our foreheads almost; and it's like, you know, computers...

      I suppose, um, I find it fascinating that there are people who actually spend their lives trying to formulate \(\pi\); so the idea of this number, that, in a way is possibly something that will go on to infinity and yet people are trying to pin it down and put their mark on and make it theirs in a way I guess also I think, you know, you get a bit a lot of connection with mathematism and music because of patterns and shapes..."
      (Ken Bruce show, BBC Radio 2, 31 Oct 2005)
        
        
  • f.  Finally, a little serving of trivia. About two years ago a researcher at Google set out a new world record by computing some 31 trillion digits of \(\pi\), namely 31415926535897 digits, to be exact, and was surprised to discover that the very first digits in the output were 31415926535897... What a coincidence !!  Smile

    Also, here you are, a bilingual joke I concocted for this SRC that probably only those of you who understand both English and Spanish will get:
        
           Q:  Fear of number 13 is called "Triskaidekaphobia". How would you call  Fear of number \(\pi\) ?
        
           A:  "Trescatorcephobia"   (select to see)
        
    Sorry for that. Last, for a really good laugh have a look at just a sample of modern papers on \(\pi\) published in what they say are reputable, peer-reviewed journals:
      
    • Paper A, B and C in the IOSR Journal of Mathematics
        
    • Paper D in the International Journal of Engineering Inventions


All your comments are welcome and appreciated. My own results and comments in a few days.
  • And remember: please do NOT include CODE panels in your replies to this thread, as it makes it difficult for me to generate the online PDF document from it. I expect you'll kindly comply with this requirement but otherwise you'll risk your carefully crafted code appearing truncated or not at all in the final PDF and thus being irretrievably lost from the online document and making your posting it moot.

    Researching, testing and formatting these SRC takes considerable time and effort. Hence, if you do enjoy them and would like to see more posted in the future, consider participating or at least commenting on them so that I get feedback of your appreciation. Saying "Hey, I never post a thing but I do read and enjoy them very much !" doesn't quite cut it with me, as then I have no way to tell apart sheer laziness from blatant disinterest. Your move.
  
V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
03-15-2021, 08:19 PM
Post: #2
RE: [VA] SRC #009 - Pi Day 2021 Special
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 Smile

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
03-15-2021, 08:59 PM
Post: #3
RE: [VA] SRC #009 - Pi Day 2021 Special
More on item (c):

(03-14-2021 07:00 PM)Valentin Albillo Wrote:  We know that \(\pi\) and e are related by 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
Visit this user's website Find all posts by this user
Quote this message in a reply
03-15-2021, 09:33 PM (This post was last modified: 03-15-2021 09:34 PM by Gerson W. Barbosa.)
Post: #4
RE: [VA] SRC #009 - Pi Day 2021 Special
(03-15-2021 08:19 PM)J-F Garnier Wrote:  For point (c), well ... it's a nice identity Smile

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.
Find all posts by this user
Quote this message in a reply
03-15-2021, 11:06 PM (This post was last modified: 03-17-2021 02:10 AM by Albert Chan.)
Post: #5
RE: [VA] SRC #009 - Pi Day 2021 Special
(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 x ≥ -1 x > -1): (*)

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.
Find all posts by this user
Quote this message in a reply
03-15-2021, 11:10 PM
Post: #6
RE: [VA] SRC #009 - Pi Day 2021 Special
(03-14-2021 07:00 PM)Valentin Albillo Wrote:                  
Last, for a really good laugh have a look at just a sample of modern papers on \(\pi\) published in what they say are reputable, peer-reviewed journals:
  
  • Paper A, B and C in the IOSR Journal of Mathematics
      
  • Paper D in the International Journal of Engineering Inventions


[/list]All your comments are welcome and appreciated. My own results and comments in a few days.

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...

Cheers,

PeterP
Find all posts by this user
Quote this message in a reply
03-15-2021, 11:12 PM
Post: #7
RE: [VA] SRC #009 - Pi Day 2021 Special
(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.

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 x ≥ -1):

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

Thank you Albert for that explanation to the mere mortals like myself of something which is obviously trivial to Gerson (and you). Very neat.

Cheers,

PeterP
Find all posts by this user
Quote this message in a reply
03-16-2021, 01:08 AM
Post: #8
RE: [VA] SRC #009 - Pi Day 2021 Special
(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 ...
Find all posts by this user
Quote this message in a reply
03-16-2021, 02:38 PM
Post: #9
RE: [VA] SRC #009 - Pi Day 2021 Special
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/quest...ces-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

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
Visit this user's website Find all posts by this user
Quote this message in a reply
03-16-2021, 04:59 PM (This post was last modified: 03-16-2021 07:29 PM by robve.)
Post: #10
RE: [VA] SRC #009 - Pi Day 2021 Special
Quote:a. Find a real root x in [3, 4] of the following equation:

$$ \int_0^x \left( \frac{\sin t}{t} \mathrm{e}^{t/\tan t} \right)^x\,dt = \frac{x\,x^x}{x!} $$
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

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
Visit this user's website Find all posts by this user
Quote this message in a reply
03-16-2021, 06:36 PM
Post: #11
RE: [VA] SRC #009 - Pi Day 2021 Special
      
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 Smile

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.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
03-16-2021, 06:36 PM
Post: #12
RE: [VA] SRC #009 - Pi Day 2021 Special
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
Find all posts by this user
Quote this message in a reply
03-16-2021, 06:50 PM
Post: #13
RE: [VA] SRC #009 - Pi Day 2021 Special
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)
Find all posts by this user
Quote this message in a reply
03-16-2021, 07:17 PM
Post: #14
RE: [VA] SRC #009 - Pi Day 2021 Special
(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:

[Image: ZZSRC009D.jpg]

Go on and evaluate the \(\pi\)-th root of the summation for even dimensions from 0 to \(\infty\) of the volumes enclosed by the respective n-dimensional unit spheres (R = 1).

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.
Find all posts by this user
Quote this message in a reply
03-16-2021, 08:28 PM
Post: #15
RE: [VA] SRC #009 - Pi Day 2021 Special
(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

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.

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

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
Visit this user's website Find all posts by this user
Quote this message in a reply
03-16-2021, 08:41 PM (This post was last modified: 03-16-2021 08:59 PM by J-F Garnier.)
Post: #16
RE: [VA] SRC #009 - Pi Day 2021 Special
(03-16-2021 06:36 PM)Valentin Albillo Wrote:  
J-F Garnier Wrote:For point (c), well ... it's a nice identity Smile
If 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).

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.

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.

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.

Looking forward to see examples, if included in your final comments !

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
03-16-2021, 08:48 PM
Post: #17
RE: [VA] SRC #009 - Pi Day 2021 Special
(03-16-2021 04:59 PM)robve Wrote:  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.

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
Find all posts by this user
Quote this message in a reply
03-16-2021, 09:09 PM
Post: #18
RE: [VA] SRC #009 - Pi Day 2021 Special
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

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
Visit this user's website Find all posts by this user
Quote this message in a reply
03-16-2021, 09:26 PM
Post: #19
RE: [VA] SRC #009 - Pi Day 2021 Special
(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...ead=187663

Regards,

Gerson.
Find all posts by this user
Quote this message in a reply
03-16-2021, 09:43 PM (This post was last modified: 03-16-2021 09:43 PM by Gerson W. Barbosa.)
Post: #20
RE: [VA] SRC #009 - Pi Day 2021 Special
(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.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)