Skip to content

Commit 04a5959

Browse files
committed
Atualizar tutorial scipy e indice
1 parent c38264f commit 04a5959

File tree

5 files changed

+171
-196
lines changed

5 files changed

+171
-196
lines changed

tutorial/_toc.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ parts:
1111
chapters:
1212
- file: notebooks/01-Tutorial_NumPy.md
1313
- file: notebooks/02-Tutorial_Matplotlib.md
14-
- file: notebooks/03-Exemplo_Masked_Arrays.md
14+
- file: notebooks/03-Tutorial_SciPy.md
1515
- file: notebooks/04-Exemplo_SVD.md
1616
- file: notebooks/05-Exemplo_Queimadas.md
17-
- file: notebooks/06-Tutorial_SciPy.md
18-
- file: notebooks/07-Exemplo_Regressao.md
17+
- file: notebooks/0x-Exemplo_Masked_Arrays.md

tutorial/notebooks/00-Tutorial_Python_Sul_2024.md

+20-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
---
22
jupytext:
33
formats: md:myst
4-
text_representation:
5-
extension: .md
6-
format_name: myst
74
kernelspec:
85
display_name: Python 3 (ipykernel)
96
language: python
107
name: python3
8+
text_representation:
9+
extension: .md
10+
format_name: myst
11+
format_version: 0.13
12+
jupytext_version: 1.16.4
13+
kernelspec:
14+
display_name: Python 3 (ipykernel)
15+
language: python
16+
name: python3
1117
---
1218

1319
# O Ecossistema Científico no Python
@@ -29,20 +35,20 @@ import matplotlib as mpl
2935
- Conceitos básicos e quando usar essas bibliotecas
3036
- Onde buscar ajuda
3137

32-
```{code-cell}
38+
```{code-cell} ipython3
3339
from IPython.display import Image
3440
Image(url="https://i.imgur.com/MBQqSmT.jpg", width=600)
3541
```
3642

3743
### Computação Científica
3844

39-
```{code-cell}
45+
```{code-cell} ipython3
4046
Image("imagens/comp_cientifica.png", width=600)
4147
```
4248

4349
Na prática...
4450

45-
```{code-cell}
51+
```{code-cell} ipython3
4652
Image("imagens/comp_cientifica_2.png", width=600)
4753
```
4854

@@ -52,7 +58,7 @@ Image("imagens/comp_cientifica_2.png", width=600)
5258

5359
### O que é o ecossistema científico do Python? Quem mora nele?
5460

55-
```{code-cell}
61+
```{code-cell} ipython3
5662
Image(url="https://media.springernature.com/full/springer-static/image/art%3A10.1038%2Fs41586-020-2649-2/MediaObjects/41586_2020_2649_Fig2_HTML.png", width=600)
5763
```
5864

@@ -98,12 +104,12 @@ Image(url="https://media.springernature.com/full/springer-static/image/art%3A10.
98104

99105
- [Parte 1. NumPy](01-Tutorial_NumPy.md)
100106
- [Parte 2. Matplotlib](02-Tutorial_Matplotlib.md)
101-
- Parte 3. Exemplos práticos
102-
- [Arrays com máscara (masked arrays)](03-Exemplo_Masked_Arrays.md)
107+
- [Parte 3. SciPy](03-Tutorial_SciPy.md)
108+
- Parte 4. Exemplos práticos
103109
- [Aproximação de imagens usando a SVD](04-Exemplo_SVD.md)
104110
- [Queimadas](05-Exemplo_Queimadas.md)
105-
- [Parte 4. SciPy](06-Tutorial_SciPy.md)
106-
- [Regressão](07-Exemplo_Regressao.md)
111+
- Exemplos extra
112+
- [Arrays com máscara (masked arrays)](0x-Exemplo_Masked_Arrays.md)
107113

108114
---
109115

@@ -132,3 +138,6 @@ Algumas referências interessantes e caminhos para mais informações além da d
132138

133139
`@melissawm`
134140

141+
```{code-cell} ipython3
142+
143+
```

tutorial/notebooks/03-Tutorial_SciPy.md

+29
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,35 @@ plt.ylabel('y(t)')
9999
plt.show()
100100
```
101101

102+
### Exemplo: Regressão usando 3 métodos
103+
104+
```{code-cell} ipython3
105+
import numpy as np
106+
from scipy.interpolate import interp1d
107+
import matplotlib.pyplot as plt
108+
109+
# Criação de dados
110+
x = np.arange(10)
111+
y = x + 5*np.random.rand(10) - 6*np.random.rand(10)
112+
113+
# Regressão Linear
114+
(a_linear, b_linear) = np.polyfit(x, y, 1)
115+
# Ajuste quadrático
116+
(a_quad, b_quad, c_quad) = np.polyfit(x, y, 2)
117+
# Interpolação
118+
f = interp1d(x, y)
119+
120+
# Gráfico
121+
t = np.linspace(0, 9, 50)
122+
plt.title('Exemplo: ajuste de curvas')
123+
plt.plot(x, y, 'r*')
124+
plt.plot(t, a_linear*t+b_linear,'g')
125+
plt.plot(t, a_quad*t**2+b_quad*t+c_quad, 'm')
126+
plt.plot(t, f(t), 'b')
127+
plt.legend(['linear', 'quadrático', 'interpolação'])
128+
plt.show();
129+
```
130+
102131
### Exemplo: Teste de hipótese estatística
103132

104133
+++

0 commit comments

Comments
 (0)