program bisectionimplicit nonecharacter::choicereal::lower, upperwrite(*,*)"************************************"write(*,*)"* F. f(x) = x^3 - 3*x +1 *"write(*,*)"* G. f(x) = x^2 - 1 *"write(*,*)"* H. f(x) = x^3 *"write(*,*)"* I. f(x) = x + 1 *"write(*,*)"* J. f(x) = x^2 + 2x *"write(*,*)"* K. f(x) = x^3 + 3x^2 + 3x + 3 *"write(*,*)"* x. Main Menu *"write(*,*)"************************************"write(*,*)"Make a selection from the menu."read(*,*)Choicewrite(*,*)"Enter the lower bound"read(*,*)lowerwrite(*,*)"Enter the upper bound"read(*,*)upperwrite(*,*)"IterationCase(f,F)REAL FUNCTION f(x)IMPLICIT NONEREAL,INTENT(IN):: xf = x^3-3*x+1call rootEND FUNCTIONCase(g,G)REAL FUNCTION f(x)IMPLICIT NONEREAL,INTENT(IN):: xf = x**2-1call rootEND FUNCTIONcase(h,H)REAL FUNCTION f(x)IMPLICIT NONEREAL,INTENT(IN):: xf = x**3call rootEND FUNCTIONCase(i,I)REAL FUNCTION f(x)IMPLICIT NONEREAL,INTENT(IN):: xf = x + 1call rootEND FUNCTIONcase(j,J)REAL FUNCTION f(x)IMPLICIT NONEREAL,INTENT(IN):: xf = x**2 + 2*x + 2call rootEND FUNCTIONCase(k,K)REAL FUNCTION f(x)IMPLICIT NONEREAL,INTENT(IN):: xf = x**3 + 3*x**2 + 3*x + 3call rootEND FUNCTIONcase(x,X)stopend program bisectionRECURSIVE SUBROUTINE root(f,answer)IMPLICIT NONEreal, INTENT(in)::freal, INTENT(out)::answerreal::lower,upper
11/10/2005 2:36:33 PM
It would help a lot if you told us what the program is supposed to do. I know documentation is a bitch, but it makes things a lot easier for those of us that aren't familiar with what the program does.
11/10/2005 3:13:41 PM
this is what the program is suppose to doProgram Definition: ! Write a FORTRAN program that finds the root of a function between ! two bounds defined by the user using the method of recursive ! bisection. ! ! You can only use Bisection if you assume that there is only 1 ! root between the upper and lower bounds. Given a function that ! crosses the x axis only once between the upper and lower bounds, ! the root can be found by bisecting the interval between the ! bounds and testing the bisection point for which side of the x ! axis f(x) lies on. If the value at the lower bound f(lb) is ! of the same sign as f(x), then the new lower bound would be x. ! Likewise, if the value of the upper bound f(ub) is of the same ! sign as f(x), then the new upper bound would be x. ! ! This process can be accomplished through a DO loop and through ! recursion. To understand the problem better, you may want to code ! the problem using a DO loop first and then code it using ! recursion. Let the root be located at the point where ! abs(f(x)) <0.5E-6 ! ! Enable the program to find the roots for the 6 equations below ! using a menu. ! ! ******************************************* ! * F. f(x) = x^3 - 3*x + 1 * ! * G. f(x) = x^2 - 1 * ! * H. f(x) = x^3 * ! * I. f(x) = x + 1 * ! * J. f(x) = x^2 + 2x * ! * K. f(x) = x^3 + 3x^2 + 3x + 3 * ! * * ! * X. Main Menu * ! *******************************************
11/10/2005 3:57:29 PM
what exactly do you need help with. I don't think anyone here is going to write the code for you. If you have a specific question then I'll try to help.
11/10/2005 5:45:14 PM
write(*,*)"Iterationneed a close quote?
11/10/2005 5:51:15 PM
ahahathis guy is likeHERE'S MY HOMEWORKSOMEBODY FINISH IT FOR ME
11/10/2005 7:13:42 PM