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
Delivery-date
: Sat, 16 Sep 2017 16:54:47 +0200
Dkim-signature
: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=RvTXc34gliGoT4acLxPZuwZomHpU8biqUZ/7KSpNAlM=; b=KWK70oRgd/WjLWZ2L0GPlgFJOu72SZjCfZhi4KzhJEMSh0dHp8KLCZMgTBNqpDAGOG J8kjfEN5AuU3SeEgX2shmt6o1Yy/B9+GqlEpONqVWmH30UuoT5fF6yB6jIbIFbwe8Tss AQ3nx4jkGjN11xPZnHQ/oKuMauNhsHtUcOd3KMus9v2XsSX3XF7GGVslWCza/SJHcVmf qGuPkP8HK2gf91PJNSvUz4edgAenWFHUcWAg+jY2ER4RTz4cNemkE9bkAT/9NVJKPxyn qrbrKdbU6mclyRW4j0re6S/ncxGbA4lU79ctCeSw2v6vAngE32aF3KNZZ1ZDhvXdPh5X bdpw==
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