How are the initial X values chosen? Fortran

In summary, the conversation discusses changing the values of X in a program to see the effect on the results. Contacting the tutor led to the values being changed to a different representation, and changing the spring force parameter caused a change in the results.
  • #1
adishpatel
22
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
  • #2
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:

Related to How are the initial X values chosen? Fortran

1. How are the initial X values chosen in Fortran?

The initial X values in Fortran are typically chosen by the programmer or user based on the specific needs and requirements of the program. They can be manually inputted by the user or generated through a set of predefined equations or algorithms.

2. Are there any guidelines for choosing initial X values in Fortran?

There are no specific guidelines for choosing initial X values in Fortran as it depends on the individual program and its objectives. However, it is generally recommended to choose values that are within the desired range and have a reasonable magnitude to avoid potential errors or instability in the program.

3. Can I change the initial X values during the program execution in Fortran?

Yes, it is possible to change the initial X values during the program execution in Fortran. This can be done by using statements or functions that allow for the modification of variables or arrays, or by prompting user input during runtime.

4. How do I know if my chosen initial X values are appropriate in Fortran?

The appropriateness of chosen initial X values in Fortran can be evaluated by running the program and observing the output or results. If the results are within the desired range and meet the objectives of the program, then the initial X values can be considered appropriate.

5. Are there any built-in functions or libraries in Fortran for generating initial X values?

Yes, there are built-in functions and libraries in Fortran that can be used for generating initial X values. For example, the RANDOM_NUMBER function can be used to generate random initial values within a specified range. Additionally, there are also libraries such as LAPACK and BLAS that contain subroutines for generating initial values in certain mathematical operations.

Similar threads

  • Programming and Computer Science
Replies
22
Views
4K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
8
Views
3K
  • Programming and Computer Science
Replies
16
Views
2K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
1
Views
3K
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
1
Views
2K
Back
Top