-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrowth_math.py
More file actions
72 lines (49 loc) · 1.06 KB
/
growth_math.py
File metadata and controls
72 lines (49 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#python3
'''
This Program Calculates and Shows All the Sifferent Ways a Number Can Grow.
'''
# imports
import math, time
import matplotlib.pyplot as plt
import numpy as np
from time import sleep
# vars
num = 1
# funcs
def linearGrowth():
# func represents linear growth
# equation: y = m*x + n
m = 2
n = 0
for x in range(100):
y = (m*x) + n
print("Iteration Number: {0} --> {1}".format(x, y))
sleep(0.1)
def quadraticGrowth():
# func represents quadratic growth
for x in range(100):
y = x**2
print("Iteration Number: {0} --> {1}".format(x, y))
sleep(0.1)
def expGrowth():
# func represents exponential growth
global num
y = num = 1.05
temp = num
for i in range(100): # growing the number num
num = num ** i# exponentially increasing num
i += 1
#print("Iteration number: {0} --> {1}".format(i, num))
#sleep(0.1)
num = temp
def logGrowth():
base = 0.5
for x in range(1, 10):
y = math.log(x, base)
print("Iteration Number: {0} --> {1}".format(x, y))
sleep(0.1)
# main func
def main():
expGrowth()
# calling main-loop
main()