




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、環(huán)工數(shù)學(xué)模式課程大綱Syllabus of Numerical Methods in Environmental Engineering· Lecturer: Prof. Chungsying Lu· Time: Thursday, 14:10 17:00· Location: Room 406· Grading:Exams: 45% Homework: 55%· Course Outlines:1. Review of Fortran 77 (Homework 1)2. Initial Value Problem (IVP)(Homework
2、 2)3. Boundary Value Problem (BVP)(Homework 3)4. Partial Differential Equation (PDE)(Homework 4)5. Mathematics application on environmental problemExamination: 14:10 17:00, 11/27/2008Class notes:NEWTON'S METHOD (NEWTON-RAPHSON)Consider a point x0 which is not a root of the function f(x), but is
3、”reasonably close” to a root. We expand f(x) in a Taylor series about x0 :(1)If f(x) is set equal to zero, then x must be a root and the right-hand side of (1) constitutes an equation for the root x. Unfortunately, the equation is a polynomial of degree infinity. However, an approximate value of the
4、 root x can be obtained by setting f(x) to zero and taking only the first two terms of the right-hand side of (1) to yield(2)Solving for x gives(3)or(4)Now x represents an improved estimate of the root, and can replace x0 in (3) to yield an even better estimate of the root on the next iteration. The
5、 general expression for Newton's method can thus be written as(5)where the superscript n denotes values obtained on the nth iteration and n+1 indicates values to be found on the (n+l)th iteration. This iterative procedure will converge to a root for most functions, and if it does converge; it wi
6、ll usually do so extremely rapidly. A flow chart of the algorithm is shown, in Fig. 3.Fig. 3 Newton's methodThe algorithm is terminated when the magnitude of the computed change in the value of the root, , is less than some predetermined quantity . This does not guarantee an accuracy of in the r
7、oot. Although more sophisticated convergence analyses are possible, a useful and conservative rule of thumb is to choose as one-tenth of the permissible error in the root. An additional point should be made concerning Fig. 3. and in fact all flow charts given in this chapter. No error exits have bee
8、n provided in case the method diverges or does not find a root in a reasonable number of iterations. A computer program written from this flow chart should include such exits as the programmer feels necessary, but it should be noted that these exits require logic which will increase the running time
9、 of the program. If enough is known about the character of the function, such exits may not be necessary.Despite its rapid convergence, Newton's method has some difficulties with certain types of functions. These difficulties can best be examined, and the most intelligent use made of this powerf
10、ul method, by considering the graphical interpretation of the algorithm. Figure 4 shows the first iteration for a typical function. The next guess for the root, x(1), is the intersection with the x axis of a straight line tangent to the function at x0. The value x(1) is much closer to the root than
11、the original guess x0, and it is clear that succeeding iterations will converge rapidly to the root.Fig 4.Consider next the simple oscillatory function shown in Fig. 5. The first guess, x0, is reasonably close to the root A. However, the tangent line strikes the axis at x(1), which is closer to the
12、root B. The next iteration yields x(2), and it becomes clear that the procedure will converge to the root B. This illustrates one of the possible difficulties of Newton's method ; an initial guess which is close to one root may result in convergence to a different more distant root. There is no
13、simple method for avoiding this type of behavior with certain functions. However, the rough plots or tabulations of the function discussed earlier will usually be sufficient to permit first guesses from which the method will eventually yield the desired roots. In any case, these plots will ensure th
14、at the programmer is aware of the presence of any roots which the method may have missed.Newton's method also has a tendency to home-in on a local minimum or maximum in a function (not a root) and then as the zero slope region is approached to be thrown far from any region of interest. The algor
15、ithm can also occasionally oscillate back and forth between two regions containing roots for a fairly large number of iterations before finding either root. These difficulties can be readily avoided with some prior knowledge of the behavior of the function.It should be noted that some difficulty wil
16、l be encountered in attempting to use Newton's method to find multiple roots. For smooth functions, these multiple roots correspond to points where the function becomes tangent to the x axis and then may or may not cross the axis. This behavior means that as f(x) approaches zero, so does f(x). W
17、hile Newton's method can be shown to be formally convergent for such roots, the rate of convergence is slow, and in practice can make the computation of multiple roots difficult and expensive. A modified Newton's method, which is very well suited to multiple roots, will be discussed in the n
18、ext section.PRINCIPLE OF ENVIRONMENTAL MATHEMATICSHomework 1Due: November 6, 2008Instructor: Dr. Chungsying Lu (Familiarity with the PC system, Review of FORTRAN)1) Work on the personal computer and become familiar with the Editing System. Learn how to create directories, manage files (save and dele
19、te), and print and type files. You do not need to submit anything for this problem.2) Write a FORTRAN subroutine to find one root of a general function f(x) using Newton's method. Assume that the method will converge to a root. Then, write a main program to drive the subroutine. The main program
20、 should contain all the READ and WRITE statements. Verify the general programs above by finding the positive root of the following equations:1. 2. 3. Fortran exsample1. 主程式(Main program)C*C* HOMEWORK #0 QUADRATIC EQUATION *C* STUDENT'S NAME: LU, CHUNG-SYING *C* THIS PROGRAM IS USED TO SOLVE A GE
21、NERAL QUADRATIC EQUATION AS FOLLOWING:*C* AX*2+BX+C=0 *C* THE PROGRAM LU1.FOR USES THE SUBROUTINE SOLVE.FOR TO FIND THE ROOTS *C* FOR A QUADRATIC EQUATION. THE VALUES FOR A, B, AND C ARE INPUTTED *C* FROM THE TERMINAL AND OUTPUT IS IN A FILE. THIS PROGRAM WAS WRITTEN *C* BY LU, CHUNG-SYING, APRIL, 2
22、0, 1987 *C*CC*C* MAIN PROFRAM *C* IMPLICIT REAL*8 (A-H,O-Z) CHARACTER *15 NAME CHARACTER *1 ANDSET WRITE(6,10) 10 FORMAT(1X,'ENTER OUTPUT FILE NAME ( MAX 15 CHARACTER )')!KEYIN FILE NAME READ(5,20) NAME 20 FORMAT(A15) OPEN(UNIT=9,FILE=NAME,STATUS='NEW')!MAKE A NEW FILE 25 WRITE(6,30)
23、 30 FORMAT(1X,'ENTER THE VALUES OF A,B,C FOR THE QUADRATIC EQUATION:' +,/,1X,'AX*2+BX+C=0',1X)!KEYIN VALUES READ(5,40) A,B,C 40 FORMAT(3F8.3)C*C* CALL SUBROUTINE ' SOLVE.FOR' TO SOLVE THE ROOTS *C* CALL SOLVE(A,B,C,X1,X2,DIS)C WRITE(6,50) A,B,C WRITE(9,50) A,B,C 50 FORMAT(1X,
24、'FOR THE QUADRATIC EQUATION:',F8.3,'X*2+',F8.3,'X+', +F8.3,'=0') WRITE(6,60) X1,X2!ROOT X1 & X2 WRITE(9,60) X1,X2 60 FORMAT(1X,'THE REAL ROOTS ARE:',F8.3,3X,'AND',F8.3) GO TO 85 70 WRITE(6,80) X1,X2,X1,X2 WRITE(9,80) X1,X2,X1,X2 80 FORMAT(1X,'T
25、HE COMPLEX ROOTS ARE:',/,5X,F8.3,' + ',F8.3,'I AND' +,F8.3,' - ',F8.3,'I') 85 WRITE(6,90) 90 FORMAT(1X,'DO YOU WANT TO SOLVE ANOTHER SER?(Y/N)') READ(5,100) ANDSET!ANSWER 100 FORMAT(1A) IF(ANDSET .EQ. 'Y') GO TO 25 STOP END2.副程式(Subroutine)C*C THE
26、SUBROUTINE SOLVE.FOR IS USED WITH THE MAIN PROGRAM LU1.FOR *C TO FIND THE ROOTS FOR A QUADRATIC EQUATION. THE SUBROUTINE *C WILL FIND BOTH REAL AND IMAGINARY ROOTS. THIS SUBROUTINE WAS *C WRITTEN BY LU, CHUNG-SYING, APRIL 20, 1987. *C* SUBROUTINE SOLVE(A,B,C,X1,X2,DIS) IMPLICIT REAL*8 (A-H,O-Z) DIS=B*2-4*A*C!EQUATION IF(DIS) 13,14,15! IF(DIS) <0, =0, >0 15 D=SQRT(DIS) X1=(-B+D)/(2*A) X2=(-B-D)/(2*A) GO TO 35 14 X1=-B/(2*A) X2=X1 GO TO 35 13 X1=-B/(2*A) X2=SQRT(-DIS)/(2*A) 35 RETURN END3. 解答(Solution)FOR THE QUADRATI
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- Unit 5 Old toys Part B Read and write 課件 2024-2025學(xué)年人教PEP版英語(yǔ)三年級(jí)下冊(cè)
- 《電機(jī)控制》課件-任務(wù)三 三相異步電動(dòng)機(jī)的運(yùn)行
- 音樂(lè)廣播稿(15篇)
- 店鋪分成管理方案(3篇)
- 2018-2022北京高中合格考生物匯編:基因突變及其他變異
- 冷庫(kù)租賃措施方案(3篇)
- 菜場(chǎng)設(shè)計(jì)定位方案(3篇)
- 茶樓露臺(tái)改造方案(3篇)
- 施工方案規(guī)范(3篇)
- 湖南國(guó)防工業(yè)職業(yè)技術(shù)學(xué)院《微生物與免疫學(xué)》2023-2024學(xué)年第二學(xué)期期末試卷
- 2025至2030中國(guó)成人用品行業(yè)產(chǎn)業(yè)運(yùn)行態(tài)勢(shì)及投資規(guī)劃深度研究報(bào)告
- 2025年重慶市九年級(jí)中考語(yǔ)文試題卷及答案解析
- 公安院校公安學(xué)科專業(yè)招生政治考察表
- 2024年內(nèi)蒙古錫林郭勒職業(yè)學(xué)院招聘真題
- 民航招飛駕駛測(cè)試題及答案
- 北京稅務(wù)籌劃課件
- 生物-七年級(jí)下冊(cè)期末復(fù)習(xí)知識(shí)點(diǎn)匯Z(冀少版2024)速記版 2024-2025學(xué)年七年級(jí)生物下學(xué)期
- 內(nèi)燃機(jī)技術(shù)協(xié)議書(shū)
- 數(shù)字智慧方案數(shù)字鄉(xiāng)村信息化建設(shè)及精細(xì)化治理平臺(tái)建設(shè)方案
- 2024年隴南市事業(yè)單位專業(yè)技術(shù)人才引進(jìn)筆試真題
- 2025屆浙江省精誠(chéng)聯(lián)盟高三下學(xué)期適應(yīng)性聯(lián)考生物試題
評(píng)論
0/150
提交評(píng)論