X-Git-Url: http://gitweb.michael.orlitzky.com/?p=octave.git;a=blobdiff_plain;f=legendre_p_tilde.m;h=3bb30be664003fcab28ca19259d7b8f4821f045b;hp=0b3a87ba698dc41c560cc0b38c52b4549a8348e8;hb=36afdc59f58ac6a8a1fe366e1cde070db24905ac;hpb=79707c807c6f44eb95ec0eeeaa28f7e98bf8c319 diff --git a/legendre_p_tilde.m b/legendre_p_tilde.m index 0b3a87b..3bb30be 100644 --- a/legendre_p_tilde.m +++ b/legendre_p_tilde.m @@ -1,23 +1,24 @@ function P_tilde = legendre_p_tilde(n, a, b) - ## Return the nth Legendre polynomial scaled to the interval [a,b]. - ## - ## INPUTS: - ## - ## * ``n`` - The index of the polynomial that we want. - ## - ## * ``a`` - The left endpoint of the interval. - ## - ## * ``b`` - The right endpoint of the interval. - ## - ## OUTPUTS: - ## - ## * ``P_tilde`` - A polynomial function of one argument. - ## + % Return the `n`th Legendre polynomial scaled to the interval [a,b]. + % + % INPUT: + % + % * ``n`` - The index of the polynomial that we want. + % + % * ``a`` - The left endpoint of the interval. + % + % * ``b`` - The right endpoint of the interval. + % + % OUTPUT: + % + % * ``P_tilde`` - A polynomial function of one argument. + % if (n < 0) - ## Can't do anything here. Return nothing. + % Can't do anything here. Return nothing. P = NA; else - ## Compute the Legendre polynomial over [-1,1] and mangle it. + % Compute the Legendre polynomial over [-1,1] and mangle it to fit + % the interval [a,b]. P = legendre_p(n); P_tilde = @(x) P( (2/(b-a)).*x + 1 - (2*b)/(b-a) ); end