Are 4 nested do loops suboptimal?

The beam isn’t simply supported, (I wish I could draw an image and post it here :sweat:). The beam is fixed on the left end, and has two displacement supports at 2m and 4m . The beam length is 6m, and distributed load of 8kN/m . I will look into the section modulus formula. Looping over the whole length does seem unnecessary, however I wanted to I guess obtain the deflection curve as well for knowledge purposes as I will need to do the same thing in another program.
Thanks for your help. I’ll see what I can do with the section modulus stuff. :slight_smile:

I read the thread however I am a little confused. Could you please provide a small example of how recursion works in Fortran ?

module m
implicit none
! recursive attribute below is optional in 
! Fortran 2018, but some compilers still require it
recursive function factorial(i) result(fac)
integer, intent(in) :: i
integer             :: fac
if (i < 2) then
   fac = 1
   fac = i*factorial(i-1)
end if
end function factorial
end module m
program main
use m
implicit none
integer :: i
print "(*(1x,i0))",(factorial(i),i=1,5)
end program main
! output:
! 1 2 6 24 120