From d20257bf80ccfc7b050eb9ce59ca83603f74a664 Mon Sep 17 00:00:00 2001 From: Trygve Date: Mon, 18 Sep 2023 21:41:41 +0200 Subject: [PATCH] =?UTF-8?q?F=C3=B8rste=20=C3=B8ving?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 1.py diff --git a/1.py b/1.py new file mode 100644 index 0000000..bca0702 --- /dev/null +++ b/1.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +"""Created on Mon Sep 18 09:00:00 2023""" +__author__ = "Trygve B. Nomeland" +__email__ = "trygve.borte.nomeland@nmbu.no" + +from math import exp, isclose + +def N(t, B=50000, C=9, k=0.2): + return B/(1+C*(exp(-k*t))) + +def main(): + print(f'b) Populasjon eter 24 timer, N(24): {N(24)}') + for t in range(500): + if isclose((N(t)), 50000*0.9, rel_tol=0.01): + print(f'c) N er omtrent 90% av B når t er {t}') + +if __name__ == "__main__": + main() + +""" +a) C = 9 +b) Populasjon eter 24 timer, N(24): 46552,00 +c) N er omtrent 90% av B når t er 22 +""" \ No newline at end of file