Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

do loop

keremusu1
Beginner
590 Views

Hello!

I would like to create a loop as follows:

The only variable in my loop is the time t, which goes from 0 to 120 by an increment of 1 (t=0,120,1). With this variable, I would like to calculate:

r2=(q8*t)-(g*t*log(t))+(q9*t)-(q10/(exp(t/T2)))

All other variables (q8,g,q9,q10,T2) are known.

What should my code be like?

0 Kudos
4 Replies
Steven_L_Intel1
Employee
590 Views
log(0) is going to give you a problem...
0 Kudos
keremusu1
Beginner
590 Views

It can also be (t=1,120,1)

0 Kudos
Les_Neilson
Valued Contributor II
590 Views

integer :: t

do t=1,121
r2 = (q8*t) - (g*t*log(t)) + (q9*t) - (q10/(exp(t/t2)))
enddo

Les

0 Kudos
Les_Neilson
Valued Contributor II
590 Views

Oops sorry

do t=1,120

0 Kudos
Reply