source: issm/oecreview/Archive/19101-20495/ISSM-20188-20189.diff@ 20498

Last change on this file since 20498 was 20498, checked in by Mathieu Morlighem, 9 years ago

CHG: done with Archive/19101-20495

File size: 2.2 KB
RevLine 
[20498]1Index: ../trunk-jpl/src/m/psl/p_polynomial_prime.m
2===================================================================
3--- ../trunk-jpl/src/m/psl/p_polynomial_prime.m (revision 0)
4+++ ../trunk-jpl/src/m/psl/p_polynomial_prime.m (revision 20189)
5@@ -0,0 +1,85 @@
6+function vp = p_polynomial_prime ( m, n, x )
7+
8+%*****************************************************************************80
9+%
10+%% P_POLYNOMIAL_PRIME evaluates the derivative of Legendre polynomials P(n,x).
11+%
12+% Discussion:
13+%
14+% P(0,X) = 1
15+% P(1,X) = X
16+% P(N,X) = ( (2*N-1)*X*P(N-1,X)-(N-1)*P(N-2,X) ) / N
17+%
18+% P'(0,X) = 0
19+% P'(1,X) = 1
20+% P'(N,X) = ( (2*N-1)*(P(N-1,X)+X*P'(N-1,X)-(N-1)*P'(N-2,X) ) / N
21+%
22+% Licensing:
23+%
24+% This code is distributed under the GNU LGPL license.
25+%
26+% Modified:
27+%
28+% 13 March 2012
29+%
30+% Author:
31+%
32+% John Burkardt
33+%
34+% Reference:
35+%
36+% Milton Abramowitz, Irene Stegun,
37+% Handbook of Mathematical Functions,
38+% National Bureau of Standards, 1964,
39+% ISBN: 0-486-61272-4,
40+% LC: QA47.A34.
41+%
42+% Daniel Zwillinger, editor,
43+% CRC Standard Mathematical Tables and Formulae,
44+% 30th Edition,
45+% CRC Press, 1996.
46+%
47+% Parameters:
48+%
49+% Input, integer M, the number of evaluation points.
50+%
51+% Input, integer N, the highest order polynomial to evaluate.
52+% Note that polynomials 0 through N will be evaluated.
53+%
54+% Input, real X(M,1), the evaluation points.
55+%
56+% Output, real VP(M,N+1), the values of the derivatives of the
57+% Legendre polynomials of order 0 through N at the point X.
58+%
59+ if ( n < 0 )
60+ vp = [];
61+ return
62+ end
63+
64+ v = zeros ( m, n + 1 );
65+ vp = zeros ( m, n + 1 );
66+
67+ v(1:m,1) = 1.0;
68+ vp(1:m,1) = 0.0;
69+
70+ if ( n < 1 )
71+ return
72+ end
73+
74+ v(1:m,2) = x(1:m,1);
75+ vp(1:m,2) = 1.0;
76+
77+ for i = 2 : n
78+
79+ v(1:m,i+1) = ( ( 2 * i - 1 ) * x(1:m,1) .* v(1:m,i) ...
80+ - ( i - 1 ) * v(1:m,i-1) ) ...
81+ / ( i );
82+
83+ vp(1:m,i+1) = ( ( 2 * i - 1 ) * ( v(1:m,i) + x(1:m,1) .* vp(1:m,i) ) ...
84+ - ( i - 1 ) * vp(1:m,i-1) ) ...
85+ / ( i );
86+
87+ end
88+
89+ return
90+end
Note: See TracBrowser for help on using the repository browser.