Post Reply 
[VA] SRC#001 - Spiky Integral
07-16-2018, 12:31 AM (This post was last modified: 07-16-2018 12:53 AM by Gerson W. Barbosa.)
Post: #25
RE: [VA] SRC#001 - Spiky Integral
(07-15-2018 06:26 PM)Thomas Klemm Wrote:  This RPL program calculates the coefficients:
Code:
«
  « → m
    « { 1 m } 0 CON OBJ→ DROP m →LIST
    »
  » → n ZEROS
  « { 0 1 } 2 n
    FOR k DUP SIZE → a s
      « k ZEROS EVAL a +
        a 1 k SUB 0 + REVLIST s 1 - ZEROS EVAL +
        ADD
        a k 1 + s SUB k 2 * ZEROS EVAL +
        ADD
      »
    NEXT
  »
»

Thanks! We now can use it to compute the integrals much faster than I was able to before:

%%HP: T(3)A(R)F(.);
\<< DUPDUP DUPDUP * + 2 / 2 MOD
  IF NOT
  THEN
    \<<
      \<< \-> m
        \<< 0 m NDUPN \->LIST
        \>>
      \>> \-> n ZEROS
      \<< { 0 1 } 2 n
        FOR k DUP SIZE \-> a s
          \<< k ZEROS EVAL a + a 1 k SUB 0 + REVLIST s 1 - ZEROS EVAL + ADD a k 1 + s SUB k 2 * ZEROS EVAL + ADD
          \>>
        NEXT
      \>>
    \>> EVAL 1 GET 2 ROT 2 - ^ / \pi *
  ELSE DROP2 0
  END
\>>


(I've only replaced { 1 m } 0 CON OBJ→ DROP m →LIST with John Keith's contribution elsewhere in this thread).

20 -> '1909/65536*π', after 15.1 seconds (previously 118.4 seconds)

And here is a list containing the results of the integrals, starting from n = 1 up to n = 71:

{ 0 0 '1/2*π' '1/4*π' 0 0 '1/8*π' '7/64*π' 0 0 '35/512*π' '31/512*π' 0 0 '361/8192*π' '657/16384*π' 0 0 '2055/65536*π' '1909/65536*π' 0 0 '24955/1048576*π' '46923/2097152*π' 0 0 '316301/16777216*π' '299973/16777216*π' 0 0 '4136805/268435456*π' '15796439/1073741824*π' 0 0 '13853361/1073741824*π' '26585247/2147483648*π' 0 0 '756388295/68719476736*π' '182188585/17179869184*π' 0 0 '20965992017/2199023255552*π' '20268008015/2199023255552*π' 0 0 '294245741167/35184372088832*π' '570497115729/70368744177664*π' 0 0 '4173319332859/562949953421312*π' '4055330794367/562949953421312*π' 0 0 '59723919552183/9007199254740992*π' '58153763705741/9007199254740992*π' 0 0 '430665931945033/72057594037927936*π' '840170667413757/144115188075855872*π' 0 0 '12505857230438737/2305843009213693952*π' '12217503312833669/2305843009213693952*π' 0 0 '182650875111521033/36893488147419103232*π' '44670833701814021/9223372036854775808*π' 0 0 '335205518724079925/73786976294838206464*π' }


Just a few minutes on the emulator.

Thanks again for providing both the program and an explanation why this works!

Gerson.

PS: Here is the result for n = 100, in case someone wants to check it :-)

'432756001487181254158446581/158456325028528675187087900672*π' (399 seconds, on the emulator)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC#001 - Spiky Integral - pier4r - 07-11-2018, 11:10 AM
RE: [VA] SRC#001 - Spiky Integral - Pjwum - 07-12-2018, 10:32 AM
RE: [VA] SRC#001 - Spiky Integral - DavidM - 07-15-2018, 07:53 PM
RE: [VA] SRC#001 - Spiky Integral - Gerson W. Barbosa - 07-16-2018 12:31 AM
RE: [VA] SRC#001 - Spiky Integral - Werner - 07-18-2018, 06:17 AM



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