[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: normalized ALF (Assotiated Legendre Function)

From: Ben Abbott
Subject: Re: normalized ALF (Assotiated Legendre Function)
Date: Mon, 11 Feb 2008 20:55:31 -0500

On Feb 11, 2008, at 10:20 AM, Marco Caliari wrote:

Please, try the enclosed legendre.m. It is based on the recurrence relation found in I think it should be much more stable.

I compared Matlab's script and Octave's and your proposal.

  result_matlab = legendre (80, [-1:0.1:1]);

result_octave0 respects the original and result_octave1 respects your algorithm.

I calculated an error with respect to the matlab version (I'm not sure Matlab's is to be trusted as correct in all cases).

d0 = abs (result_matlab - result_octave0) / abs (result_matlab); d1 = abs (result_matlab - result_octave1) / abs (result_matlab); er1 = max (d1, [], 2); er0 = max (d0, [], 2);

[er0(:), er1(:)] produces the following

ans =

   2.3424e-119   2.0877e-144
   1.1666e-120   2.8601e-144
   3.1132e-119   1.3575e-140
   8.1518e-118   1.0167e-139
   2.1137e-116   8.8310e-137
   5.4094e-115   1.6560e-135
   1.3778e-113   5.7097e-133
   3.5365e-112   1.3705e-131
   9.1806e-111   3.3573e-129
   2.5238e-109   1.3295e-127
   8.9744e-108   1.8397e-125
   3.8727e-106   1.2779e-123
   1.9273e-104   9.8135e-122
   1.0123e-102   9.4790e-120
   5.4782e-101   4.6351e-118
    2.9220e-99   6.1185e-116
    1.5443e-97   1.6927e-114
    7.9263e-96   5.0573e-112
    3.9915e-94   4.8575e-111
    1.9686e-92   2.5731e-108
    9.4747e-91   1.0210e-106
    4.4378e-89   1.2955e-104
    2.0255e-87   9.2168e-103
    8.9000e-86   5.0162e-101
    3.7992e-84    7.4455e-99
    1.5630e-82    6.0867e-98
    6.3553e-81    4.0858e-95
    2.4881e-79    1.5141e-93
    9.3534e-78    1.6912e-91
    3.4021e-76    1.8648e-89
    1.2025e-74    5.4167e-88
    4.1090e-73    1.0303e-85
    1.3681e-71    4.2479e-84
    4.2235e-70    3.6317e-82
    1.2357e-68    4.2982e-80
    3.4224e-67    7.9412e-79
    9.0728e-66    2.0485e-76
    2.1559e-64    1.1802e-74
    4.2186e-63    5.7797e-73
    4.8458e-62    7.6818e-71
    1.0928e-61    4.0895e-69
    4.4609e-59    2.5363e-67
    3.6901e-57    2.3634e-65
    2.5598e-55    3.8612e-64
    8.8479e-54    8.5079e-62
    3.4999e-52    7.1329e-60
    1.0974e-50    1.5563e-58
    3.8537e-49    2.3469e-56
    8.7346e-48    2.4322e-54
    2.2104e-46    6.8924e-53
    7.5648e-45    4.6632e-51
    1.6279e-43    6.4798e-49
    3.0916e-42    2.7505e-47
    7.0616e-42    7.3142e-46
    8.1111e-40    7.6535e-44
    7.9301e-39    6.1412e-42
    5.7348e-37    3.2699e-40
    6.0936e-36    1.4796e-38
    4.3591e-34    9.0850e-37
    1.2343e-32    5.8704e-35
    3.4634e-31    3.9178e-33
    1.0903e-29    2.0041e-31
    8.0223e-29    9.2888e-30
    2.4566e-27    3.6487e-28
    4.2821e-26    1.7018e-26
    1.9256e-25    6.5910e-25
    8.1766e-25    2.4639e-23
    4.2551e-23    6.8962e-22
    1.1459e-22    1.7888e-20
    3.2583e-20    3.9508e-19
    1.8758e-18    6.5279e-18
    3.1305e-17    1.1644e-16
    9.8748e-16    1.9183e-15
    1.5795e-16    3.3544e-14
    2.9368e-13    4.7596e-13
    2.8870e-12    7.9144e-12
    5.9192e-11    9.2655e-11
    6.6729e-10    9.5730e-10
    4.7224e-09    7.8467e-09
    2.2427e-08    3.8634e-08
    5.3147e-08    1.0190e-07

I'm inclined to agree that the recursion form should work better. I'm suspicious that Matlab's version is reliable for such high order legendre polynomials.

Anyone, is there a reliable method to verify the correct answers?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]