Skip to content
Snippets Groups Projects
Commit 42f0a856 authored by Großhauser's avatar Großhauser
Browse files

scaling_behavior

parent 278761f9
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id: tags:
``` python
import scipy.stats as stats
import numpy as np
import matplotlib.pyplot as plt
```
%% Cell type:code id: tags:
``` python
def scale_x(x,f):
return [f*i for i in x ]
x = np.linspace(0,10,1000)
y1 = stats.gamma.pdf(x, a=2, scale=1)
y2 = stats.gamma.pdf(scale_x(x,0.1), a=2, scale=0.1)
y3 = stats.gamma.pdf(scale_x(x,10), a=2, scale=10)
y4 = stats.gamma.pdf(scale_x(x,100), a=2, scale=100)
y5 = stats.gamma.pdf(scale_x(x,1000), a=2, scale=1000)
```
%% Cell type:code id: tags:
``` python
plt.plot(x,y1,c="b",label="orig")
plt.plot(x,y2*0.1,c="r",label="0.1")
plt.plot(x,y3*10,c="g",label="10")
plt.plot(x,y4*100,label="100")
plt.plot(x,y5*1000,label="1000")
plt.ylim((0,1))
plt.xlim((0,10))
plt.legend()
plt.show()
```
%% Output
%% Cell type:code id: tags:
``` python
stats.gamma.mean(2,1000)
```
%% Output
1002.0
%% Cell type:code id: tags:
``` python
s1 = sum(stats.gamma(a=1, scale=1).rvs() for _ in range(1000))
s2 = sum(stats.gamma(a=1, scale=10).rvs() for _ in range(1000))
s3 = sum(stats.gamma(a=1, scale=100).rvs() for _ in range(1000))
print(s1,s2,s3)
```
%% Output
1004.4725473220625 10130.722996043432 103046.80840506486
%% Cell type:code id: tags:
``` python
stats.gamma(a=1, scale=0.1).rvs()
```
%% Output
0.03030884290065232
%% Cell type:code id: tags:
``` python
min(stats.gamma(a=1, scale=10).rvs() for _ in range(1000))
```
%% Output
0.009425970781589568
%% Cell type:code id: tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment