Skip to content

Commit e6a7cee

Browse files
authored
Update installation_features.md
1 parent bcf4df6 commit e6a7cee

File tree

1 file changed

+66
-23
lines changed

1 file changed

+66
-23
lines changed

contrib/scipy/installation_features.md

+66-23
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
## Installation of Scipy
2-
### Install using the command:
3-
#### C:\Users\Your Name>pip install scipy
4-
You can also use a Python distribution that already has Scipy installed like Anaconda, or Spyder.
2+
3+
You can install scipy using the command:
4+
5+
```
6+
$ pip install scipy
7+
```
8+
9+
You can also use a Python distribution that already has Scipy installed like Anaconda, or Spyder.
10+
511
### Importing SciPy
6-
#### from scipy import constants
12+
13+
```python
14+
from scipy import constants
15+
```
16+
717
## Key Features of SciPy
818
### 1. Numerical Integration
9-
#### It helps in computing definite or indefinite integrals of functions
10-
```
19+
20+
It helps in computing definite or indefinite integrals of functions
21+
22+
```python
1123
from scipy import integrate
1224

1325
#Define the function to integrate
@@ -18,13 +30,18 @@ def f(x):
1830
result, error = integrate.quad(f, 0, 1)
1931
print(result)
2032
```
33+
2134
#### Output
35+
2236
```
2337
0.33333333333333337
2438
```
39+
2540
### 2. Optimization
26-
#### It can be used to minimize or maximize functions, here is an example of minimizing roots of an equation
27-
```
41+
42+
It can be used to minimize or maximize functions, here is an example of minimizing roots of an equation
43+
44+
```python
2845
from scipy.optimize import minimize
2946

3047
# Define an objective function to minimize
@@ -35,13 +52,18 @@ def objective(x):
3552
result = minimize(objective, x0=0)
3653
print(result.x)
3754
```
55+
3856
#### Output
57+
3958
```
4059
array([-1.30644012])
4160
```
61+
4262
### 3. Linear Algebra
43-
#### Solving Linear computations
44-
```
63+
64+
Solving Linear computations
65+
66+
```python
4567
from scipy import linalg
4668
import numpy as np
4769

@@ -55,13 +77,18 @@ b = np.array([5, 6])
5577
x = linalg.solve(A, b)
5678
print(x)
5779
```
80+
5881
#### Output
82+
5983
```
6084
array([-4. , 4.5])
6185
```
86+
6287
### 4. Statistics
63-
#### Performing statistics functions, like here we'll be distributing the data
64-
```
88+
89+
Performing statistics functions, like here we'll be distributing the data
90+
91+
```python
6592
from scipy import stats
6693
import numpy as np
6794

@@ -71,9 +98,12 @@ data = stats.norm.rvs(loc=0, scale=1, size=1000)
7198
# Fit a normal distribution to the data
7299
mean, std = stats.norm.fit(data)
73100
```
101+
74102
### 5. Signal Processing
75-
#### To process spectral signals, like EEG or MEG
76-
```
103+
104+
To process spectral signals, like EEG or MEG
105+
106+
```python
77107
from scipy import signal
78108
import numpy as np
79109

@@ -85,14 +115,21 @@ signal = np.sin(2 * np.pi * 5 * t) + 0.5 * np.random.randn(1000)
85115
b, a = signal.butter(4, 0.1, 'low')
86116
filtered_signal = signal.filtfilt(b, a, signal)
87117
```
118+
88119
The various filters applied that are applied here, are a part of signal analysis at a deeper level.
120+
89121
### 6. Sparse Matrix
90-
#### The word ' sparse 'means less, i.e., the data is mostly unused during some operation or analysis. So, to handle this data, a Sparse Matrix is created
91-
#### There are two types of Sparse Matrices:
92-
##### 1. CSC: Compressed Sparse Column, it is used for efficient math functions and for column slicing
93-
##### 2. CSR: Compressed Sparse Row, it is used for fast row slicing
122+
123+
The word ' sparse 'means less, i.e., the data is mostly unused during some operation or analysis. So, to handle this data, a Sparse Matrix is created
124+
125+
There are two types of Sparse Matrices:
126+
127+
1. CSC: Compressed Sparse Column, it is used for efficient math functions and for column slicing
128+
2. CSR: Compressed Sparse Row, it is used for fast row slicing
129+
94130
#### In CSC format
95-
```
131+
132+
```python
96133
from scipy import sparse
97134
import numpy as np
98135

@@ -104,17 +141,22 @@ values = np.array([1, 2, 1])
104141

105142
sparse_matrix_csc = sparse.csc_matrix((values, (row_indices, col_indices)))
106143
```
144+
107145
#### In CSR format
108-
```
146+
147+
```python
109148
from scipy import sparse
110149
import numpy as np
111150

112151
data = np.array([[0, 0], [0, 1], [2, 0]])
113152
sparse_matrix = sparse.csr_matrix(data)
114153
```
154+
115155
### 7. Image Processing
116-
#### It is used to process the images, like changing dimensions or properties. For example, when you're doing a project on medical imaging, this library is mainly used.
117-
```
156+
157+
It is used to process the images, like changing dimensions or properties. For example, when you're doing a project on medical imaging, this library is mainly used.
158+
159+
```python
118160
from scipy import ndimage
119161
import matplotlib.pyplot as plt
120162

@@ -127,4 +169,5 @@ blurred_image = ndimage.gaussian_filter(image, sigma=1)
127169
plt.imshow(blurred_image)
128170
plt.show()
129171
```
130-
#### The gaussian blur is one of the properties of the ' ndimage ' package in SciPy libraries, it used for better understanding of the image.
172+
173+
The gaussian blur is one of the properties of the ' ndimage ' package in SciPy libraries, it used for better understanding of the image.

0 commit comments

Comments
 (0)