Ohh yes by the way ... It's Fortran 90!!

Solved

Posted on 2004-11-07

Hello! Don't see a Fortran Language topic so I'm posting here! Soo

I'm Having a lil' problem here ... Trying to write a good Interpolation module using Neville's algorithm and it just seems like I can't get a good interpolation for the function 1/sin(x).

Anyone have any ideas how to make an alternative subroutine or maybe what's wrong with mine? I'm posting here mine.

I know that interpolation 1/sin(x) is tricky beacuse the function has breaks around 0, pi, and 2 pi, but nevertheles

the numbers I'm getting have no sense

I'm trying to interpolate with 10th order polinomial and trying to interpolate 30 equidistant points in interval (0, 2*pi)

and all I'm getting out are really wierd numbers ... am I doing something wrong?

Please Help ...

======================================

SUBROUTINE Neville(A, B, xm, xt, res, err)

REAL, dimension(:), intent( in ) :: A, B

REAL, intent( in ) :: xt

REAL, intent( out ) :: res, err

INTEGER, intent ( in ) :: xm

REAL, dimension(xm) :: P

INTEGER j,k

P(:) = B(:)

DO j=1, xm

DO k=1, xm - j

P(k)=((xt - A(k+j)) * P(k) + (A(k)-xt) * P(k+1))/(A(k)-A(k+j))

END DO

END DO

res=P(1)

err=P(1)-P(2)

return

END SUBROUTINE Neville

I'm Having a lil' problem here ... Trying to write a good Interpolation module using Neville's algorithm and it just seems like I can't get a good interpolation for the function 1/sin(x).

Anyone have any ideas how to make an alternative subroutine or maybe what's wrong with mine? I'm posting here mine.

I know that interpolation 1/sin(x) is tricky beacuse the function has breaks around 0, pi, and 2 pi, but nevertheles

the numbers I'm getting have no sense

I'm trying to interpolate with 10th order polinomial and trying to interpolate 30 equidistant points in interval (0, 2*pi)

and all I'm getting out are really wierd numbers ... am I doing something wrong?

Please Help ...

==========================

SUBROUTINE Neville(A, B, xm, xt, res, err)

REAL, dimension(:), intent( in ) :: A, B

REAL, intent( in ) :: xt

REAL, intent( out ) :: res, err

INTEGER, intent ( in ) :: xm

REAL, dimension(xm) :: P

INTEGER j,k

P(:) = B(:)

DO j=1, xm

DO k=1, xm - j

P(k)=((xt - A(k+j)) * P(k) + (A(k)-xt) * P(k+1))/(A(k)-A(k+j))

END DO

END DO

res=P(1)

err=P(1)-P(2)

return

END SUBROUTINE Neville

7 Comments

http://www.cs.uaf.edu/~bue

If that's not the issue (I've only glanced at the coding), then let us know

moorhouselondon:

Unlike C or C++, Fortran starts it's counters(indexes) for Arrays with number 1 not 0. for example Array[1] is actually the first member of the array, not the second like in C or C++ .. like I said

Title | # Comments | Views | Activity |
---|---|---|---|

Reading variable length EBCDIC in SAS | 9 | 58 | |

What is the compatible hibernate version for spring 4.3.1 | 10 | 50 | |

Python 2.7 - French characters | 6 | 32 | |

Looking for example pivot year code used in Y2K | 4 | 17 |

The purpose of this article is to demonstrate how we can use conditional statements using Python.

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**18** Experts available now in Live!