And for 2:
And you may have a similar problem when referencing I=Last Index
Unless your arrays have pre-initialized padds (before and after the initialized data) your first and last iteration will be incorporating JUNK into the expression (rather than perhaps an assumed 0.0)
And for 3:
Is PI one of your variables? Are you assuming it is an intrinsic variable of 3.14159....?
I suggest a debug run with runtime checks for array index out of bounds and un-initialized variable tests.
Jim Dempsey