Line | |
---|

1 | #! /usr/bin/python |
---|

2 | |
---|

3 | # To change this template, choose Tools | Templates |
---|

4 | # and open the template in the editor. |
---|

5 | |
---|

6 | __author__="steve" |
---|

7 | __date__ ="$15/06/2010 3:08:41 PM$" |
---|

8 | |
---|

9 | |
---|

10 | import numpy |
---|

11 | |
---|

12 | def interval_mesh(n, x_0=0.0, x_1=1.0): |
---|

13 | """Create points, and boundary for a uniform mesh with n sub-interval |
---|

14 | ranging from x_0 to x_1 |
---|

15 | """ |
---|

16 | |
---|

17 | assert n>0 |
---|

18 | |
---|

19 | |
---|

20 | points = x_0 + (x_1 - x_0)*numpy.arange(n+1,dtype=numpy.float) |
---|

21 | boundary = {(0, 0): 'left', (n-1, 1): 'right'} |
---|

22 | |
---|

23 | return points, boundary |
---|

**Note:** See

TracBrowser
for help on using the repository browser.