Solving Problem in Fortran Program - Bevington Polyfit.f

  • Context: Fortran 
  • Thread starter Thread starter akila
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary
SUMMARY

The forum discussion centers on troubleshooting a Fortran program utilizing the Bevington polyfit.f routine to fit a second-order polynomial to a dataset. The user, Akila, reports discrepancies between expected and actual coefficients when fitting the model. Key issues identified include the absence of an IMPLICIT NONE statement and potential misconfiguration of input variables, particularly the MODE variable in the subroutine. Participants emphasize the importance of reviewing library documentation and ensuring proper variable definitions to resolve the fitting errors.

PREREQUISITES
  • Understanding of Fortran programming language
  • Familiarity with polynomial fitting techniques
  • Knowledge of the Bevington polyfit.f library
  • Experience with compiler options and variable declarations in Fortran
NEXT STEPS
  • Review the documentation for Bevington's polyfit.f to clarify variable usage
  • Implement the IMPLICIT NONE statement in the Fortran program
  • Examine the input data for compatibility with the polynomial fitting routine
  • Learn about array declarations and their implications in Fortran
USEFUL FOR

This discussion is beneficial for Fortran developers, data analysts working with polynomial regression, and anyone troubleshooting numerical fitting routines in scientific computing.

akila
Messages
1
Reaction score
0
hi all,

greetings,
i have a fortran prg to fit 2nd order polynomial to my data
taken from (bevington--- polfit.f)

i'm making some mistake, and i could not find what is the problem with this.
When i give some other other random data it is fitting properly
but not the data i have :(
for y = a + bx + cx^2 i should get the coefficients to be

a = 1.4558380406304288E+03
b = -3.6779173737460803E+02
c = 2.3247378080674739E+01

but I am getting as
a = -16.2156696
b = -1.78127503
c = 0.496948689


can somebody please please help me to find out the problem

here i have attached the prg

thank you,
regards,
akila
 

Attachments

Technology news on Phys.org
Firstly, you can enclose code directly into the forum by using the CODE tags.

OK, what compiler options have you used? I notice that you don't include an IMPLICIT NONE statement. wt is not defined as an array, how does the implicit declaration work for arrays?

If you got polfit from some sort of library, then your inputs are probably wrong. Also, go back to that library's documentation and make sure you know what all those variables are. For example, the variable MODE in the subroutine isn't crystal clear to me.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 17 ·
Replies
17
Views
5K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 22 ·
Replies
22
Views
5K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 20 ·
Replies
20
Views
6K
  • · Replies 4 ·
Replies
4
Views
1K