-1
で式に右括弧を期待::ブロックWindows上の16.0.1は、次のエラーがで&
を追加することでエラー:コードを使用してこのコードをコンパイルするには(1)
a(i) = (1/(delx)^2)-(1/x-1)
1
Error: Expected a right parenthesis in expression at (1)
b(i) = ((-2/((delx)^2)) - bi*ce)
1
Error: Expected a right parenthesis in expression at (1)
c(i) = (1/(delx)^2) + (1/(2*(delx)*(x-1)))
1
Error: Expected a right parenthesis in expression at (1)
を示しています3つのステートメントのそれぞれの終わり、後者の2つは問題ありませんが、最初のステートメントはそのまま残ります。
program HW0
implicit none
integer, parameter :: nx=101
integer, parameter :: ce = 100
real*8, parameter :: bi = 10.d0
real*8 :: delx
integer :: i
real*8, dimension(nx) :: t, x
real*8, dimension(nx) :: a, b, c, d
i = 1
delx = 1/(nx-1)
a(1) = 0; b(1) = 1; c(1) = 0; d(1) = 0
a(nx) = -(1/(delx))
b(delx) = (1/(delx)) + bi
c(nx) = 0; d(nx) = 0;
do i = 2, (nx - 1)
a(i) = (1/(delx)^2)-(1/x-1)
b(i) = ((-2/((delx)^2)) - bi*ce)
c(i) = (1/(delx)^2) + (1/(2*(delx)*(x-1)))
d(i) = 0
enddo
do i = 2, nx
b(i) = b(i) - c(i-1)*(a(i)/b(i-1)); d(i) = d(i) - d(i-1)*(a(i)/b(i-1))
enddo
t(nx) = d(nx)/b(nx)
do i = (nx-1), 1, -1
t(i) = (d(i) - c(i)*t(i+1))/b(i)
enddo
stop
end program HW0
"delx = 1 /(nx-1)"は0に評価されます(整数除算で1/100 - > 0なので)。 delx = 1.0d0 /(nx-1)(または1.0_dp/...など)として正しい値を得ることができます。 – roygvib
ああ、私の心を落とした。助けてくれてありがとう! –