From 522c735cefc8ee67b6d7f58caf469264cb4b0784 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Tue, 19 Apr 2022 15:40:03 +0200 Subject: [PATCH] Refactor --- .../{main.py => approx_method.py} | 0 mas/newton-raphsons/{sak.py => user_method.py} | 17 ----------------- 2 files changed, 17 deletions(-) rename mas/newton-raphsons/{main.py => approx_method.py} (100%) rename mas/newton-raphsons/{sak.py => user_method.py} (69%) diff --git a/mas/newton-raphsons/main.py b/mas/newton-raphsons/approx_method.py similarity index 100% rename from mas/newton-raphsons/main.py rename to mas/newton-raphsons/approx_method.py diff --git a/mas/newton-raphsons/sak.py b/mas/newton-raphsons/user_method.py similarity index 69% rename from mas/newton-raphsons/sak.py rename to mas/newton-raphsons/user_method.py index 39ef904..1242322 100755 --- a/mas/newton-raphsons/sak.py +++ b/mas/newton-raphsons/user_method.py @@ -1,5 +1,4 @@ #!/usr/bin/python -import operator def new_rap(x, func: str="0", der: str="0", iter=0): y_exper = func.replace("x", str(x)) @@ -12,22 +11,6 @@ def new_rap(x, func: str="0", der: str="0", iter=0): new_x = x - (y / der) return new_x -# def new_rap(x, func=nullfunc, dx=0.1): -# new_x = None -# try: -# while x != new_x: -# y = func(x) -# der = derive(x, func, dx) -# new_x = x - y/der -# if new_x == x: -# return new_x -# else: -# x = new_x -# return x -# except ZeroDivisionError as error: -# print(f"{y=} {der=} {new_x=}") -# print(error) - def eval_func( func: str, x: float ): y_exper = func.replace("x", str(x)) return eval(y_exper)