使用Fortran编写用于定点迭代的程序 [英] Write a program for a fixed point iteration using Fortran
问题描述
P = g(Po)
g( x)= x- sin (pi.x),pi与22/7相同。
Po = 0 。 95
TOL = 10 ** - 6
NO = 20
TOL if (Pi-Po)< = 10 ** - 6
步骤
1 跨度>。设置i = 1
2 。 while i< No,执行步 3 - 6
3 。设置P = g(Po)
4 。测试如果 | P-Po | < TOL
输出(P); (过程成功完成)
STOP
5 跨度>。设置i = i + 1
6 。设置P = Po
7 输出(没有迭代后方法失败)
NO,NO; (过程已成功完成)
停止
SIMPLY FORTRAN是我能够下载的FORTRAN软件。请问我该怎么办?
为上述问题编写算法。谢谢
我尝试了什么:
我试过了使用视频教程但似乎没有任何工作。 SIMPLY FORTRAN是我能够下载的软件的名称,尝试下载FORTRAN 90或77,但没有。如果您有这样的软件并愿意与我分享。我很高兴。
好吧,我后来和其他网站的人交谈过,他们建议我停止使用Fortran并尝试使用QB64,观看视频它看,我成了胜利者。这是使用QBasic的解决方案。享受吧!
CLS
i = 1:po = 0.95:tol = 10 ^ -6:no = 20:CONST pi = 4 * ATN1
PRINT ,,; 课程代码分配
打印,; 通过候选名称
打印i,po,p,ABS(p-po)
2如果i< no THEN
p = po - SIN(pi * po)
PRINT i,
PRINT po,
PRINT p,
PRINT ABS(p - po)
IF ABS(p-po)<那么
PRINT(p); 程序成功完成
END IF
i = i + 1:po = p
GOTO 2
ELSE
PRINT方法在20次迭代后失败*
END IF
Hello everyone, I am a complete novice to programming. I am facing a big trouble writing a programming for a fixed point iteration given
P= g(Po)
g(x) = x-sin (pi.x), pi as in 22/7.
Po = 0.95
TOL = 10**-6
NO = 20
TOL if (Pi-Po)<=10**-6
Steps
1. Set i=1
2. While i <No, do step 3-6
3. Set P=g(Po)
4. Test if |P-Po| < TOL
OUTPUT (P); (Procedure completed successfully )
STOP
5. Set i = i+1
6. Set P = Po
7 output (method failed after no iteration)
"NO", NO; (Procedure completed Successfully)
STOP
SIMPLY FORTRAN is the FORTRAN software I was able to download. Please how can I
Write the algorithm for the above problem. Thank you
What I have tried:
I've tried using Video tutorials but nothing seems to be working. SIMPLY FORTRAN is the name of the software I was able to download, tried downloading FORTRAN 90, or 77 but nothing. Please If you have such software and willing to share with me. Please I'd be very glad.
Well, i later talked to guys from another site and they recommended i stop using simply Fortran and try QB64, watched videos on it and behold, i became a victor. Here is the solution Using QBasic. ENJOY!
CLS i = 1: po = 0.95: tol = 10 ^ -6: no = 20: CONST pi = 4 * ATN1 PRINT , , " "; "COURSE CODE ASSIGNMENT" PRINT , " "; "By CANDIDATE NAME" PRINT "i", "po", "p", "ABS(p-po)" 2 IF i < no THEN p = po - SIN(pi * po) PRINT i, PRINT po, PRINT p, PRINT ABS(p - po) IF ABS(p - po) < tol THEN PRINT (p); "Procedure completed successfully" END IF i = i + 1: po = p GOTO 2 ELSE PRINT "method failed after 20 iterations*" END IF
这篇关于使用Fortran编写用于定点迭代的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!