> On 4 Feb 2018, at 17:55, c. <

[hidden email]> wrote:

>

> This code snippet for example:

>

>>> pkg load bim

>>> x = [linspace(0, .5, 100), linspace(.5, 1, 200)(2:end)].';

>>> A = bim1a_laplacian (x, 1, 1);

>>> b = bim1a_rhs (x, 1, 1);

>>> u = zeros (size (x));

>>> u(2:end-1) = A(2:end-1, 2:end-1) \ b(2:end-1);

>>> plot (x, u, 'x-')

>

> solves

>

> - u''(x) = 1 in 0 < x < 1

> u(0) = u(1) = 0

>

> on a piece-wise uniform mesh.

And, to try a more complex non-uniform mesh spacing, you could test this:

>> y = x .^ 3;

>> A = bim1a_laplacian (y, 1, 1);

>> b = bim1a_rhs (y, 1, 1);

>> u = zeros (size (y));

>> u(2:end-1) = A(2:end-1, 2:end-1) \ b(2:end-1);

>> plot (y, u, 'x-')

c.

-----------------------------------------

Join us March 12-15 at CERN near Geneva

Switzerland for OctConf 2018. More info:

https://wiki.octave.org/OctConf_2018-----------------------------------------