help-octave
[Top][All Lists]

## Re: normalized ALF (Assotiated Legendre Function)

 From: Ben Abbott Subject: Re: normalized ALF (Assotiated Legendre Function) Date: Mon, 11 Feb 2008 06:50:42 -0500

```
On Feb 11, 2008, at 3:01 AM, kruvalig wrote:

```
```Thank's a lot for quick answer. I very suprised of it.

```
On Sun, 10 Feb 2008 01:37:10 +0300, Ben Abbott <address@hidden> wrote:
```
```
I've posted a patch and changelog to the maintainers list. Attached to
```this
email is the modified script.
http://www.nabble.com/file/p15391002/legendre.m legendre.m
```
```
```
Can any one test output of this file and output matlab file to high degree
```(>70).

result_mlab=legendre(80,[-1:0.1:1], "norm");
result_octave=legendre(80,[-1:0.1:1], "norm");
max(max(abs(result_mlab-result_octave)))
```
```
warning: legendre is unstable for higher orders
ans =  1.4343e+16

This is what I get.

```
Here ftp://77.108.213.161/result_octave_80 is a file, generated in octave
```by code:

result_octave=legendre(80,[-1:0.1:1], "norm");
save -v7 result_octave_80

I think this code
```
scale = (-1).^m .* sqrt ((n+0.5) .* factorial (n-m) ./ factorial (n +m));
```whill give bad answer in high order of legendre.
And we have to write: To what order it compute in right.
```
```
```
I'm not so sure a problem lies with the normalization. When I compare results for legendre(80, [-1:0.1:1]), I get
```
warning: legendre is unstable for higher orders
ans =  5.4154e+126

```
I haven't looked into the details as how this function works yet. I'll do that today.
```
```
In any event, can you (someone else?) propose a change? ... or a reference for how it should be done?
```
Ben

```