Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
from fractions import Fraction
|
||||
|
||||
def muller_seq(n:int) -> float:
|
||||
seq = [Fraction(0), Fraction(2), Fraction(-4)]
|
||||
for i in range(3, n+1):
|
||||
next_value = (111 - 1130/seq[i-1]
|
||||
+ 3000/(seq[i-1]*seq[i-2]))
|
||||
seq.append(next_value)
|
||||
return float(seq[n])
|
||||
|
||||
for n in [3, 4, 5, 6, 7, 8, 20, 30, 50, 100]:
|
||||
print("{:4d} -> {}".format(n, muller_seq(n)))
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
from decimal import Decimal, getcontext
|
||||
|
||||
def bank(years:int) -> float:
|
||||
"""
|
||||
Warning: still will diverge and return incorrect results after 250 years
|
||||
the higher the precision, the more years will cover
|
||||
"""
|
||||
getcontext().prec = 500
|
||||
# standard math.e has not enough precision
|
||||
e = Decimal('2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934884167509244761460668082264800168477411853742345442437107539077744992069551702761838606261331384583000752044933826560297606737113200709328709127443747047230696977209310141692836819025515108657463772111252389784425056953696770785449969967946864454905987931636889230098793127736178215424999229576351')
|
||||
decimal_balance = e - 1
|
||||
for year in range(1, years+1):
|
||||
decimal_balance = decimal_balance * year - 1
|
||||
return(float(decimal_balance))
|
||||
|
||||
print("Bank balance after 25 years = ", bank(25))
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
for year in range(200, 256, 5):
|
||||
print(year, '->', bank(year))
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
from fractions import Fraction
|
||||
|
||||
def rump(generic_a, generic_b) -> float:
|
||||
a = Fraction('{}'.format(generic_a))
|
||||
b = Fraction('{}'.format(generic_b))
|
||||
fractional_result = Fraction('333.75') * b**6 \
|
||||
+ a**2 * ( 11 * a**2 * b**2 - b**6 - 121 * b**4 - 2 ) \
|
||||
+ Fraction('5.5') * b**8 + a / (2 * b)
|
||||
return(float(fractional_result))
|
||||
|
||||
print("rump(77617, 33096) = ", rump(77617.0, 33096.0))
|
||||
Loading…
Add table
Add a link
Reference in a new issue