|
@ -1,15 +1,15 @@ |
|
|
import math |
|
|
import math |
|
|
from src.main.py.logarithmic_and_expo_and_root_calculations import potentiate |
|
|
from src.main.py.logarithmic_and_expo_and_root_calculations import potentiate |
|
|
|
|
|
|
|
|
|
|
|
from src.main.py.primitive_calculations import * |
|
|
def pi_approx_leibniz(precision): |
|
|
def pi_approx_leibniz(precision): |
|
|
if precision < 0: |
|
|
if precision < 0: |
|
|
return -1 |
|
|
return -1 |
|
|
result = 0 |
|
|
result = 0 |
|
|
for i in range(precision): |
|
|
for i in range(precision): |
|
|
num = potentiate(-1, i) |
|
|
num = potentiate(-1, i) |
|
|
denom = 2*i + 1 |
|
|
|
|
|
result += num/denom |
|
|
|
|
|
return result * 4 |
|
|
|
|
|
|
|
|
denom = add(1, multiply(2,i)) |
|
|
|
|
|
result = add(result, divide(num, denom)) |
|
|
|
|
|
return multiply(result, 4) |
|
|
|
|
|
|
|
|
def rad2deg(radNumber): |
|
|
def rad2deg(radNumber): |
|
|
return (radNumber * 180) / math.pi |
|
|
return (radNumber * 180) / math.pi |