Post Reply 
[VA] SRC #008 - 2021 is here !
01-05-2021, 07:07 PM
Post: #21
RE: [VA] SRC #008 - 2021 is here !
Hello!

(01-05-2021 06:32 PM)Valentin Albillo Wrote:  ... and last but not least, A-Chan finally saw the light and actually refrained from posting solutions using everything but HP calcs...

This may be due to the fact that most older HP calcs (which are the ones I - as well as many others - prefer) can't handle the 3-digit exponents of puzzle #1 :-)

Regards
Max
Find all posts by this user
Quote this message in a reply
01-05-2021, 07:42 PM (This post was last modified: 01-05-2021 11:45 PM by Albert Chan.)
Post: #22
RE: [VA] SRC #008 - 2021 is here !
(01-05-2021 06:32 PM)Valentin Albillo Wrote:  
  • It is trivially easy to express the fraction 4/2021 as the sum of 4 numbers of the form 1/N where N is a positive integer, namely:

                4/2021   =   1/2021 + 1/2021 + 1/2021 + 1/2021

    See if you can do it with just 3 such numbers.

Code:










2021 = 43 * 47

1/(43*k1) + 1/(47*k2) + 1/(2021*k3) = 4/2021

47/k1 + 43/k2 + 1/k3 = 4

if k = k1 = k2, we have 90/k + 1/k3 = 4

k3 = 1/(4-90/k) = k/(4*k-90) = integer

k=24 → k3=4    → 4/2021 = 1/1032 + 1/1128 + 1/8084
k=30 → k3=1    → 4/2021 = 1/1290 + 1/1410 + 1/2021

Of course, there are many more solutions, if k1 ≠ k2
Find all posts by this user
Quote this message in a reply
01-05-2021, 10:57 PM
Post: #23
RE: [VA] SRC #008 - 2021 is here !
I chose #2 only and I chose this one not because it’s hard but because it’s easy. :-)

Incidentally I got the same result when solving this equation for x on my HP-50g:

\[e^{3x+x\cdot e^{-x}}= 2021+\frac{2^{3+ \sqrt{2}}}{30+3^{3}\cdot 2^{\sqrt{2}}}\]

Not nearly as beautiful as Valentín’s integral, but at least easier to key in.
Find all posts by this user
Quote this message in a reply
01-06-2021, 01:20 PM
Post: #24
RE: [VA] SRC #008 - 2021 is here !
(01-04-2021 04:16 PM)Albert Chan Wrote:  Post #10, we transform I by using substitution: y = pi/2-x, dy = -dx

We can continue substitutions: t = tan(y), dt = (1+t^2) dy
This shift integration limit from y = 0 .. pi/2, to t = 0 .. infinity

One more substitution, t = (1-u)/u, dt = (-1/u^2) du
This shift back integration limit back to finite: u = 0 .. 1

Another way is made use of symmetry.
Code:

I = ∫ f(y) dy, y = -pi/2 .. pi/2
  = ∫ [f(y) + f(-y)] dy, y = 0 .. pi/2         // Fold
  = ∫ g(y) dy, y = 0 .. pi/2                         
  = ∫ [g(y) + g(pi/2-y)] dy, y = 0 .. pi/4     // Fold again

Now, let t = tan(y), dt = (1+t^2) dy
This shift integration limit from y = 0 .. pi/4, to t = 0 .. 1

Integrand looks more complicated, but it actually converge faster !

Note: t = tan(y), tan(pi/2-y) = cot(y) = 1/t

10 INPUT "K? ";K @ C=2^(-1/K) @ P=.0000000001
20 DEF FNF(T,F)=LN((.5+(T+C)^K)*(.5+(F+C)^K)/((.5+ABS(T-C)^K)*(.5+(F-C)^K)))/T
30 T=TIME
40 S1=INTEGRAL(0,C,P,FNF(IVAR,1/IVAR))/K
50 S2=INTEGRAL(C,1,P,FNF(IVAR,1/IVAR))/K
60 DISP S1;"+";S2;"=";S1+S2,TIME-T

>RUN
k? 2.021
 1.88084223982 + .586558860435 = 2.46740110026                  .44
>RUN
k? 1
 1.47906894032 + .98833215996 = 2.46740110028                   .44
>RUN
k? 2
 1.87491615102 + .59248494925 = 2.46740110027                   .44
>RUN
k? 3
 2.08306009111 + .38434100916 = 2.46740110027                   .44
Find all posts by this user
Quote this message in a reply
01-06-2021, 02:54 PM (This post was last modified: 01-06-2021 02:55 PM by Gene.)
Post: #25
RE: [VA] SRC #008 - 2021 is here !
Couple of solutions:

4/2021 = 1/506 + 1/348128 + 1/16362016
4/2021 = 1/506 + 1/348458 + 1/15664771


