import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy.stats import *
import seaborn as sns
import re
plt.rcParams["axes.grid"] = True
plt.rcParams["figure.figsize"] = (10,5)
# jakiś kod na jakieś MSNS, który nigdy mi się nie przydał :(
lam=2
R = lambda t: (1+lam*t)*np.exp(-lam*t)
t_=np.linspace(0,5,10**4)
plt.plot(t_,R(t_));
plt.title('Funkcja niez. elementu nieodn.');
plt.xlabel('Czas');
intens = lambda t: -(lam**2 * t) / (1+lam*t)
plt.plot(t_,intens(t_));
# c)
np.quantile(R(t_),0.95)
def f2(k):
suma = 0
const = np.pi / (2*k + 1)
for i in range(1,k+1):
suma += np.cos((2*i-1)*const)
return round(suma, 10)
print(f2(1))
print(f2(5))
print(f2(20))
print(f2(2000))
0.5
0.5
0.5
0.5
np.cos(np.pi/5) + np.cos(3*np.pi/5)
np.cos(np.pi/3)
x1 = np.linspace(0, 18, 10000)
f1 = lambda x: 14*np.sin(5*x) + x
plt.plot(x1,f1(x1));
round(1.5, 0)
round(2.5, 0)