Chaoic16

November 7th, 2007, 07:12 PM

I am new to this forum, and I have been having great interest into programming using computer language. I am currenlty learning Java and Fortran90 before moving on to C++. However, I have been having a problem with my own project, and I am wondering if one of you would help me with this.

I had been havintg some troubles doing DO loops and using array, especially SIN() functions. This is program I've written:

PROGRAM project_3_b

! delcaring REAL variable with dimensions

REAL::a(1:20),b(0:19),c(10:29),d(-9:10)

! the REAL, PARAMETER pi

REAL, PARAMETER::pi=3.1415926,pi_by_2=pi/20

! input the arrow 'a' values to be 1, .., 10 with implied do loop

statement (page 206-207)

arr=(/(a,a=1,10)/)

! then write loops which compute

! 1) the array 'b' to equal the array 'a times 0.5'

DO b=a,0.5

! 2) the array 'c' to equal the SIN() function of the array 'b times pi'

DO c=SIN(b,pi)

! 3) the array 'd' to equal LOG(SIN(b*pi ) ) only if the values of

sin(pi*a ) > 0 else 'd=0'

! HINT: for this you must use a DO loop with 'IF ELSE'

IF (SIN(pi*a)>0) THEN

DO d=LOG(SIN(b*pi))

ELSE

DO d=0

END DO

END DO

END DO

PROGRAM project_3_b

See where I still am struggling with DO loops and SIN() functions, so I am wondering if one of you would be more than to point to where I am doing wrong. Any advices from you will be truly appericated!

Chaoic out...

I had been havintg some troubles doing DO loops and using array, especially SIN() functions. This is program I've written:

PROGRAM project_3_b

! delcaring REAL variable with dimensions

REAL::a(1:20),b(0:19),c(10:29),d(-9:10)

! the REAL, PARAMETER pi

REAL, PARAMETER::pi=3.1415926,pi_by_2=pi/20

! input the arrow 'a' values to be 1, .., 10 with implied do loop

statement (page 206-207)

arr=(/(a,a=1,10)/)

! then write loops which compute

! 1) the array 'b' to equal the array 'a times 0.5'

DO b=a,0.5

! 2) the array 'c' to equal the SIN() function of the array 'b times pi'

DO c=SIN(b,pi)

! 3) the array 'd' to equal LOG(SIN(b*pi ) ) only if the values of

sin(pi*a ) > 0 else 'd=0'

! HINT: for this you must use a DO loop with 'IF ELSE'

IF (SIN(pi*a)>0) THEN

DO d=LOG(SIN(b*pi))

ELSE

DO d=0

END DO

END DO

END DO

PROGRAM project_3_b

See where I still am struggling with DO loops and SIN() functions, so I am wondering if one of you would be more than to point to where I am doing wrong. Any advices from you will be truly appericated!

Chaoic out...