Using Egyptian fractions. HP-41C program in the Test Stat rom. Program originally in the PPCCJ. Form is a series of 1/N fractions where each N must be different.
Find all posts by this user
Quote this message in a reply
01-06-2021, 07:06 PM
Post: #26
RE: [VA] SRC #008 - 2021 is here !
(01-02-2021 04:09 PM)Nihotte(lma) Wrote:  
Code:

1) at 07.09 PM 2021/01/02
2) at 10.31 PM 2021/01/02
.
.
.
.
.
.
.
.
.
.

Since then, in RAD MODE, I think the expected result would be π...

I'm coming back on the second point. I didn't want to stay on a half-failure...

Code:

2) at 08.06 PM 2021/01/06
.
.
.
.
.
.
.
.
.
.
.

I choose to enter Valentin Albillo's equation with the EQUATION editor of the HP48
Without integral sign, I obtain this result :
'LN(ABS(SIN(x))^2.021+ABS(COS(X)+XROOT(2.021,1/2)*SIN(X))^2.021)/(2.021*COS(X)*SIN(X))'
By the PLOT function in DEG mode and the H-View of -180 --> 180 with AUTOSCALE, I can see the full graph !
It shows that the graph of the function is defined in 3 parts and meets 2 limits : around -90° and +90°
(I have chosen to work in DEG mode rather than RAD for accuracy reasons on my calculators)

As I have seen it in other posts in this thread (thanks to J-F Garnier and Albert Chan, for example), I decided to calculate the integral in 2 parts : 0-->90 and 90-->180 and natural logarithm
So, I'm coming back on the HP15C : the rest of the events take place on the HP15C in which I trust !

Here is the program for the HP15C  :

   ** f LBL C
      COS
      STO 2
      g LASTx
      SIN
      STO 1
      g ABS
      RCL 0
      y^x
      2
      ÷
      RCL 2
      2
      1/x
      RCL 0
      1/x
      y^x
      RCL 1
      x
      +
      g ABS
      RCL 0
      y^x
      +
      g LN
      RCL 0
      RCL 2
      x
      RCL 1
      x
      g TEST 5 (x=y?)
      GTO 8
      ÷
      g RTN
    * f LBL 8
      1
      g RTN


With this usage in 2 parts  :

- 2.021 STO 0
- g DEG
- 0 ENTER 90 
- f ∫xy C
==> 52.95704983 

- 2.021 STO 0
- g DEG
- 180 ENTER 90 (because 90 ENTER 180 falls in ERROR 8 : SOLVE ?)
- f ∫xy C
==> -88.41461966 
And so 88.41461966 in the normal way by 90 ENTER 180 

With the conversion of the results in ->RAD it gives :
52.95704983 --> f RAD : 0.924274882
88.41461966 --> f RAD : 1.543126220

And for the whole integral it gives :
52.95704983 + 88.41461966 --> 141.3716695 --> f RAD : 2.467401102
Find all posts by this user
Quote this message in a reply
01-06-2021, 10:49 PM
Post: #27
RE: [VA] SRC #008 - 2021 is here !
Another way to calculate I, simpler and faster Smile

Code:






Let f(t) = ln((0.5+|t+c|^k)/(0.5+|t-c|^k)), where c = 2^(-1/k)

k*I = ∫(f(t)/t, t = 0 .. inf)
    = (∫f(t)/t, t = 0 .. c) + (∫f(t)/t, t = c .. inf)
    = (∫f(t)/t, t = 0 .. c) + (∫f(1/t)/t, t = 0 .. 1/c)

10 INPUT "k? ";K @ C=2^(-1/K) @ P=.0000000001
20 DEF FNF(T)=LN((.5+(T+C)^K)/(.5+ABS(T-C)^K))
30 T=TIME
40 S1=INTEGRAL(0,C,P,FNF(IVAR)/IVAR)/K
50 S2=INTEGRAL(0,1/C,P,FNF(1/IVAR)/IVAR)/K
60 DISP S1;"+";S2;"=";S1+S2,TIME-T

>RUN
k? 2.021
 .936151026284 + 1.53125007398 = 2.46740110026                  .38
>RUN
k? 1
 1.0306547334 + 1.43674636689 = 2.46740110029                   .33
>RUN
k? 2
 .937458075505 + 1.52994302476 = 2.46740110026                  .38
>RUN
k? 3
 .89186293341 + 1.57553816687 = 2.46740110028                   .39
Find all posts by this user
Quote this message in a reply
01-07-2021, 09:37 PM (This post was last modified: 01-09-2021 01:38 AM by Valentin Albillo.)
Post: #28
RE: [VA] SRC #008 - 2021 is here !
      
Hi all:

First of all, thanks to all of you for the warm welcome to my SRC #008 and the many contributions by Nihotte(lma), Vincent Weber, J-F Garnier, robve, Dwight Sturrock, Albert Chan, StephenG1CMZ, Albert Chan (again), Gene, ijabbott, telemachos, Maximilian Hohmann, Gerson W. Barbosa and last but not least, Albert Chan, thanks a lot to all of you for your interest and your solutions and quite varied approaches Smile

These are my original solutions:
        
1) Let's partition 2021 into a set of positive integer numbers that add up to 2021. Find the set of such numbers whose product is maximum, and output that maximum in all its full glory.


It's easy to see that only using just the terms 2 and 3 will produce the maximum product, because:
  • if a term = 5 then we can replace it by 2+3, which contributes the same to the sum, 5, but increases the product as 2*3 = 6 > 5.
    The same is true for terms >5 (e.g.: 6 = 3+3 but 3*3 = 9 > 6, 7 = 3+2+2 but 3*2*2 = 12 >7, etc.)
          
  • if a term = 4 then it can be replaced by 2+2, which contributes the same for both the sum and the product.
          
  • if a term = 1 then 1+2 can be replaced by 3, as 1*2 = 2 < 3, and 1+3 can be replaced by 2+2, as 1*3 = 3 < 2*2 = 4.
Thus only terms 2 and 3 will need to be considered, and furthermore as three 2's can be replaced by two 3's, which have the same sum (6) but 2*2*2 = 8 < 3*3 = 9, then at most two 2's can be part of the solution. As 2021 = 3 * 673 + 2, then the maximum product will be the product of 673 3's and one 2, i.e: Max. P = 2*3673.

In general, for integer N = 3 * q + r, where q is the quotient and r is the reminder, the maximum products are:

            - if r = 0: Max. P = 3q (no 2's, all are 3's)
            - if r = 1: Max. P = 22*3q-1 (two 2's, the rest are 3's)
            - if r = 2: Max. P = 2*3q (one 2, the rest are 3's)

For real N all summands must be equal because of the Arithmetic-Geometric Means inequality, and they must be as close to e = 2.718+ as possible, which is the reason behind the need for a majority of 3's in the integer N case, as 3 is the integer closer to e.

Also, as I am so adamant in HP calcs being used to solve the questions I propose, you may wonder where do HP calcs intervene in my solution ? Well, to fulfill the "output that maximum in all its full glory" part of the task, that's where, and to that effect I've concocted this 5-line (220-byte) program for the HP-71B, which exactly computes the 322 digits of the max. product P = 2*3673 in half a second using the excellent J-F Garnier's Emu71 emulator:

      1   DESTROY ALL @ OPTION BASE 0 @ DIM A(36) @ K=10^9 @ A(0)=2*3^13 @ P=0
      2   FOR J=1 TO 110 @ MAT A=(729)*A @ FOR I=0 TO P @ A(I+1)=A(I+1)+A(I) DIV K
      3   A(I)=MOD(A(I),K) @ NEXT I @ P=P+SGN(A(P+1)) @ NEXT J @ J=0
      4   DISP STR$(A(P)); @ FOR I=P-1 TO 0 STEP -1 @ J=J+1 @ IF J=5 THEN DISP @ J=0
      5   A$=STR$(A(I)) @ DISP RPT$("0",9-LEN(A$));A$; @ NEXT I @ DISP

            Line 1      initializes
            Lines 2-3   compute the 322-digit product
            Lines 4-5   output the result

         >RUN

              2532995521886826292328149655127793939711079
            6485699809049268130708906002579675557​88084132
            383052323458136675408253781974882864255212314
            264505911807500659338824573​345556963262198232
            747186628808383273213581619626233679533487706
            06025349498189611​2664520885716630483899029142
            003916544644957076791520721759240671604739781
            810307846



2) Numerically evaluate as accurately as possible this nice definite integral using your favorite HP calc (per standard notation, the | ... | vertical bars mean "absolute value"):

[Image: Integral.gif]

and for extra points, see if you can symbolically recognize the resulting value. You'll need a sufficiently accurate value to do it, though ... Smile



The funny thing about this integral is that its value remains the same if you replace 2.021 by any positive real value !!

This means that the integral's value is the same for 2.021 or 0.2021, 20.21, 2021, Pi, e, the Golden Ratio, your age, your phone number, etc. So it doesn't actually matter whether the "." in 2.021 is taken as the decimal point or as the thousands separator, as one of you wondered   Smile

Let's compute it using Free42 Decimal for extra accuracy. We'll need this short 32-step (60-byte) program which defines a generalized version of the function to integrate (you can specify 2.021 or any other constant):

      LBL "SRC82"      Y^X          1/X             ABS
      MVAR "X"          2           X<>Y            RCL "X"
      MVAR "Z"          /           STO ST T        STOx ST T
      RCL "Z"          X<>Y          x              Y^X
      SIN               2           RCL "Z"          +
      ENTER            RCL "X"      COS             LN
      ABS              1/X          STOx ST T       RCL/ ST Y
      RCL "X"          Y^X           +              END


and now, using the built-in Integrate application (the "S" are Integral symbols):

      [Sf(x)]   -> Select Sf(x) Program
      [SRC82]   -> Set Vars; Select Svar
                   [X][Z]

      2.021 [X] -> X=2.021
            [Z] -> [LLIM][ULIM][ACC]   [S]

       0 [LLIM] -> LLIM=0
    [PI] [ULIM] -> ULIM=3.14159265359
     1E-6 [ACC] -> ACC=0.000001
            [S] -> Integrating -> 2.46739926409
      [+][SHOW] -> 2.46740110027233423194...


All that remains now is to symbolically recognize this value, for example using my IDENTIFY program (listing, description and examples here), and the result is Pi2/4, which evaluates to 2.46740110027233965470... so we've got 15 correct digits. You may vary the 2.021 value above and re-compute the integral, to check that indeed you get the same result.


3) Decompose 4/2021 into a sum of three fractions of the form 1/K where K is a positive integer.


As we saw in (1) above, 2021 is a number of the form N = 3*m + 2 and for such numbers we have the algebraic identity:

      4/(3*m + 2) = 1/(3*m + 2) + 1/(m + 1) + 1 /((m + 1) * (3*m + 2))

so we'll use this trivial program to ask for N (which must be of the form 3*m + 2) and output the resulting denominators:

      1   DESTROY ALL @ INPUT N
      2   IF MOD(N,3)#2 THEN DISP "Not of form 3*m+2" @ END
      3   M=N DIV 3 @ DISP N;M+1;N*(M+1)

            >RUN
            ? 2021
                        2021      674      1362154


so:       4/2021 = 1/2021 + 1/674 + 1/1362154, and of course many other solutions are possible as well.

As another example, using the program for 2027, which is a prime number and thus can't be factorized, we get:

            >RUN
            ? 2027
                        2027      676      1370252

so  4/2027 = 1/2027 + 1/676 + 1/1370252, and so on and so forth.

Note that as the first summand fraction is 1/N, the remaining two add up to 3/N, thus we also have a decomposition of 3/N into two 1/K fractions.

Thanks again for your interest and contributions.

Best regards.
V.

Edited to include a slightly optimized version of the BASIC code (30 bytes shorter)

  
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
01-07-2021, 10:40 PM
Post: #29
RE: [VA] SRC #008 - 2021 is here !
(01-07-2021 09:37 PM)Valentin Albillo Wrote:  [Image: Integral.gif]

The funny thing about this integral is that its value remains the same if you replace 2.021 by any positive real value !!

Can you explain why ? Huh

With the help of HP Prime emulator, here is the proof for k = 2:

I = ∫(ln(sin(x)^2/2 + (cos(x)+sin(x)/sqrt(2))^2) / sin(2x), x = 0. .. pi)
  = ∫(ln(1+sin(2x)/sqrt(2)) / sin(2x), x = 0. .. pi)

I = ∫(ln(1+sin(2y)/sqrt(2)) / sin(2y), y = -pi/2. .. pi/2)       -- y = pi/2-x, dy=-dx
  = ∫(2*atanh(sin(2y)/sqrt(2)) / sin(2y), y = 0. .. pi/2)       -- ln((1+x)/(1-x)) = 2*atanh(x)

I = ∫(atanh(sin(z)/sqrt(2)) / sin(z), z = 0. .. pi)                  -- z = 2*y, dz=2*dy
  = ∫(2*atanh(sin(z)/sqrt(2)) / sin(z), z = 0. .. pi/2)            -- sin(z) symmetry around pi/2

I = ∫(2*atanh(sqrt(2)*t/(1+t^2))/t, t = 0. .. 1)          -- t = tan(y/2), dt=(1+t^2)/2*dx

CAS> series(atanh(√2*t/(1+t^2))/(√2),t,0,18,polynom)

t -1/3*t^3-1/5*t^5+1/7*t^7+1/9*t^9 -1/11*t^11-1/13*t^13+1/15*t^15+1/17*t^17

2*atanh(√(2)*t/(1+t*t))/t
= √(8) * (1 - t^2/3 - t^4/5 + t^6/7 + t^8/9 - t^10/11 - t^12/13 + t^14/15 + t^16/17 - ...)

Integrate term by term, t from 0 to 1:

I = √(8) * (1 - 1/3² - 1/5² + 1/7² + 1/9² - 1/11² - 1/13² + 1/15² + 1/17² - ...)

Cas> s1 := simplify(sum(1/(2k-1)^2, k=1..inf))                       // pi^2/8
Cas> s2 := simplify(sum(1/(8k-1)^2 + 1/(8k+1)^2, k=1..inf)) // (√(2)*pi^2+2*pi^2-32)/32
Cas> simplify(sqrt(8) * (2 - s1 + 2*s2))                                  // I = pi^2/4

I can proof s1 by hand, but not s2 (any help appreciated) Sad
Find all posts by this user
Quote this message in a reply
01-08-2021, 01:28 AM
Post: #30
RE: [VA] SRC #008 - 2021 is here !
(01-06-2021 10:49 PM)Albert Chan Wrote:  Let f(t) = ln((0.5+|t+c|^k)/(0.5+|t-c|^k)), where c = 2^(-1/k)

k*I = ∫(f(t)/t, t = 0 .. inf)
= (∫f(t)/t, t = 0 .. c) + (∫f(t)/t, t = c .. inf)
= (∫f(t)/t, t = 0 .. c) + (∫f(1/t)/t, t = 0 .. 1/c)

Code:



I should have gone further, and scale both limits, from 0 to 1:

k*I = (∫f(c*t)/t, t = 0 .. 1) + (∫f(c/t)/t, t = 0 .. 1) = (∫g(t), t = 0 .. 1)

What is nice is c = 2^(-1/k) is not needed in the code !
Another hint that value of k does not matter ...

Combined parts into 1 integral, the code also run faster.

10 INPUT "k? ";K @ P=.0000000001
20 DEF FNG(T,F)=LN((1+(1+T)^K)*(1+(F+1)^K)/((1+(1-T)^K)*(1+(F-1)^K)))/T
30 T=TIME
40 DISP INTEGRAL(0,1,P,FNG(IVAR,1/IVAR))/K;TIME-T

>RUN
k? 2.021
 2.46740110026  .28
>RUN
k? 1
 2.46740110027  .3
>RUN
k? 2
 2.46740110026  .27
>RUN
k? 3
 2.46740110026  .27

For k=1, g(t) is simple enough that Wolfram Alpha can proof it (after a few seconds) Smile

I = ∫(ln((2+t)/(2-t)*(2t+1))/t, t = 0 .. 1) = pi^2/4
Find all posts by this user
Quote this message in a reply
01-08-2021, 09:04 AM
Post: #31
RE: [VA] SRC #008 - 2021 is here !
(01-07-2021 09:37 PM)Valentin Albillo Wrote:  ... I've concocted this unoptimized 5-line (250-byte) program for the HP-71B, which exactly computes the 322 digits of the max. product P = 2*3673 in half a second using the excellent J-F Garnier's Emu71 emulator

Thanks :-)
Emu71/DOS is more than 20 years old but still going strong !




(01-07-2021 10:40 PM)Albert Chan Wrote:  
(01-07-2021 09:37 PM)Valentin Albillo Wrote:  [Image: Integral.gif]

The funny thing about this integral is that its value remains the same if you replace 2.021 by any positive real value !!

Can you explain why ? Huh

Yes, please Valentin; I was expecting to get an explanation or at least some indications.

I used this effect to actually compute the integral on the HP-32S with the value k=2 to replace the exponentiation operations with simple squaring, for a much faster computation.

Also I computed the integral in two parts, from 0 to pi/2 and pi/2 to pi, since the pi/2 value causes a 0/0 limit of the function. The HP algorithm is robust when this kind of limit is at the edges, but not always when it is within the integration range especially when using high target accuracy (I used accuracy= 1E-10).

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
01-08-2021, 01:32 PM
Post: #32
RE: [VA] SRC #008 - 2021 is here !
I second these calls for an explanation of the inner workings of this ingenious and unexpected integral - but I have another request too: how, Valentin, did you discover or construct this integral?
Find all posts by this user
Quote this message in a reply
01-12-2021, 03:27 AM
Post: #33
RE: [VA] SRC #008 - 2021 is here !
Re-posting this from Spence function thread, per Valentin Albillo's request.

(01-11-2021 06:16 PM)Albert Chan Wrote:  
(01-07-2021 09:37 PM)Valentin Albillo Wrote:  [Image: Integral.gif]

The funny thing about this integral is that its value remains the same if you replace 2.021 by any positive real value !!

I think Spence's function (Dilogarithms) is the key to proof I = pi^2/4, for any k

After transformation, we have I = ∫(g(t) dt, t = 0 .. 1)

\(\exp(g(t)·k\,t) = \Large
{(1+(1+t)^k)·(1+({1\over t}+1)^k) \over (1+(1-t)^k)·(1+({1\over t}-1)^k)} =
{(1+(1+t)^k)·(t^k+(1+t)^k) \over (1+(1-t)^k)·(t^k+(1-t)^k)}\)

For now, assume k is positive integer → numerator is polynomial of t, with degree 2k.

Let W = exp((2n+1)/k*pi*i), n = 0 .. k-1. In other words, W = roots of x^k = -1

roots of numerator   , t = W-1, 1/(W-1)
roots of denominator, t = 1-W, 1/(W+1)

Consider just 1 of W (we have k of them), factor it out, scaled away k, and integrate:

\(\displaystyle \int _0^1 \ln\left( {(1-{t \over w-1})·(1-t(w-1)) \over
(1-{t \over 1-w})·(1-t(w+1)) }\right) {dt \over t} \normalsize
= -Li_2({1\over w-1}) + Li_2({1\over 1-w}) - Li_2(w-1) + Li_2(w+1) \)

