Hello. In the main program in this approximate block, ini is not overwritten, because of this, the om_ value is calculated, for example, equal to 0.4, and that's it. Next, the program leaves the original ini array. Tell me, please, what could be the error?

ini = reshape(ini_st, forma) fin = reshape(fin_st, forma) do 652 while (om_ > 0.01) do i = 1, 3 do k = 1, m vector (i,k) = fin(i,k)-ini(i,k) end do end do ................................................... om_ = sqrt(om(1)**2 + om(2)**2 + om(3)**2) !om зависят от ini do i = 1, 3 do j= 1, m ini(i,j) = cos(om_)*ini(i,j) end do end do 652 continue 

    2 answers 2

    @Danaida , at least in the code above, the om array does not change (although the commentary states that it depends on ini ), so the variable om_ remains constant throughout all iterations.

    Update

    @Danaida , apparently, the code (there is a lot of it, and you did not write it here), which should change om in accordance with the current state of ini , does not work properly.

    There is nothing more to assume.

    • The om array is from ini, it is simply not written here, because there are many steps. I suppose that if ini is rewritten, then automatically and om, and accordingly om_, will change. - Danaida
    • @avp: Wow, you're also a Fortran special! - VladD
    • four
      @VladD, all sewing machines are alike. :) - avp

    When I studied Fortran, and this was in the time of Suleiman ibn David (peace with both of them!), Then according to the standard, the first letters of variable names determined their type.
    Thus, variables beginning with i, j, k, l, m, n, o were considered integer-computed.
    Try replacing the om variable with am, or bm, in other words, the first letter should not be from the list above - then the Fortran interpreter will treat your variable as a real number, not an integer.
    Praise be to Allah and his loyal admirer Al-Khorezmi !

    • A good guess (admittedly, according to the author, om_ always equal to 0.4 ). - avp
    • The author did not say a word about the version of FORTRAN, nor about its environment of application, so I allowed myself the Shahrizada tale, forgive me in this noble collection. ;) - deivan_
    • @deivan, everything is correct (only o is overkill). - avp
    • Yes, about Oh, I went too far, thanks for the hint: chem.ox.ac.uk/fortran/variables.html - deivan_
    • Thank you all for your attention to the issue and help, I am writing in the 90th Fortran in the environment of Geany. Before the loop, I explicitly set the om_ value and it seems to be how it became to count. - Danaida