Advertisement
Kribo

Halveringstid BM-4

Aug 3rd, 2020
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. #Fasit:
  2. import numpy as np
  3. import matplotlib.pyplot as plt
  4. #Funksjon som gir hvor mange prosent som er igjen av stoffet etter t tid.
  5. def p(t,h):
  6.     return  2*0.5**(t/h)
  7.  
  8. #Be om verdier for t og h.
  9. t = np.linspace(0, float(input("Hvor lang tid skal gĂĽ? ")), 1000)
  10. h = float(input("Hva er halveringstida? "))
  11.  
  12. #Lage graf.
  13. fig = plt.figure()
  14. ax1 = fig.add_subplot(111)
  15. ax1.grid(True)
  16.  
  17. x = t
  18. y = p(t,h)
  19.  
  20. ax1.plot(x,y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement