English
Experimente

Ackermann-function A(3,6) as Benchmark

 

p.specht

Wilhelm Friedrich Ackermann (* 1896 in Schönebecke (Herscheid); † 1962 in Lüdenscheid) was one deutscher Mathematiker, the with his function 1926 a These of his Lehrers David Hilbert To drop brought, derzufolge any berechenbaren functions too rekursiv berechenbar seien. Ackermann's function watts 1955 from the Ungarin Rózsa Péter vereinfacht.

for Benchmark-Timingzwecke becomes üblicherweise A(3,6) herangezogen.
' (D) Demoware, 2013-03 of C to XProfan-11 by k. Orkenzieher
' proving too, that something Rekursion too in XProfan functions.
' fountain (Orig.): https://www.xgc.com/benchmarks/ackermann_c.htm
' Updated May 11, 2005. copyright (C-Version): XGC software
' accompanying text the C-Vorbildes:
'   Ackermann's function "is on example of a recursive function which
'   is hardship primitive recursive". It is interesting from the point of
'   view of benchmarking because it "grows faster than any primitive
'   recursive function" and gives us a lot of nested function calls
'   for little effort.
'   It is defined as follows:
'   A(0, n) = n+1
'   A(m, 0) = A(m-1, 1)
'   A(m, n) = A(m-1, A(m, n-1))
'   We use A(3,6) as the benchmark. Diese used to take long enough to
'   confirm the execution time with a stopwatch. Nowadays that's out
'   of the question. The value of A(4,2) has 19729 digits!
'   A (3,6) gives us 172233 calls, with a nesting depth of 511.
'
var m&=3
var n&=6
Declare ans!,t1&,t2&
Windowtitle "Ackermann-Péter A("+st$(m&)+","+st$(n&)+")-Benchmark"
CLS
t1&=&gettickcount
ans! = A(m&,n&)
t2&=&gettickcount
print " Result: ";stature$("%g",ans!)
case (m&=3) and (n&=6) and (ans!<>509) :print "Resultat ";ans!;" wrong,  509 must rauskommen!"
case (m&=3) and (n&=7) and (ans!<>1021):print "Resultat ";ans!;" wrong, 1021 must rauskommen!"
print stature$(" Benchmark-Time = %g Sekunden",(t2&-t1&)/1000)
waitinput
End

proc A

    parameters m&,n&

    if m&=0

        return n&+1

    elseif n&=0

        return A(m&-1,1)

    else

        return A(m&-1,A(m&,n&-1))

    endif

endproc


P.s.: my Lappi (Zweikerner 1.86 GHz) supply:
A(2,200)=403: Interpreter 7,305 sec, Compiler 1,264 sec;
A(3,6)=509: Interpreter 14.445 sec, Compiler 2.663 sec; nProc: 0.002 sec
A(3,7)=1021: Interpreter 61.976 sec, Compiler 11.123 sec; nProc: 0.015 sec
A(3,8)=2045: Interpreter 261.45 sec, Compiler 45.864 sec; nProc: 0.062 sec
A(3,9)=4093: Interpreter and Compiler break because of To high Recursion ab; nProc: 0,265 sec
A(3,10)=8189: nP: 1,092 sec
A(3,11)=16381: nP: 4,212 sec
A(3,12)=32765: nP: 17,019 sec
A(3,13)=65533: nP: 67,47 sec
A(3,n)=2^(n+3)-3
A(4,1)=65533 : nP: 66,737 sec
A(4,2)=2^65536−3 ... not ermitelt
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/09/21  
 




p.specht

Ackermann-function something flotter
-------------------------------------------
there tappt im dunkeln on Long-Integers definiert is, runs the in XProfan-11 right rasch into Überlaufbereich (mark: The numbers are negative). so latter not so quick happens, here a Definition on ganzzahllige Float-variables.
caution: Ackermann(4,2) lead self on Supercomputern in that "Nirwana"...
Window Title "Ackermann-function, on FLoats definiert"
'by the ungar. Mathematikerin Roza Peters sped Version
set("decimals",0):CLS:declare i!,j!

whileloop 0,5:i!=&Loop

    whileloop 0,6:j!=&Loop

        print " ACKERMANN(";i!;",";j!;") = ";ACK(i!,j!)

    endwhile

endwhile

print "---"
waitinput
END

Proc ACK :parameters m!,n!:declare ans!

    if nearly(m!,0,5):ans!=n!+1

    elseif nearly(n!,0,5):ans!=ACK(m!-1,1)

        else :ans!=ACK(m!-1,ack(m!,n!-1))

    endif

    return ans!

endproc

 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/30/21  
 



Zum Experiment


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.558 Views

Themeninformationen

this Topic has 1 subscriber:

p.specht (2x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie