Using Microsoft Visual Basic for Applications in Excel, create a computer progra
ID: 3531561 • Letter: U
Question
Using Microsoft Visual Basic for Applications in Excel, create a computer program that calculates the zero(s) of the equation f(x)=e^(x)-10x=0 by using the inverse linear interpolation (regula falsi) method.
Additional Information if needed:
For each zero, choose your initial guess to be on either side so one initial guess is a positive f(x) and the other is a negative f(x). Stop the program when a successive iteration (cycle through the loop) changes the estimate of the zero by less than 0.0001% (1 part in a million). Report your initial guesses and the number of iterations it takes to find the zero.
Explanation / Answer
Public Function Acklam(p, Ifault) Dim p_low, p_high, q, r, x As Double Dim a1, a2, a3, a4, a5, a6 As Variant Dim b1, b2, b3, b4, b5 As Variant Dim c1, c2, c3, c4, c5, c6 As Variant Dim d1, d2, d3, d4 As Variant a1 = CDec(-39.6968302866538) + CDec(0.00000000000004) a2 = CDec(220.946098424521) - CDec(0.0000000000005) a3 = CDec(-275.928510446969) + CDec(0.0000000000003) a4 = CDec(138.357751867269) a5 = CDec(-30.6647980661472) + CDec(0.00000000000004) a6 = CDec(2.50662827745924) - CDec(0.000000000000001) b1 = CDec(-54.4760987982241) + CDec(0.00000000000004) b2 = CDec(161.585836858041) - CDec(0.0000000000001) b3 = CDec(-155.698979859887) + CDec(0.0000000000004) b4 = CDec(66.8013118877197) + CDec(0.00000000000002) b5 = CDec(-13.2806815528857) - CDec(0.00000000000002) c1 = CDec(-7.78489400243029E-03) - CDec(3E-18) c2 = CDec(-0.322396458041136) - CDec(5E-16) c3 = CDec(-2.40075827716184) + CDec(0.000000000000002) c4 = CDec(-2.54973253934373) - CDec(0.000000000000004) c5 = CDec(4.37466414146497) - CDec(0.000000000000002) c6 = CDec(2.93816398269878) + CDec(0.000000000000003) d1 = CDec(7.78469570904146E-03) + CDec(2E-18) d2 = CDec(0.32246712907004) - CDec(2E-16) d3 = CDec(2.445134137143) - CDec(0.000000000000004) d4 = CDec(3.75440866190742) - CDec(0.000000000000004) ' Define break points p_low = 0.02425 p_high = 1 - p_low Ifault = 0 If p = 1 Then Ifault = 1 Exit Function End If ' Rational approximation for lower region If 0Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.