How are the initial X values chosen? Fortran

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

The discussion focuses on the selection of initial values for variables in Fortran programming, specifically addressing the issue of using 0.0D0 for all 14 variables, which resulted in no output. The tutor provided a specific set of values, including X(1) = 0.0D-01 and X(11) = 1.0D-04, which significantly influenced the program's results. The change in values, particularly for X(11), is critical as it affects the magnitude and sign of the parameters, leading to different outcomes in the program's execution.

PREREQUISITES
  • Understanding of Fortran programming syntax and conventions
  • Familiarity with floating-point representation in Fortran (e.g., D notation)
  • Basic knowledge of numerical methods and their impact on program results
  • Experience with debugging and modifying Fortran code
NEXT STEPS
  • Research the significance of initial conditions in numerical simulations
  • Learn about floating-point precision and representation in Fortran
  • Explore the effects of parameter tuning in numerical algorithms
  • Investigate best practices for setting initial values in Fortran programs
USEFUL FOR

This discussion is beneficial for Fortran programmers, numerical analysts, and anyone involved in developing or debugging numerical simulation software.

adishpatel
Messages
22
Reaction score
0
So, I had initially kept the values of X as 0.0D0 for all my 14 variables and it wouldn't populate any results. This was mainly done based on the guide that I was referring to.

On contacting my tutor, he placed the following values instead?

Code:
      X(1) = 0.0D-01
      X(2) = 0.0D-02
      X(3) = 0.0D-02
      X(4) = 0.0D0
      X(5) = -0.0D-03
      X(6) = 0.0D0
      X(7) = 0.0D0
      X(8) = 0.0D0
      X(9) = 0.0D0
      X(10) = 0.0D0
      X(11) = 1.0D-04
      X(12) = 0.0D0
      X(13) = 0.0D0
      X(14) = 0.0D0

I don't quite understand why he did this or what do we need to specify these values as something while we are trying to figure out those values in the program?

Also, I changed the powers further to see what happens, and the whole set of results just changed?

Full program can be viewed at: http://sysden.com/Trial.f
 
Technology news on Phys.org
Changing the zero values to a different representation, like 0.0D0 changed to 0.0D-01, has no effect. Your tutor may have done that to indicate what magnitude and sign (for X(5)) of non-zero value would be appropriate there. Setting a spring force parameter, X(11), to 1.0D-04 must have caused the change of the results. When you tried other powers, did you also change X(11)? That would explain the change of those results.
 
Last edited:

Similar threads

  • · Replies 22 ·
Replies
22
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K