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?
submitted your request. Not many people do FORTRAN
anymore, but I've had many years of experience. So
send those exercises on!
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
! 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
!here i have set the tolerance
!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))
if (abs (x1(j)-x2(j)).lt.tol) goto 20
20 print*,'The value of m2 for part(a) is',x3(j)
REAL FUNCTION formula(rad,x,m1)
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..