Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran 90 - gfortran error - help!

  1. Mar 10, 2014 #1
    Hi, I have written a fortran 90 program that finds the definite integral of a function using the trapezium method.

    Everything is fine, other than when I compile my program it produces the following error:

    assignment_2_final.f90:127.2:

    ITRAP = (z/2)((G(a) + G(b)) + z*area)
    1
    Error: Unclassifiable statement at (1)


    My code looks like this...

    PROGRAM assignment_2
    IMPLICIT NONE

    REAL(kind = 8) :: x, h, Error_F, Error_C, Error_D2, a, b, z, area, ITRAP
    INTEGER :: i, N

    area = 0.0

    ...

    z = b - a

    DO i=1,N-1
    area = area + G(a+i*z)
    END DO

    ITRAP = (z/2)((G(a) + G(b)) + z*area)

    WRITE(6,*)
    WRITE(6,*)'The definite integral of g(x) using'
    WRITE(6,*)'the trapezium rule = ',ITRAP
    WRITE(6,*)

    The user is asked to enter values for a, b and N.

    I have changed the code and still cannot come up with the solution to my error, any help would be greatly appreciated :smile:
     
  2. jcsd
  3. Mar 10, 2014 #2

    DrClaude

    User Avatar

    Staff: Mentor

    That should be
    Code (Text):

    ITRAP = (z/2)*((G(a) + G(b)) + z*area)
     
    (Please use
    Code (Text):
     tags when posting code.)
     
  4. Mar 10, 2014 #3
    this made me feel very stupid! sometimes the answer is right in front of your face. Thanks a lot! Will do for next time.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Fortran 90 - gfortran error - help!
  1. Fortran 90 (Replies: 1)

  2. Fortran 90 (Replies: 1)

Loading...