bernoulli |
index /home/tomek/Desktop/py/bernoulli/bernoulli.py |
Summary:
Intended for calculating partial sums of powers of natural numbers.
Can also print n+1 Bernoulli numbers,
do python math, cache crucial numbers.
Warning: Not fitting for server. Has many vunerabilities.
Can launch arbitrary code.
Help, usage:
You can take advantage of command line interface
to see some available commands.
Use "python Bernoulli.py help" terminal command for that purpose.
You can also enter interactive mode by launching Bernoulli.py
without any parameters.
Caching:
App saves calculated values that are most vital for calculations.
These are generally needed to quickly construct
a sequence of Bernoulli numbers.
This optimization makes futher uses of bernoulli app faster.
Overhead for reading/writing these numbers from/to cache file
dependes on quantity stored numbers
(it's ~0.5s for 3001 Bernoulli & 3001 generator numbers).
Modules | ||||||
|
Functions | ||
|
Data | ||
ACTIVE_CFNAME = 'ActiveBernoulli.pycache' CACHE_FNAME = 'Bernoulli.pycache' CLI = {'help': <function explain_commands>, 'nth_Bernoulli_num': <function <lambda>>, 'sum_of_pows': <function <lambda>>, 'up_to_n_Bernoulli_num': <function <lambda>>} CLI_shorthands = {'h': 'help', 'nth': 'nth_Bernoulli_num', 'psum': 'sum_of_pows', 'up_to': 'up_to_n_Bernoulli_num'} MAX_NO_NUMS_SAVED_TO_CACHE_FILE = 3000 bernoulli_nums = [Fraction(1, 1), Fraction(1, 2), Fraction(1, 6), Fraction(0, 1), Fraction(-1, 30), Fraction(0, 1), Fraction(1, 42), Fraction(0, 1), Fraction(-1, 30), Fraction(0, 1), Fraction(5, 66), Fraction(0, 1), Fraction(-691, 2730), Fraction(0, 1), Fraction(7, 6), Fraction(0, 1), Fraction(-3617, 510), Fraction(0, 1), Fraction(43867, 798), Fraction(0, 1), ...] bernoulli_nums_read_from_cache = 3001 fi = <_io.BufferedReader name='Bernoulli.pycache'> generator_nums = [Fraction(-28919392162925009628147618267854828678...43417141322454179981, 12072109463901626300591430), Fraction(289193921629250096281476182678548286786...43417141322454179981, 12072109463901626300591430), Fraction(-28909498656239440817132902266130953561...42948191954615203, 24136170854827318183649132380), Fraction(240902974703323072350074180714794148154...047997999635144924, 6034042713706829545912283095), Fraction(-15706785477727606373313358586735811532...5176978896050, 157383522484529752314211715053647), Fraction(125626711935336963187417254920581429377...7005833254955, 629534089938119009256846860214588), Fraction(-61860632867156655391591165272550541148...63464751458391, 18606918914427162835177739710776), Fraction(320142944028610659753320487209140615727...21263200795892, 67450081064798465277519306451563), Fraction(-21177330654661567986589889557655011964...3375391, 357295295359363650741508916992764327410), Fraction(469937051619038511607177992674275654902...75458095, 71459059071872730148301783398552865482), Fraction(-94348138629144884118571424764082017089...1, 143751317779967301444181829536663148547726396), Fraction(712852865880697737750146541043868326549...63, 11979276481663941787015152461388595712310533), Fraction(-11170448402525564512134399000657189200...774958239416726467448947512630223325145058085660), Fraction(244402324284826588666321863415543426801...221416639833350419271127860751492378612873738760), Fraction(-23144710245345478159447687749486972122...896188885311113389236150381433532317148383165168), Fraction(209691180216455519695246566095186015550...570113397197049881463370643770210126346462203237), Fraction(-46898559563627223444503090233042627402...643016614905537175226201298616681820692080528030), Fraction(303330602887989453096020316266518533259...404779623878393019469577922068520202299120058670), Fraction(-68771984184923501551629267139661434359...510370711039766117075646973125280286847164361460), Fraction(205025750937149931018303466360660355305...434631588478655173184970095470361649371195078395), ...] glob = {'ACTIVE_CFNAME': 'ActiveBernoulli.pycache', 'CACHE_FNAME': 'Bernoulli.pycache', 'CLI': {'help': <function explain_commands>, 'nth_Bernoulli_num': <function <lambda>>, 'sum_of_pows': <function <lambda>>, 'up_to_n_Bernoulli_num': <function <lambda>>}, 'CLI_shorthands': {'h': 'help', 'nth': 'nth_Bernoulli_num', 'psum': 'sum_of_pows', 'up_to': 'up_to_n_Bernoulli_num'}, 'MAX_NO_NUMS_SAVED_TO_CACHE_FILE': 3000, '__builtins__': {'ArithmeticError': <class 'ArithmeticError'>, 'AssertionError': <class 'AssertionError'>, 'AttributeError': <class 'AttributeError'>, 'BaseException': <class 'BaseException'>, 'BaseExceptionGroup': <class 'BaseExceptionGroup'>, 'BlockingIOError': <class 'BlockingIOError'>, 'BrokenPipeError': <class 'BrokenPipeError'>, 'BufferError': <class 'BufferError'>, 'BytesWarning': <class 'BytesWarning'>, 'ChildProcessError': <class 'ChildProcessError'>, ...}, '__cached__': '/home/tomek/Desktop/py/bernoulli/__pycache__/bernoulli.cpython-312.pyc', '__doc__': '\nSummary:\n Intended for calculating partial s...5s for 3001 Bernoulli & 3001 generator numbers).\n', '__file__': '/home/tomek/Desktop/py/bernoulli/bernoulli.py', '__loader__': <_frozen_importlib_external.SourceFileLoader object>, ...} help = Type help() for interactive help, or help(object) for help about object. public_functions = ['exit aka quit', 'print_up_to_n_Bernoulli_num aka print_up', 'exec_command aka ec', 'save_key_nums aka save'] |