INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Fortran coding issues

## Fortran coding issues

(OP)


Hi,

In the following piece of code, I want to vary lambda and Gamma but in such a way that the product of lambda and gamma remains 2, ie Lambda*gamma=2

I am unsure how to do this,

The program also reads in an initial value of gamma and lambda from an input file which I can specify.

do ll = 1, 7
! gam=1.0e-3*facg
gam = 1/1024.*2.0**(ll - 1)
do mm = 1, 7
! lambda=1.0e+3*facl
lambda = 64*2.0**(mm - 1)

### RE: Fortran coding issues

Well...you cannot have 2 do-loops and one nested inside the other...this way, you will be generated all 7 values of the inner variable (lambda) for every 1 value of the outer one (gam).

You said it yourself, lambda*gamma=2...that's one equation, two unknowns...as soon as 1 variables is defined, the other one is determinable...given gamma =.125 ==> lambda = 2.0/gamma = 8.0

### RE: Fortran coding issues

(OP)

So how should I change the code to vary them both automatically but keep the product 2?

### RE: Fortran coding issues

Get rid of the inner loop, just use the outer one where you define gamma, then, simply define lambda as showed above: lambda = 2.0/gamma

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!