{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Tema5 - 5.13(a n= log(35.05 = 9.45 or 10 iterations log(2(b...

Info icon This preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
5.13 ( a ) iterations 10 or 45 . 9 ) 2 log( ) 05 . / 35 log( = = n ( b ) iteration x r 1 17.5 2 26.25 3 30.625 4 28.4375 5 27.34375 6 26.79688 7 26.52344 8 26.66016 9 26.72852 10 26.76270 for o s = 8 mg/L, T = 26.7627 o C for o s = 10 mg/L, T = 15.41504 o C for o s = 14mg/L, T = 1.538086 o C 5.14 Here is a VBA program to implement the Bisection function (Fig. 5.10) in a user-friendly program: Option Explicit Sub TestBisect() Dim imax As Integer, iter As Integer Dim x As Single, xl As Single, xu As Single Dim es As Single, ea As Single, xr As Single Dim root As Single Sheets("Sheet1").Select Range("b4").Select xl = ActiveCell.Value ActiveCell.Offset(1, 0).Select xu = ActiveCell.Value ActiveCell.Offset(1, 0).Select es = ActiveCell.Value ActiveCell.Offset(1, 0).Select imax = ActiveCell.Value Range("b4").Select If f(xl) * f(xu) < 0 Then root = Bisect(xl, xu, es, imax, xr, iter, ea) MsgBox "The root is: " & root MsgBox "Iterations:" & iter MsgBox "Estimated error: " & ea MsgBox "f(xr) = " & f(xr) Else MsgBox "No sign change between initial guesses" End If End Sub
Image of page 4
Function Bisect(xl, xu, es, imax, xr, iter, ea) Dim xrold As Single, test As Single iter = 0 Do xrold = xr xr = (xl + xu) / 2 iter = iter + 1 If xr <> 0 Then ea = Abs((xr - xrold) / xr) * 100 End If test = f(xl) * f(xr) If test < 0 Then xu = xr ElseIf test > 0 Then xl = xr Else ea = 0 End If If ea < es Or iter >= imax Then Exit Do Loop Bisect = xr End Function Function f(c) f = 9.8 * 68.1 / c * (1 - Exp(-(c / 68.1) * 10)) - 40 End Function For Example 5.3, the Excel worksheet used for input looks like: The program yields a root of 14.78027 after 12 iterations. The approximate error at this point
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern