Sei sulla pagina 1di 1

Secant Derivative method: Incremental Search: looks for interval where function changes sign.

Divide search range (xmin, xmax) into smaller subintervals. Then evaluate at all intervals, looking for a sign change in between some of the subintervals, if there is, then there is at least one root in that interval. If spacing is too big we miss roots, cant find roots where it just touches. Bisection: abs error is reduced by factor of 2 each iteration. False Position: Determines next guess by connecting end points with a straight line and the intercept will be the next point. (Slower than F.P.) Eulers method: have a DE, and points, use DE and point to create equation of the tangent line, and getting new point from: xn = xn-1 +h, yn=yn-1+hf(xn1,yn-1). Open Methods: Could diverge, but converge faster Fixed-Point Iteration: rearrange f(x)=0, to get x=g(x), approximate error Convergence requires derivative of g(x) near the root to have a magnitude <1. Linear convergence if it diverges, try a different x Newton-Raphson: form tangent line to f(x) at some x, follow line to where it crosses x-axis. Quadratic convergence. Anonymous and inline function: one line functions created without the use of an m-file. fhandle = @(arg1, arg2, ) expression (can use workspace vars). fhandle = inline(expression, arg1, arg2,) cant use workspace vars. Machine epsilon of matlab: 2 = 2.204x10 2-n To have n digits of error: S = 0.5 x 10 Accuracy: How close the value agrees with the true value Precision: How closely values agree with each other Truncation error: Exact math formulas are represented by approximations. Approximate derivative as finite difference equations, or taylor series. Increases as step size increases. Roundoff error: cant represent some quantities exactly; doing lots of computations, adding large and small numbers, smearing: individual terms in summation are larger than total summation. Decreases as step size increases. Total numerical error: summation of truncation/roundoff. a always smaller than t Taylor Series: Using these taylor series, can approximate derivatives in 3 different ways: Forward: Backward: Centered (The best): Matlab Knows Best Format in digits: short = 5, long = 15(double) 7(single) linspace(x1,x2,n) returns row vector of n elements from x1 to x2. Logspace spaces them logarithmically. Fzero: uses bracketing/open methods, (bisection, secant, inverse quadratic interpolation), depending on how many initial guesses are inputted. x = fzero(FUN, x0) Roots: calculates all (even complex) roots of a polynomial. x = roots(c) Function Syntax by lines: 1. Function outvar = funcname(arglist) 2. %help comments 3. statements 4. outvar = value. Logical Operators have precedence: Not, And, Or. IEEEEEEEEE Binary Conversion thing: -Convert the entire number to binary, leaving the decimal place where it is. -Shift the decimal point to the left until there only is one 1 to the left of it, remember how many times you moved it. -Double: 1023+moves = exponent, convert to binary though. Single: 127 + moves = exponent, convert to binary though -The left over stuff is the mantissa, rest of numbers, pad with 0s at the end so you have Double: 52, Single: 23 digits. st -Now put it all together: 1 digit: the sign, 1 if negative 2-11/8 for the exponent Double/single Last 52/23 digits: the other stuff that is padded together next term in series, error cant be bigger than that h = xi+1 - xi
-52 -14

Potrebbero piacerti anche