You are Here: Home

# Fortran programming urgent! Watch

1. I am trying to write a program on fortran using subroutines. The program needs to be able to integrate the function 3x^2-5x-4 from x=3 to x=8 using the trapezoidal rule.

So far I have wrote:

PROGRAM trap_rule

IMPLICIT NONE

REAL, EXTERNAL :: F

SUBROUTINEtraprule(a,b,n,f,area)

REAL,INTENT(IN)::a

REAL,INTENT(IN)::b

REAL,INTENT(OUT)::area

INTEGER,INTENT(INOUT):: n

EXTERNALf

any help is hugely appreciated! thank you
2. (Original post by Kaya_01)
I am trying to write a program on fortran using subroutines. The program needs to be able to integrate the function 3x^2-5x-4 from x=3 to x=8 using the trapezoidal rule.

So far I have wrote:

PROGRAM trap_rule

IMPLICIT NONE

REAL, EXTERNAL :: F

SUBROUTINEtraprule(a,b,n,f,area)

REAL,INTENT(IN)::a

REAL,INTENT(IN)::b

REAL,INTENT(OUT)::area

INTEGER,INTENT(INOUT):: n

EXTERNALf

any help is hugely appreciated! thank you

1) Specify the problem
2) Analyse the problem (draw a flow diagram)
3) Design an algorithm to solve the problem (NB this is not code the problem)
4) Code the solution
5) Test

Specify: Format of the I/O, i.e. numeric only? graph? device? Rounding to s.f., d.p.'s? etc. Range limits? Decide how you will test the finished program.

Analyse: Break it down into logical steps. i.e. understand and break down the quadratic equation and trapezoidal rule. You should start making a list of easy to use variable names. What other declarations will you need?

Design: Once you have the specification and analysis, then begin by structuring the MAIN part of the program in accordance with your flow diagram. Do this before tackling the algorithms

i.e. inputs and outputs, If, THEN, ELSE conditional branch statements etc.

Code: When you are happy with all of the above (and only when you are happy), then begin coding.

This may be teaching you to suck eggs, but getting into good practice from the start will pay dividends when it comes to debug and working errors.

TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: April 17, 2013
Today on TSR

### Does race play a role in Oxbridge admissions?

Or does it play no part?

### The worst opinion about food you'll ever hear

Discussions on TSR

• Latest
• ## See more of what you like on The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

• Poll
Useful resources

Can you help? Study Help unanswered threadsStudy Help rules and posting guidelines

## Groups associated with this forum:

View associated groups
Discussions on TSR

• Latest
• ## See more of what you like on The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

• The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.