Commit b56783843dcc26cd9c4106c67616283243785478
- Diff rendering mode:
- inline
- side by side
examples/show_img.py
(33 / 0)
|   | |||
| 1 | #!/usr/bin/env python | ||
| 2 | #-*- mode: python -*- | ||
| 3 | |||
| 4 | import convention | ||
| 5 | |||
| 6 | from pylab import * | ||
| 7 | from mpmath import * | ||
| 8 | |||
| 9 | # program start | ||
| 10 | data = numpy.zeros((50,50)) | ||
| 11 | |||
| 12 | for i in range(0,50): | ||
| 13 | for j in range(0,50): | ||
| 14 | coefficient = pi/mpf(12.25) | ||
| 15 | data[i,j] = sin(i*coefficient) * sin(j*coefficient) | ||
| 16 | |||
| 17 | |||
| 18 | imshow(data) | ||
| 19 | colorbar() | ||
| 20 | savefig("show_img.png") | ||
| 21 | clf() | ||
| 22 | os.system("open show_img.png") | ||
| 23 | |||
| 24 | |||
| 25 | # plot grid.Plane | ||
| 26 | from fdtd import grid | ||
| 27 | plane = grid.Plane(data) | ||
| 28 | |||
| 29 | imshow(numpy.array(plane,dtype="float")) | ||
| 30 | colorbar() | ||
| 31 | savefig("plane.png") | ||
| 32 | clf() | ||
| 33 | os.system("open plane.png") |
examples/sympy_simple.py
(10 / 0)
|   | |||
| 1 | #!/usr/bin/env python | ||
| 2 | #-*- mode: python -*- | ||
| 3 | |||
| 4 | from sympy import * | ||
| 5 | |||
| 6 | x = Symbol("x") | ||
| 7 | p = Poly((1+x**2)**4, x) | ||
| 8 | q = p.diff() | ||
| 9 | print p(1) | ||
| 10 | print q(1) |
show_img.py
(0 / 33)
|   | |||
| 1 | #!/usr/bin/env python | ||
| 2 | #-*- mode: python -*- | ||
| 3 | |||
| 4 | import convention | ||
| 5 | |||
| 6 | from pylab import * | ||
| 7 | from mpmath import * | ||
| 8 | |||
| 9 | # program start | ||
| 10 | data = numpy.zeros((50,50)) | ||
| 11 | |||
| 12 | for i in range(0,50): | ||
| 13 | for j in range(0,50): | ||
| 14 | coefficient = pi/mpf(12.25) | ||
| 15 | data[i,j] = sin(i*coefficient) * sin(j*coefficient) | ||
| 16 | |||
| 17 | |||
| 18 | imshow(data) | ||
| 19 | colorbar() | ||
| 20 | savefig("show_img.png") | ||
| 21 | clf() | ||
| 22 | os.system("open show_img.png") | ||
| 23 | |||
| 24 | |||
| 25 | # plot grid.Plane | ||
| 26 | from fdtd import grid | ||
| 27 | plane = grid.Plane(data) | ||
| 28 | |||
| 29 | imshow(numpy.array(plane,dtype="float")) | ||
| 30 | colorbar() | ||
| 31 | savefig("plane.png") | ||
| 32 | clf() | ||
| 33 | os.system("open plane.png") |
sympy_simple.py
(0 / 10)
|   | |||
| 1 | #!/usr/bin/env python | ||
| 2 | #-*- mode: python -*- | ||
| 3 | |||
| 4 | from sympy import * | ||
| 5 | |||
| 6 | x = Symbol("x") | ||
| 7 | p = Poly((1+x**2)**4, x) | ||
| 8 | q = p.diff() | ||
| 9 | print p(1) | ||
| 10 | print q(1) |

