# Jupyter notebook example

## Simple plots

Loading the necessary modules (maybe _numpy_ is superceeded by _scipy_)


```python
import numpy as npy
import scipy as scy
# import sympy as spy
# import timeit
```

The sine function, $\sin(t)$, and its Fourier-transformation.
$$f_{max}=\frac1{2\Delta t},\quad \Delta f=\frac1{t_{max}}$$


```python
# tmax, t = 200/4, scy.linspace(0,tmax,201)
t = [ i/4 for i in range(201) ]
y = [ npy.sin(t[i]/10*2*npy.pi) for i in range(201) ]
Y = scy.fft(y)
Y = abs(Y[:101])*2/200
f = scy.linspace(0,1/t[1]/2,101)
```

### Plotting the graphs


```python
%matplotlib inline
import matplotlib.pyplot as plt
```


```python
plt.figure(1,figsize=(10,4))
plt.subplot(121)
plt.plot(t,y,'g.')
plt.title('$\sin(t)$')
plt.xlabel('$t$[s]')
plt.grid('on')

plt.subplot(122)
plt.plot(f,Y,'b')
plt.title('FFT')
plt.xlabel(r'$\nu$[Hz]')
plt.grid('on')

plt.show()
```

```html

```

## Fázissík módszer
### Elsőrendű differenciálegyenletek
$$\begin{array}{rcl}
\dot x &=& (a^2x^2+y^2-1)y\\
\dot y &=& (x^2+a^2y^2-1)x
\end{array}
$$
### Nullvonalak és fázisportré


```python
# %matplotlib inline
from pylab import *
```


```python
a = 2
x, y = meshgrid(arange(-1.5, 1.5, 0.1), arange(-1.5, 1.5, 0.1))
fxy = -((a*x)**2+y**2-1)*y
gxy = (x**2+(a*y)**2-1)*x
streamplot(x, y, fxy, gxy)
# f(x,y)=0 görbék: ellipszis+egyenes
contour(x,y,fxy,1,colors="red")
# g(x,y)=0 görbék: ellipszis+egyenes
contour(x,y,gxy,1,colors="green")
grid(); show()
```

## Benchmarking


```python
import time
import timeit
```


```python
# benchmark from https://devblogs.nvidia.com/drop-in-acceleration-gnu-octave/
N = 8192
# def f(N):
A = scy.single(scy.rand(N,N))
B = scy.single(scy.rand(N,N))
#    return A * B
#tic = time.clock()
#print(tic)
#C = A * B
etime = timeit.timeit('A*B',globals=globals(),number=1)
#toc = time.clock()
#print(toc)
elapsedTime = etime #toc-tic
# elapsedTime = etime(clock(), start);
print("Elapsed time: {0:.2g} sec (".format(elapsedTime))
gFlops = 2*N*N*N/(elapsedTime * 1e+9)
# disp(gFlops);
print("{0:.2f} GFlops)\n".format(gFlops))
```

    Elapsed time: 0.64 sec (
    1713.92 GFlops)
    



```python

```

07c24d3ae27da03a61f5c9414a3344b13009e817
ipynb
Jupyter Notebook
python_ex1.ipynb
szazs89/jupyter_ex
366079f54a8ac8f3d6e65d45ec79d4b2318bed40
MIT
python_ex1.ipynb
szazs89/jupyter_ex
366079f54a8ac8f3d6e65d45ec79d4b2318bed40
MIT
python_ex1.ipynb
szazs89/jupyter_ex
366079f54a8ac8f3d6e65d45ec79d4b2318bed40
MIT
Qwen/Qwen-72B
1. YES
2. YES