PK*WLaL$math_131_numerics/__init__.py'''Package including standard numerical methods taught in numerics class at UC Merced. Ths includes includes bisection method, fixed-point, Newton's, Secant, Lagrange interpolant, Numerical differentiation, Trapezoid rule, Simpsons's rule, Euler's, Taylor's, Runge-Kutta and Adams methods''' __version__='0.0.2' def bisection_method(f, a, b, tol, N): ''' Solve root-finding problem using bisection method paragraph with more detail Hypothesis ``f(a) * f(b) < 0`` Parameters ========== f : function continuous function a : real number lower bound for search interval b : real number upper bound for search interval tol : real number tolerance error N : integer maximum number of iterations Returns ======= tuple (x, err, k) where x is the root, err the absolute error, k the number of iterations return (None, None, k+1) if not enough iterations for expected tolerence error ''' err = (b-a)/2 k = 0 while err >= tol and k <= N: x = (b+a)/2 if f(x) == 0: print('done !') return x, err, k if f(a) * f(x) < 0: b = x if f(x) * f(b) < 0: a = x err = (b-a)/2 if err < tol or f(x) == 0: print('Convergence in', k, 'steps') return x, err, k k = k+1 if k == N+1: print('No convergence, need more iterations') return None, None, k PK)TLQ3.;;)math_131_numerics-0.0.2.dist-info/LICENSEThe MIT License (MIT) Copyright (c) 2018 Camille Carvalho Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!Hp!Qa'math_131_numerics-0.0.2.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,zd&Y)r$[)T&UD"PK!HP;Y*math_131_numerics-0.0.2.dist-info/METADATAen0~}8n>R*Q#Kl?5j43Ξ2*|PL&xkޱ ptg_E# ٱ8Go (GH¨E *A2\@ZL 0égQ3UDGu2VbA3R竑S%9m^x 94V\Л"+K oPE< ;NS WR7߽/6PK!H$7(math_131_numerics-0.0.2.dist-info/RECORD=z0ݳ$H@(iIPjCX\:ylRkESsd|`L&W/WsJX JW$oS~ iv9ȷijW,ɒ" orK68 -WR]{B0;'^yث>]fեU.´.'tl>؏1a QB螜)-$aq2ctJ{b&PK*WLaL$math_131_numerics/__init__.pyPK)TLQ3.;;)/math_131_numerics-0.0.2.dist-info/LICENSEPK!Hp!Qa' math_131_numerics-0.0.2.dist-info/WHEELPK!HP;Y*G math_131_numerics-0.0.2.dist-info/METADATAPK!H$7(w math_131_numerics-0.0.2.dist-info/RECORDPK