Elim Qiu on Sat, 16 Sep 2017 16:54:47 +0200
[
Date Prev
] [
Date Next
] [
Thread Prev
] [
Thread Next
] [
Date Index
] [
Thread Index
]
how to define a function with loop
To
:
pari-users@pari.math.u-bordeaux.fr
Subject
: how to define a function with loop
From
: Elim Qiu <
elim.qiu@gmail.com
>
Date
: Sat, 16 Sep 2017 08:54:37 -0600
I'd like to define a function returns the decimal approximation of
(1^n+2^n+...+n^n)/(n^n)
In python i have
def tm(n,k):
return exp(n*log((k+0.0)/n))
def sm(n,m):
s = 0.0
for j in range(m):
k = n -j
s += tm(n,k)
return s
How do I put a loop inside of a definition of pari function?
Thanks
Follow-Ups
:
Re: how to define a function with loop
From:
Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
Re: how to define a function with loop
From:
Elim Qiu <elim.qiu@gmail.com>
Prev by Date:
Re: eulerphi(0)
Next by Date:
Re: how to define a function with loop
Previous by thread:
Re: eulerphi(0)
Next by thread:
Re: how to define a function with loop
Index(es):
Date
Thread