I = average of all the k pieces, dropped imaginary parts (since I is real)

For example, for k = 7, these are the integral pieces.

>>> from mpmath import *
>>> Li2 = lambda x: polylog(2, x)
>>> k = 7
>>> W = [exp((2*n+1)/k*pi*1j) for n in range(k)]
>>> for w in W: print -Li2(1/(w-1)) + Li2(1/(1-w)) - Li2(w-1) + Li2(w+1)
...
(2.46740110027234 + 5.0951007958138j)
(2.46740110027234 + 2.21291211873152j)
(2.46740110027234 + 0.940187304494618j)
(2.46740110027234 + 1.22410719457408e-16j)
(2.46740110027234 - 0.940187304494618j)
(2.46740110027234 - 2.21291211873152j)
(2.46740110027234 - 5.0951007958138j)

All the real parts have the same size = pi^2/4 Smile

What happened if k is not integer ? Lets try k = 2.021
Amazingly, for any non-zero real k, real part of the integral piece still = pi^2/4

>>> w = exp(pi*1j/2.021)
>>> print -Li2(1/(w-1)) + Li2(1/(1-w)) - Li2(w-1) + Li2(w+1)
(2.46740110027234 + 1.85770404643526j)

Note: this only show how integral evaluated to the same value, for different k's
It is still not a proof, but much closer than what I had before ...
Find all posts by this user
Quote this message in a reply
01-14-2021, 01:42 AM
Post: #34
RE: [VA] SRC #008 - 2021 is here !
            
Hi, all:

Thanks for your interest in my SRC #008, some comments to your posts and some answers to your questions:

Nihotte(lma) Wrote:I have tested several configurations but it seems to me that 673x3 + 2 gives the best result With a result of 2021 and 2,5329955 x 10^321 ... I'm coming back on the second point. I didn't want to stay on a half-failure... and for the whole integral it gives : [...] 2.467401102

You gave the first correct solution to Case 1 but forgot to also give the exact 322-digit result as requested. Not bad ! And your value for the integral using the HP-15C is correct as well, congratulations.

J-F Garnier Wrote:Using your great "Identifying Constants" program, I found the symbolic value, a nice surprise, that lead me to another conclusion about the expression to integrate :-)

Hehe, you got it, both the symbolic value (Pi2/4) and the fact that the integral's value doesn't depend on the constant being 2.021 and thus you could use 2 instead to speed up the numerical integration using the HP32S no less. And thanks a lot for your kind comments and the link to my Article.

robve Wrote:Thanks for posting. A good motivation to write some code on HP Prime. You did not mention that RPN is required...

Indeed, the Prime is an HP calculator alright. And your fine solution is the very first one to give the full 322-digit correct value for Case 1.

Albert Chan Wrote:(many, many things spread over many, many posts)

Thanks for your abundant, relentless and interesting approaches both numerical and theoretical, Albert, and most especially for using HP calculators to obtain them, as I requested. At least you did for your very first posts ...

StephenG1CMZ Wrote:But if that "." is meant to be a thousands separator rather than decimal, representing the year 2021 rather than the year 2 , I get undef ...

As you may have seen, the dot may be taken as the decimal separator or the thousands separator and it willl make no difference to the result    Smile

ijabbott Wrote:Some clues: Splitting a 1 [...]

Your detailed explanation mimics my original solution and is quite didactic for people who would like to understand the logic behind the result, well done.

Maximilian Hohmann Wrote:This may be due to the fact that most older HP calcs (which are the ones I - as well as many others - prefer) can't handle the 3-digit exponents of puzzle #1 :-)

Well, that shouldn't be a problem, many of my former Challenges and Short & Sweet Math Challenges did require multiprecision values. Remember for instance my "Sweet & Short Math Challenges #15: April 1st Spring Special", where I posted a 9-line program for the HP-71B which computed and printed in full the exact solution to the "Take 5" sub-challenge, namely 265536-3, which is a 19,729-digit integer. There were RPL programs doing likewise, too.

Gerson W. Barbosa Wrote:I chose #2 only and I chose this one not because it’s hard but because it’s easy. :-) [...] Not nearly as beautiful as Valentín’s integral, but at least easier to key in.

Hehe, Gerson, you're playing tricks here, your (very nice, by the way) expression evaluates to 2.4674011002718... while the correct value is Pi2/4 =
2.4674011002723... (Very) close but no cigar ! Smile

Gene Wrote:Couple of solutions: [...] Using Egyptian fractions. HP-41C program in the Test Stat rom.

Very correct, if different from my original solution. And a very useful reference, thanks.

Albert Chan Wrote:Can you explain why ?
J-F Garnier Wrote:Yes, please Valentin; I was expecting to get an explanation or at least some indications.
EdS2 Wrote:I second these calls for an explanation of the inner workings of this ingenious and unexpected integral

Thanks for your interest and well, my goal with these SRC's and Challenges is to show some interesting HP-calc programming techniques (mostly for the classic models), as well as some interesting, little-known and even unexpected math topics, hopefully for the enjoyment of (at least some) MoHPC forum's readers. Also, if I can provide technical details or proofs which aren't too lengthy and/or complicated, I'll usually do it.

For instance, this is not the first time I post a definite integral allegedly dependent on some parameter but actually being independent of it, such as the two integrals featured in my Short & Sweet Math Challenge #18: April 1st, 2007 Spring Special, namely:

            / Inf
            |
       I1 = | 1/((1+x2)*(1+x4.012007)) .dx
            |
            / 0
and
            / Pi/2
            |
       I2 = | 1/(1+Tan(x)4.012007) .dx
            |
            / 0


which actually are one and the same upon a simple change of variables and their value is Pi/4. The proof of their being independent of the parameter (the 4.012007 value) is short enough that I did post my own proof of the fact in Message #54 in that thread.

However, for the present integral the proof is not that easy or short, actually it's quite long and would require a lot of time and cumbersome math "typesetting" to post it here, which regrettably is beyond the scope of these SRC's. I'll give however a link to "some indications" for a very similar integral, which you can find here.

The proof for the similar integral I posted (I don't have a link to the proof, sorry) essentially goes along the same lines. Also, if you think that an integral with a parameter whose value is independent of it is something quite unexpected, wait till you see the next integral I'll post in a future SRC, it's 10x as much ! Smile

Best regards to all and thanks for participating.
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
01-14-2021, 01:59 PM
Post: #35
RE: [VA] SRC #008 - 2021 is here !
Hi Valentin,

And not one word about my attempt to give a general, mathematical (albeit certainly flawed in many ways) solution for #1 ? Ok, ok, I didn't try to compute it for utmost precision with an HP calculator... but I gave it some thoughts. Just teasing Wink

Cheers,

Vincent
Find all posts by this user
Quote this message in a reply
01-14-2021, 06:51 PM
Post: #36
RE: [VA] SRC #008 - 2021 is here !
.
Hi, Vincent:

(01-14-2021 01:59 PM)Vincent Weber Wrote:  And not one word about my attempt to give a general, mathematical (albeit certainly flawed in many ways) solution for #1 ?


Matter of fact I couldn't read your message. I don't know what browser or app you used to format and post it, but this is how it does appear in my browser and yes, that infinitely long message is the one you posted ...

[Image: TEST3-DISREGARD.jpg]

... . As you may see, it dwarfs all other messages in the thread, in fact it extends much beyond the limits of the browser's window and forces me to zoom a lot to be able to read all other messages which are scaled down to unreadable small text, while yours can't be scrolled horizontally any further but is cropped instead so I can't read it properly either, it's truncated.

I considered asking you to remove it and re-post it again properly formatted but I didn't want to ruffle any feathers and preferred to say nothing about the matter though this will probably affect the future creation of the thread's PDF as well, I'll have to edit it somehow.

I do appreciate your continued interest in my productions, Vincent, but next time you'd like to post something in one of my threads, please make sure to format it properly, everyone else does. Smile

Thanks and 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
01-14-2021, 10:18 PM
Post: #37
RE: [VA] SRC #008 - 2021 is here !
Hi Valentin,
My bad ! I posted this using my phone, not realizing how bad the formatting would be.
I have deleted the original post.
Now that the challenge is over, please find below my original text without the code tags, for your kind consideration.

Many thanks and best regards,

Vincent

First, let's fix the number of numbers the sum is composed of.
Let's try the simplest case - 2 numbers. There are x and 2021-x.
The product is maximum when the derivative of x*(2021-x) is 0, so when 2021-x-x=0, or x=2021/2. This is not an integer, ok, but then I got the intuition that the product is maximized when the numbers are as close to each other as possible.
So let's try with 3 numbers. They are x,y,and (2021-x-y).
The product is maximized when both x and y partial derivatives are zero, so when 2021-2x-y=0 and 2021-x-2y=0. This simple system leads to x=y=2021/3. Again, non-integer, but confirms the intution that the numbers need to be equal !
So I was bald engouh to take this intuition for granted for any number of numbers Smile
So now, what this number of numbers should be ?
Well if x is this number, then 2021/x is each equal number contributing to the sum, and the product is (2021/x)^x, which is also equal to e^(x.ln(2021/x)).
Composition derivation leads to a derivative of
(ln(2021/x)+x.-2021/x^2*x/2021)*...= (Ln(2021/x)-1)*... ("..." being the original product function which is never going to be zero).

Which leads to an optimal number of numbers of x=2021/e = 743.48... non integer of course.So each number should ideally be equal to e=2.718... the closest integer that comes to mind is obviously 3. You can fit 673 times 3 in 2021. 3×673=2019, remains 2. As for the product, 3^673*2=2.53E321, which is, well, quite a lot Smile maybe not as much as you expected though , Valentin ? Smile
I could write a stupid brute force algorithm for the fast free42, trying every single possibility, but I am too lazy for that Smile
Find all posts by this user
Quote this message in a reply
01-14-2021, 10:49 PM (This post was last modified: 01-15-2021 09:16 AM by Albert Chan.)
Post: #38
RE: [VA] SRC #008 - 2021 is here !
(01-14-2021 10:18 PM)Vincent Weber Wrote:  Well if x is this number, then 2021/x is each equal number contributing to the sum, and the product is (2021/x)^x ...

Instead of letting x = number of products, it may be better letting x = base.

P = x ^ (2021/x)
ln(P) = (2021/x) * ln(x)
ln(P)/2021 = ln(x)/x

We like to maximize P, so find the local extremum.

0 = (x*(1/x) - ln(x)*1) / x^2       → 1 = ln(x)       → x = e

Quote:e=2.718... the closest integer that comes to mind is obviously 3

The safer way is not going for closest integer, but actually check value of ln(x)/x

3^2 > 2^3
2 ln(3) > 3 ln(2)
ln(3)/3 > ln(2)/2 = ln(4)/4

This showed ln(x)/x maximized when x=e, and we should pack as many 3's as possible.
(with the exception of N mod 3 = 1, since 3+1 > 3×1)

2021 = 3*673 + 2 → P = 3^673 * 2
Find all posts by this user
Quote this message in a reply
01-15-2021, 12:50 AM
Post: #39
RE: [VA] SRC #008 - 2021 is here !
.
Hi, Vincent:

(01-14-2021 10:18 PM)Vincent Weber Wrote:  My bad ! I posted this using my phone, not realizing how bad the formatting would be. I have deleted the original post.

That sort of explains it. Thanks for deleting the post, that will make generating a properly formatted PDF much easier.

Quote:Now that the challenge is over, please find below my original text without the code tags, for your kind consideration.

But of course, my pleasure. Let's see:

Quote:First, let's fix the number of numbers the sum is composed of. Let's try the simplest case - 2 numbers. There are x and 2021-x. The product is maximum when the derivative of x*(2021-x) is 0, so when 2021-x-x=0, or x=2021/2. This is not an integer, ok, but then I got the intuition that the product is maximized when the numbers are as close to each other as possible.

Totally correct, and a logical intuition.

Quote:So let's try with 3 numbers. They are x,y,and (2021-x-y).
The product is maximized when both x and y partial derivatives are zero, so when 2021-2x-y=0 and 2021-x-2y=0. This simple system leads to x=y=2021/3. Again, non-integer, but confirms the intution that the numbers need to be equal !

Again, quite correct and indeed reinforces said intuition.

Quote:So I was bald engouh to take this intuition for granted for any number of numbers Smile

Very plausible, the previous cases are motivation enough to hypothesize that if the intuition was correct for the cases N=2 and N=3 it's reasonable to assume that it might also be true for general N and see where that leads us. So far so good.

Quote:So now, what this number of numbers should be ? Well if x is this number, then 2021/x is each equal number contributing to the sum, and the product is (2021/x)^x, which is also equal to e^(x.ln(2021/x)). Composition derivation leads to a derivative of

(ln(2021/x)+x.-2021/x^2*x/2021)*...= (Ln(2021/x)-1)*... ("..." being the original product function which is never going to be zero).

Which leads to an optimal number of numbers of x=2021/e = 743.48... non integer of course.

Correct reasoning, nihil obstat.

Quote:So each number should ideally be equal to e=2.718... the closest integer that comes to mind is obviously 3. You can fit 673 times 3 in 2021. 3×673=2019, remains 2. As for the product, 3^673*2=2.53E321, which is, well, quite a lot Smile maybe not as much as you expected though , Valentin ? Smile

The reasoning is crystal-clear and the conclusion, correct. And I did expect exactly as much from you, Vincent  Smile

Congratulations are in order and I'm glad I finally got to see your original message, it's been an interesting read for me and I'm sure that many other readers of this thread will find it very interesting (and enlightening!) as well.

Thanks again for your fine contribution, it sure helps a lot to achieve my stated main goal for these SRC's. Hope you enjoyed it all and I fully expect to see you participate in the next one !  Smile

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
01-15-2021, 06:24 AM (This post was last modified: 01-15-2021 06:25 AM by Vincent Weber.)
Post: #40
RE: [VA] SRC #008 - 2021 is here !
Many thanks, Valentin, for your kind words ! Much appreciated.

Many thanks also to Albert, for rightfully pointing that rounding to the closest integer is not good enough, that indeed needs to be tested.

Best regards,

Vincent
Find all posts by this user
Quote this message in a reply
Post Reply 




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