## New programming languages

Moderators: None (Apply to moderate this forum)
Number of threads: 113
Number of posts: 331

This Forum Only

Help with fortran code please!Urgent!! Posted by Kelly22 on 8 Sept 2010 at 11:05 AM
Hello there!My name is Kelly and i am from Greece,i have to do some homework and the teacher asked us to program using fortran,but i have never learnt fortran!Can you help me write the fortran code please?I think i will need to have the two exercices ready till tomorrow..can i upload the exercices here?

Kelly
Re: Help with fortran code please!Urgent!! Posted by quikcarl on 8 Sept 2010 at 1:48 PM
Of course, you can and you should have when you
submitted your request. Not many people do FORTRAN
anymore, but I've had many years of experience. So
send those exercises on!
Re: Help with fortran code please!Urgent!! Posted by Kelly22 on 8 Sept 2010 at 11:29 PM
i solved my problem thx!
Re: Help with fortran code please!Urgent!! Posted by AsmGuru62 on 10 Sept 2010 at 4:37 AM
I love FORTRAN! I started my career with it in 1982 (I was still in university) - had lots of fun those days!
Re: Help with fortran code please!Urgent!! Posted by lapachacha on 24 Dec 2011 at 3:16 AM
hello...i have been given an assignment which needs to be done on fortran90....i have come up with my code but it isnt working for me..

there are four parrts each specifying the values of M1 and angle for which M2 is to be calculated using SECANTS method..

here is the codde with simplified comments

!here i have declared the arrays
!note that there are four parts of this question so i have declared two variables with four values each therefore combinining those parts

!the dimensions of Function f,values of initial gueses x1,x2 and x3 have been declared arbitarily since i do not know the number of iterations needed to come up with the final solution

real formula
real rad,x,m1,theeta

dimension m1(1:4),rad(1:4),theeta(1:4),x1(1:20),x2(1:20),x3(1:20)

data (m1(i),i=1,4)/1.0,1.0,1.5,1.5/

data (theeta(i),i=1,4)/10.0,20.0,10.0,20.0/

do i=1,4

rad(i)=theeta(i)*3.142/180
enddo

! here i have started the outer loop so that for each set of M1 and Rad the inner loop shouldd run and calculate the value of M2(taken as x3)
!for e.g for M1=1.0 and rad=10.0 this code should calculate the value for M2 but since i do not know how many iterations will be done i have assigned an arbitary value of 10 in the inner loop

do i=1,4

do j=1,20

x1(j)=2.0
x2(j)=1.5

!here i have set the tolerance
tol=.00001

!here is the function

! here are the two values of initial guesses(which will keep interchanging at each iteration..which i have set as 10 as a guess)

!here is secants formula

10 x3(j)=(x1(j)*formula(rad,x,m1)-x2*formula(rad, x, m1))/(formula(rad, x, m1)-formula(rad, x, m1))
print*,'m1',m1(i),'rad',rad(i),'x1',x1(j),'x2',x2(j),'x3',x3(j)
x1(j)=x2(j)
x2(j)=x3(j)
if (abs (x1(j)-x2(j)).lt.tol) goto 20
goto 10
20 print*,'The value of m2 for part(a) is',x3(j)

end do

end do

end

REAL FUNCTION formula(rad,x,m1)
REAL rad,x,m1

dimension m1(1:4),rad(1:4),theeta(1:4),x1(1:20),x2(1:20),x3(1:20)

F(rad,x,m1)=rad(i)-(6.**(1./2.))*(atan((((x(j))**2.)-1.)/6.)**(1./2.))-((atan((((m1(i))**2.)-1.)/6.)**(1./2.)))+(atan((((x(j))**2.)-1.)**(1./2.))-(atan((((m1(i))**2.)-1.)**(1./2.))))

RETURN
END

but i am getting this error.

: error FOR3601: symbol X is not a variable - cannot be statement function dummy argument

warning FOR4291: function FORMULA has not been assigned a value
warning FOR4265: symbol I referenced but not set

warning FOR4270: unused symbol X3

warning FOR4270: unused symbol X2

warning FOR4270: unused symbol X1

warning FOR4270: unused symbol THEETA
Error executing fl32.exe.
lapa.obj - 1 error(s), 6 warning(s)

please identify the areas and what needs to be corrected

please please see the attached question paper for reference..
Attachment: question.jpg (139016 Bytes | downloaded 120 times)

## Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.