diff --git a/Otter/Otter.py b/Otter/Otter.py index acbb30f..c2ec3b7 100755 --- a/Otter/Otter.py +++ b/Otter/Otter.py @@ -26,11 +26,10 @@ class Algebra: def __init__(self, function): self.f = function - def riemann(self,interval): + def riemann(self,a,b,n=None): - a = interval[0] - b = interval[1] - n = interval[2] + if n is None: + n = 10**6 delta = (b-a)/n @@ -46,15 +45,14 @@ class Algebra: return integral - def simpson(self, interval): + def simpson(self,a,b,n=None): + + if n is None: + n = 10**6 def x(i): return a + i*h - a = interval[0] - b = interval[1] - n = interval[2] - h = (b-a)/n eta = 0 @@ -81,15 +79,13 @@ class Algebra: def __init__(self,function): self.f = function - def riemann(self,x_interval,y_interval): + def riemann(self,a,b,c,d,n=None,m=None): + + if n is None: + n = 10**4 - a = x_interval[0] - b = x_interval[1] - n = x_interval[2] - - c = y_interval[0] - d = y_interval[1] - m = y_interval[2] + if m is None: + m = n dx = (b-a)/n dy = (d-c)/m @@ -109,15 +105,13 @@ class Algebra: return theta*(dx)*(dy) - def simpson(self,x_interval,y_interval): + def simpson(self,a,b,c,d,n=None,m=None): + + if n is None: + n = 10**4 - a = x_interval[0] - b = x_interval[1] - n = x_interval[2] - - c = y_interval[0] - d = y_interval[1] - m = y_interval[2] + if m is None: + m = n dx = (b-a)/n dy = (d-c)/m @@ -178,12 +172,10 @@ class Algebra: if function is not None: self.f = function - def bissec(self, interval): - """ invertal = [a,b,e] ; with 'a' being the first value of the interval, 'b' the last value of the interval and 'e' the precision of the procedure. """ - - a = interval[0] - b = interval[1] - e = interval[2] + def bissec(self,a,b,e=None): + + if e is None: + e = 10**(-6) fa = self.f(a) @@ -208,10 +200,10 @@ class Algebra: def d(self, x, e): return (self.f(x + e) - self.f(x - e))/(2*e) - def newton(self, interval): + def newton(self,a,e=None): - a = interval[0] - e = interval[1] + if e is None: + e = 10**(-6) fa = self.f(a) da = self.d(a,e) @@ -227,11 +219,10 @@ class Algebra: return a - def bissec_newton(self, interval): + def bissec_newton(self,a,b,e=None): - a = interval[0] - b = interval[1] - e = interval[2] + if e is None: + e = 10**(-6) fa = self.f(a) @@ -271,12 +262,10 @@ class Algebra: def __init__(self, function): self.f = function - def euler(self, interval): + def euler(self,a,y,b,n=None): - a = interval[0] - b = interval[1] - y = interval[2] - n = int(interval[3]) + if n is None: + n = 10**7 dx = (b-a)/n @@ -289,12 +278,10 @@ class Algebra: return y - def runge(self, interval): + def runge(self,a,y,b,n=None): - a = interval[0] - b = interval[1] - y = interval[2] - n = int(interval[3]) + if n is None: + n = 10**7 dx = (b-a)/n @@ -315,6 +302,59 @@ class Interpolation: self.data = data self.polinomial = self.Polinomial(self.data) + def minimus(self,x): + + theta = 0 + # somatorio de x + for i in range(self.data.shape[0]): + + theta += self.data[i][0] + + eta = 0 + #somatorio de y + for i in range(self.data.shape[0]): + + eta += self.data[i][1] + + sigma = 0 + #somatorio de xy + for i in range(self.data.shape[0]): + + sigma += self.data[i][0]*self.data[i][1] + + omega = 0 + #somatorio de x^2 + for i in range(self.data.shape[0]): + + omega += self.data[i][0]**2 + + + self.a = (self.data.shape[0]*sigma - theta*eta)/(self.data.shape[0]*omega - (theta**2)) + + self.b = (theta*sigma - eta*omega)/((theta**2) - self.data.shape[0]*omega) + + ym = 0 + + for i in range(self.data.shape[0]): + + ym += self.data[i][1]/self.data.shape[0] + + sqreq = 0 + + for i in range(self.data.shape[0]): + + sqreq += ((self.a*self.data[i][0] + self.b) - ym)**2 + + sqtot = 0 + + for i in range(self.data.shape[0]): + + sqtot += (self.data[i][1] - ym)**2 + + self.r2 = sqreq/sqtot + + return self.a*x + self.b + class Polinomial: def __init__(self, data): @@ -437,57 +477,4 @@ class Interpolation: y += d[i+1][0]*mult i += 1 - return y - - def minimus(self,x): - - theta = 0 - # somatorio de x - for i in range(self.data.shape[0]): - - theta += self.data[i][0] - - eta = 0 - #somatorio de y - for i in range(self.data.shape[0]): - - eta += self.data[i][1] - - sigma = 0 - #somatorio de xy - for i in range(self.data.shape[0]): - - sigma += self.data[i][0]*self.data[i][1] - - omega = 0 - #somatorio de x^2 - for i in range(self.data.shape[0]): - - omega += self.data[i][0]**2 - - - self.a = (self.data.shape[0]*sigma - theta*eta)/(self.data.shape[0]*omega - (theta**2)) - - self.b = (theta*sigma - eta*omega)/((theta**2) - self.data.shape[0]*omega) - - ym = 0 - - for i in range(self.data.shape[0]): - - ym += self.data[i][1]/self.data.shape[0] - - sqreq = 0 - - for i in range(self.data.shape[0]): - - sqreq += ((self.a*self.data[i][0] + self.b) - ym)**2 - - sqtot = 0 - - for i in range(self.data.shape[0]): - - sqtot += (self.data[i][1] - ym)**2 - - self.r2 = sqreq/sqtot - - return self.a*x + self.b \ No newline at end of file + return y \ No newline at end of file diff --git a/Otter/__init__.py b/Otter/__init__.py index 80edee6..4132067 100644 --- a/Otter/__init__.py +++ b/Otter/__init__.py @@ -1,2 +1,2 @@ -from .Otter import Algebra -from .Otter import Interpolation \ No newline at end of file +from .Otter import Algebra as algebra +from .Otter import Interpolation as interpolation \ No newline at end of file diff --git a/README.md b/README.md index 808a0d7..05245f1 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,68 @@ -# Numeric Calculus +# Otter - Numeric Calculus -This is a Repository of Python Packages for Numeric Calculus. It contains two packages: Seals and Otter. +This python package is made for applied Numeric Calculus of Algebra Functions. It is made with the following objectives in mind: -## Seals +* Receive one variable function from user input + +* Receive two variable function from user input -The package Seals is made for Linear Algebra. It's able to: +* Performe derivatives with one variable functions -* Scan *csv* files to make a numpy matrix. - -* Write a matrix into a *csv* file - -* Insert user input into a matrix or a vector. +* Performe integral with received functions * Use methods to proccess the matrices. - * Identity Matrix - * Gauss Elimination - * Inverse Matrix - * Cholesky Decomposition - * LU Decomposition - * Cramer -### Syntax +* Find root of functions throw method of bissection and method of newton -The function *scan* has the following syntax `scan(path)`, where `path` is the path to your directory. +* Solve Diferential Equations throw method of euler and runge -The function *solution* has the following syntax `write(array,path)`, where `array` is the matrix that you desire to output and `path` is the path to your directory. +* Performe Minimus Interpolation and Polinomial Interpolation -The python class *Insert* has a method for *matrix* and another for *vector*, and it has the following syntax `Insert.method(array)`, where `Insert` is the *Python Class* and `method` is either a `matrix` or a `vector` and `array` is either a *matrix* or a *vector*. +## Syntax -### Processes +To initialize a Otter instance linked to functions use the following syntax `otr = Otter.algebra(f)`, where `otr` will be a arbitrary name for the instance and `f` is a function of *one variable*. -The python class *process* has all the methods described in the first session. +To initialize a Otter instance linked to data and interpolation use the following syntax `otr = Otter.interpolation(data)`, where `otr` will be a arbitrary name for the instance and data will be a *numpy* matrix where the first columns has to contain the values for `x` and the second column contains the values for `y`. -To call the method use a syntax like `sl = Seals.process()`, where `sl` is an instance and to use a method you have to append the method in front of the instance like: `sl.identity(array)`. +### Algebra -* The method *identity* returns a *numpy* identity matrix of the order of the matrix passed into to it, and it has the following syntax `sl.identity(array)`, which `array` is a square matrix. +Algebra is a Python Class where some of the features described previously are defined as Classes as well, like: `Integral`, `Roots`, `EDO` (diferential equations). -* The method *gauss* returns a *numpy* vector containing the vector of variables from the augmented matrix. `sl.gauss(matrix)`, which `matrix` is the augmented matrix. +#### Integral -* The method *inverse* returns a *numpy* inverse matrix of the matrix passed into to it, and it has the following syntax `sl.inverse(matrix)`, which `matrix` is a square matrix. +To call the class *Integral* append the sufix with lower case in front of the instance like: `otr.integral`. The Integral class has two other class defined inside, `Simple` and `Double`, to call them append the sufix with lower case in front as `otr.integral.simple` or `otr.integral.double`. Then pick between Riemann's Method or Simpson's Method by appending the sufix `riemann` or `simpson` as well. -* The method *cholesky* returns a *numpy* vector containing the vector of variables from the coefficient matrix and the constants vector, and it has the following syntax `sl.cholesky(A,b)`, which `A` is the coefficient matrix and `b` is the constants vector. - -* The method *decomposition* returns a *numpy* vector containing the vector of variables from the coefficient matrix and the constants vector, and it has the following syntax `sl.cholesky(A,b)`, which `A` is the coefficient matrix and `b` is the constants vector. +After that the syntax will be something like `otr.integral.double.riemann(a,b,c,d,n,m)`, where `a` and `c` will be the first value of the interval of integration respectively in x and y, `b` and `d` will be the last, `n` and `m` will be the number of partitions. -* The method *cramer* returns a *numpy* vector containing the vector of variables from the coefficient matrix and the constants vector, and it has the following syntax `sl.cholesky(A,b)`, which `A` is the coefficient matrix and `b` is the constants vector. +The syntax for one variable integrations will be `otr.integral.simple.riemann(a,b,n)`. + +If `n` is not defined the standart value in 10^6 partitions for one variable and 10^4 for double. And if `m` is not defined the standart value will be equal to `n`. + +#### Roots + +To call the class *Root* append the sufix with lower case in front of the instance like: `otr.roots`. The Roots class has three methods defined inside, `bissec`, `newton` and `bissec_newton`, to call them append the sufix with lower case in front as `otr.roots.bissec` or `otr.roots.newton` or even `otr.roots.bissecnewton`. + +The syntax for the bissection method and bissec_newton is equal to `otr.roots.bissec(a,b,e)` and `otr.roots.bissec_newton(a,b,e)`, where `a` is the first element of the interval containing the root and `b` is the last, `e` being the precision. + +The syntax for the newton method is equal to `otr.roots.newton(a,e)`, where `a` is the element closest to the root and `e` is the precision. + +If `e` is not defined the standart value is 10^(-6). + +#### Diferential Equations + +To call the class *EDO* (*E*quações *D*iferenciais *O*rdinárias) append the sufix with lower case in front of the instance like: `otr.edo`. The *EDO* class has two methods defined inside: `euler` and `runge`, to call them append the sufix with lower case in front as `otr.edo.euler` or `otr.edo.runge`. + +The syntax for the diferential equations method is equal to `otr.edo.euler(a,y,b,n)` or `otr.edo.runge(a,y,b,n)`, where `a` and `y` will be the inintial point and `b` is the value in *x* which you want to know the corresponding value in *y* and `n` is the number of operations. + +If `n` is not defined the standart value is 10^7. + +### Interpolation + +The python class *Interpolation* is divided in one method, minimus interpolation, and one class, polinomial interpolation. + +To call the method *minimus* use a syntax like `otr = Otter.interpolation(data)`, where `otr` is an instance and append the method in front of the instance like: `otr.minimus(x)`, where *x* is value of *f(x)* you want to estimate. + +To call the class *Polinomial* append the sufix with lower case in front of the instance like: `otr.polinomial`. The *Polinomial* class has four methods defined inside: `vandermonde`, `lagrange`, `newton` and `gregory`, to call them append the sufix with lower case in front like `otr.edo.gregory(x)` where *x* is value of *f(x)* you want to estimate. ## Installation @@ -54,4 +72,4 @@ To install the package from source `cd` into the directory and run: or run -`pip install Numeric-Calculus_HideyoshiNakazone` \ No newline at end of file +`pip install yoshi-otter` diff --git a/build/lib/Otter/Otter.py b/build/lib/Otter/Otter.py new file mode 100644 index 0000000..c2ec3b7 --- /dev/null +++ b/build/lib/Otter/Otter.py @@ -0,0 +1,480 @@ +import math +import numpy as np +import Seals + +sl = Seals.method() + +class Algebra: + + def __init__(self, function): + self.f = function + self.integral = self.Integral(self.f) + self.roots = self.Roots(self.f) + self.edo = self.Edo(self.f) + + def d(self, x, e): + return (self.f(x + e) - self.f(x - e))/(2*e) + + class Integral: + + def __init__(self,function): + self.f = function + self.simple = self.Simple(function) + self.double = self.Double(function) + + class Simple: + def __init__(self, function): + self.f = function + + def riemann(self,a,b,n=None): + + if n is None: + n = 10**6 + + delta = (b-a)/n + + psi = a + theta = 0 + + while((psi+delta) <= b): + + theta += (self.f(psi) + self.f(psi + delta))/2 + psi += delta + + integral = delta*theta + + return integral + + def simpson(self,a,b,n=None): + + if n is None: + n = 10**6 + + def x(i): + return a + i*h + + h = (b-a)/n + + eta = 0 + theta = 0 + + psi = 1 + kappa = 1 + + while(psi <= (n/2)): + + eta = eta + self.f(x(2*psi - 1)) + psi = psi + 1 + + while(kappa <= ((n/2)-1)): + + theta = theta + self.f(x(2*kappa)) + kappa = kappa + 1 + + return (h/3)*( self.f(x(0)) + self.f(x(n)) + 4*eta + 2*theta) + + + class Double: + + def __init__(self,function): + self.f = function + + def riemann(self,a,b,c,d,n=None,m=None): + + if n is None: + n = 10**4 + + if m is None: + m = n + + dx = (b-a)/n + dy = (d-c)/m + kappa = a + psi = c + theta = 0 + + while((psi + dy) < d): + + while((kappa + dx) < b): + + theta = theta + self.f(kappa, psi) + kappa = kappa + dx + + psi = psi + dy + kappa = a + + return theta*(dx)*(dy) + + def simpson(self,a,b,c,d,n=None,m=None): + + if n is None: + n = 10**4 + + if m is None: + m = n + + dx = (b-a)/n + dy = (d-c)/m + + def x(i): + + x = a + i*dx + + return x + + def y(i): + + y = c + i*dy + + return y + + def g(i): + + sigma = 0 + upsilon = 0 + + zeta = 1 + csi = 1 + + while(zeta <= (m/2)): + + sigma += self.f(x(i),y(2*zeta - 1)) + zeta += 1 + + while(csi <= ((m/2)-1)): + + upsilon += self.f(x(i),y(2*csi)) + csi += 1 + + return (dy/3)*( self.f(x(i),y(0)) + self.f(x(i),y(m)) + 4*sigma + 2*upsilon ) + + eta = 0 + theta = 0 + + psi = 1 + kappa = 1 + + while(psi <= (n/2)): + + eta += g(2*psi - 1) + psi += 1 + + while(kappa <= ((n/2)-1)): + + theta += g(2*kappa) + kappa += 1 + + return (dx/3)*( g(0) + g(n) + 4*eta + 2*theta) + + class Roots: + + def __init__(self, function=None): + if function is not None: + self.f = function + + def bissec(self,a,b,e=None): + + if e is None: + e = 10**(-6) + + fa = self.f(a) + + while abs(a-b) > e: + + c = (a+b)/2 + fc = self.f(c) + + if (fa*fc) < 0: + + b = c + + else: + + a = c + fa = fc + + c = (a+b)/2 + + return c + + def d(self, x, e): + return (self.f(x + e) - self.f(x - e))/(2*e) + + def newton(self,a,e=None): + + if e is None: + e = 10**(-6) + + fa = self.f(a) + da = self.d(a,e) + b = a - fa/da + + + while abs(a-b) > e: + + b = a + a -= (fa/da) + fa = self.f(a) + da = self.d(a,e) + + return a + + def bissec_newton(self,a,b,e=None): + + if e is None: + e = 10**(-6) + + fa = self.f(a) + + c = (a+b)/2 # 'c' é a raiz calculada + + while abs(a-b) > 0.1: + + fc = self.f(c) + + if fa*fc < 0: + + b = c + + else: + + a = c + fa = self.f(a) + + c = (a+b)/2 + + fc = self.f(c) + dc = self.d(c,e) + h = c - fc/dc # 'h' é uma variável de controle + + while abs(c-h) > e: + + h = c + c -= (fc/dc) + fc = self.f(c) + dc = self.d(c,e) + + return (c) + + + class Edo: + + def __init__(self, function): + self.f = function + + def euler(self,a,y,b,n=None): + + if n is None: + n = 10**7 + + dx = (b-a)/n + + def x(i): + return a + i*dx + + for i in range(n): + + y = y + (self.f(x(i),y))*dx + + return y + + def runge(self,a,y,b,n=None): + + if n is None: + n = 10**7 + + dx = (b-a)/n + + def x(i): + return (a + i*dx) + + for i in range(n): + + y = y + (dx/2)*(self.f(x(i),y)+self.f(x(i+1),(y+(dx*self.f(x(i),y))))) + + return y + +class Interpolation: + """ Data should be organized in two columns: X and Y""" + + def __init__(self, data): + + self.data = data + self.polinomial = self.Polinomial(self.data) + + def minimus(self,x): + + theta = 0 + # somatorio de x + for i in range(self.data.shape[0]): + + theta += self.data[i][0] + + eta = 0 + #somatorio de y + for i in range(self.data.shape[0]): + + eta += self.data[i][1] + + sigma = 0 + #somatorio de xy + for i in range(self.data.shape[0]): + + sigma += self.data[i][0]*self.data[i][1] + + omega = 0 + #somatorio de x^2 + for i in range(self.data.shape[0]): + + omega += self.data[i][0]**2 + + + self.a = (self.data.shape[0]*sigma - theta*eta)/(self.data.shape[0]*omega - (theta**2)) + + self.b = (theta*sigma - eta*omega)/((theta**2) - self.data.shape[0]*omega) + + ym = 0 + + for i in range(self.data.shape[0]): + + ym += self.data[i][1]/self.data.shape[0] + + sqreq = 0 + + for i in range(self.data.shape[0]): + + sqreq += ((self.a*self.data[i][0] + self.b) - ym)**2 + + sqtot = 0 + + for i in range(self.data.shape[0]): + + sqtot += (self.data[i][1] - ym)**2 + + self.r2 = sqreq/sqtot + + return self.a*x + self.b + + class Polinomial: + + def __init__(self, data): + self.data = data + + def vandermonde(self, x): + + matrix = np.zeros((self.data.shape[0],self.data.shape[0])) + + for k in range(0, self.data.shape[0]): + + matrix[:,k] = self.data[:,0]**k + + self.A = sl.gauss(np.c_[matrix,self.data[:,1]]) + + y = 0 + + for i in range(0,self.A.shape[0]): + + y += self.A[i]*(x**i) + + return float(y) + + def lagrange(self, x): + + data_x = self.data[:,0] + data_y = self.data[:,1] + + def L(k,x): + + up = down = 1 + + for i in [x for x in range(data_x.shape[0]) if x != k]: + up = up*(x - data_x[i]) + + for i in [x for x in range(data_x.shape[0]) if x != k]: + down = down*(data_x[k] - data_x[i]) + + return up/down + + y = 0 + + for i in range(data_x.shape[0]): + + y += data_y[i]*L(i,x) + + return y + + def newton(self,x): + + d = np.array(np.zeros((self.data.shape[0],self.data.shape[0]))) + + d[0] = self.data[:,1] + + i = j = 0 + + while (i < self.data.shape[0]): + + while (j < (self.data.shape[0]-(i+1))): + + d[i+1][j] = (d[i][j+1] - d[i][j])/(self.data[(i+1)+j][0]-self.data[j][0]) + j += 1 + + i += 1 + j = 0 + + def f(x): + + y = d[0][0] + i = 0 + + while ((i+1) < self.data.shape[0]): + + mult = 1 + k = 0 + while (k <= i): + mult = mult*(x - self.data[k][0]) + k += 1 + + y += d[i+1][0]*mult + i += 1 + + return y + + self.f = f + + return f(x) + + def gregory(self,x): + + h = self.data[0][0] - self.data[1][0] + + d = np.array(np.zeros((self.data.shape[0],self.data.shape[0]))) + + d[0] = self.data[:,1] + + i = j = 0 + + while (i < self.data.shape[0]): + + while (j < (self.data.shape[0]-(i+1))): + + d[i+1][j] = (d[i][j+1] - d[i][j])/((i+1)*h) + j += 1 + + i += 1 + j = 0 + + y = d[0][0] + i = 0 + + while ((i+1) < self.data.shape[0]): + + mult = 1 + k = 0 + while (k <= i): + mult = mult*(x - self.data[k][0]) + k += 1 + + y += d[i+1][0]*mult + i += 1 + + return y \ No newline at end of file diff --git a/build/lib/Otter/__init__.py b/build/lib/Otter/__init__.py new file mode 100644 index 0000000..4132067 --- /dev/null +++ b/build/lib/Otter/__init__.py @@ -0,0 +1,2 @@ +from .Otter import Algebra as algebra +from .Otter import Interpolation as interpolation \ No newline at end of file diff --git a/dist/yoshi-otter-1.1.tar.gz b/dist/yoshi-otter-1.1.tar.gz new file mode 100644 index 0000000..8d832a9 Binary files /dev/null and b/dist/yoshi-otter-1.1.tar.gz differ diff --git a/dist/yoshi_otter-1.1-py3-none-any.whl b/dist/yoshi_otter-1.1-py3-none-any.whl new file mode 100644 index 0000000..52412b3 Binary files /dev/null and b/dist/yoshi_otter-1.1-py3-none-any.whl differ diff --git a/setup.py b/setup.py index bedab02..6da5b64 100644 --- a/setup.py +++ b/setup.py @@ -4,11 +4,11 @@ with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( - name="Otter", # Replace with your own username - version="1.0", + name="yoshi-otter", # Replace with your own username + version="1.1", author="Vitor Hideyoshi", author_email="vitor.h.n.batista@gmail.com", - description="Algebra Functions Python Module for Numeric Calculus", + description="Numeric Calculus python module in the topic of Algebra Functions", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/HideyoshiNakazone/Otter-NumericCalculus.git", @@ -23,5 +23,6 @@ setuptools.setup( install_requires=[ 'numpy', 'pandas', + 'yoshi-seals' ], ) \ No newline at end of file diff --git a/yoshi_otter.egg-info/PKG-INFO b/yoshi_otter.egg-info/PKG-INFO new file mode 100644 index 0000000..b2d399e --- /dev/null +++ b/yoshi_otter.egg-info/PKG-INFO @@ -0,0 +1,91 @@ +Metadata-Version: 2.1 +Name: yoshi-otter +Version: 1.1 +Summary: Numeric Calculus python module in the topic of Algebra Functions +Home-page: https://github.com/HideyoshiNakazone/Otter-NumericCalculus.git +Author: Vitor Hideyoshi +Author-email: vitor.h.n.batista@gmail.com +License: UNKNOWN +Description: # Otter - Numeric Calculus + + This python package is made for applied Numeric Calculus of Algebra Functions. It is made with the following objectives in mind: + + * Receive one variable function from user input + + * Receive two variable function from user input + + * Performe derivatives with one variable functions + + * Performe integral with received functions + + * Use methods to proccess the matrices. + + * Find root of functions throw method of bissection and method of newton + + * Solve Diferential Equations throw method of euler and runge + + * Performe Minimus Interpolation and Polinomial Interpolation + + ## Syntax + + To initialize a Otter instance linked to functions use the following syntax `otr = Otter.algebra(f)`, where `otr` will be a arbitrary name for the instance and `f` is a function of *one variable*. + + To initialize a Otter instance linked to data and interpolation use the following syntax `otr = Otter.interpolation(data)`, where `otr` will be a arbitrary name for the instance and data will be a *numpy* matrix where the first columns has to contain the values for `x` and the second column contains the values for `y`. + + ### Algebra + + Algebra is a Python Class where some of the features described previously are defined as Classes as well, like: `Integral`, `Roots`, `EDO` (diferential equations). + + #### Integral + + To call the class *Integral* append the sufix with lower case in front of the instance like: `otr.integral`. The Integral class has two other class defined inside, `Simple` and `Double`, to call them append the sufix with lower case in front as `otr.integral.simple` or `otr.integral.double`. Then pick between Riemann's Method or Simpson's Method by appending the sufix `riemann` or `simpson` as well. + + After that the syntax will be something like `otr.integral.double.riemann(a,b,c,d,n,m)`, where `a` and `c` will be the first value of the interval of integration respectively in x and y, `b` and `d` will be the last, `n` and `m` will be the number of partitions. + + The syntax for one variable integrations will be `otr.integral.simple.riemann(a,b,n)`. + + If `n` is not defined the standart value in 10^6 partitions for one variable and 10^4 for double. And if `m` is not defined the standart value will be equal to `n`. + + #### Roots + + To call the class *Root* append the sufix with lower case in front of the instance like: `otr.roots`. The Roots class has three methods defined inside, `bissec`, `newton` and `bissec_newton`, to call them append the sufix with lower case in front as `otr.roots.bissec` or `otr.roots.newton` or even `otr.roots.bissecnewton`. + + The syntax for the bissection method and bissec_newton is equal to `otr.roots.bissec(a,b,e)` and `otr.roots.bissec_newton(a,b,e)`, where `a` is the first element of the interval containing the root and `b` is the last, `e` being the precision. + + The syntax for the newton method is equal to `otr.roots.newton(a,e)`, where `a` is the element closest to the root and `e` is the precision. + + If `e` is not defined the standart value is 10^(-6). + + #### Diferential Equations + + To call the class *EDO* (*E*quações *D*iferenciais *O*rdinárias) append the sufix with lower case in front of the instance like: `otr.edo`. The *EDO* class has two methods defined inside: `euler` and `runge`, to call them append the sufix with lower case in front as `otr.edo.euler` or `otr.edo.runge`. + + The syntax for the diferential equations method is equal to `otr.edo.euler(a,y,b,n)` or `otr.edo.runge(a,y,b,n)`, where `a` and `y` will be the inintial point and `b` is the value in *x* which you want to know the corresponding value in *y* and `n` is the number of operations. + + If `n` is not defined the standart value is 10^7. + + ### Interpolation + + The python class *Interpolation* is divided in one method, minimus interpolation, and one class, polinomial interpolation. + + To call the method *minimus* use a syntax like `otr = Otter.interpolation(data)`, where `otr` is an instance and append the method in front of the instance like: `otr.minimus(x)`, where *x* is value of *f(x)* you want to estimate. + + To call the class *Polinomial* append the sufix with lower case in front of the instance like: `otr.polinomial`. The *Polinomial* class has four methods defined inside: `vandermonde`, `lagrange`, `newton` and `gregory`, to call them append the sufix with lower case in front like `otr.edo.gregory(x)` where *x* is value of *f(x)* you want to estimate. + + ## Installation + + To install the package from source `cd` into the directory and run: + + `pip install .` + + or run + + `pip install otter` + +Platform: UNKNOWN +Classifier: Programming Language :: Python :: 3 +Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2) +Classifier: Operating System :: OS Independent +Classifier: Development Status :: 2 - Pre-Alpha +Requires-Python: >=3.6 +Description-Content-Type: text/markdown diff --git a/yoshi_otter.egg-info/SOURCES.txt b/yoshi_otter.egg-info/SOURCES.txt new file mode 100644 index 0000000..5dc205c --- /dev/null +++ b/yoshi_otter.egg-info/SOURCES.txt @@ -0,0 +1,9 @@ +README.md +setup.py +Otter/Otter.py +Otter/__init__.py +yoshi_otter.egg-info/PKG-INFO +yoshi_otter.egg-info/SOURCES.txt +yoshi_otter.egg-info/dependency_links.txt +yoshi_otter.egg-info/requires.txt +yoshi_otter.egg-info/top_level.txt \ No newline at end of file diff --git a/yoshi_otter.egg-info/dependency_links.txt b/yoshi_otter.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/yoshi_otter.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/yoshi_otter.egg-info/requires.txt b/yoshi_otter.egg-info/requires.txt new file mode 100644 index 0000000..11c1c26 --- /dev/null +++ b/yoshi_otter.egg-info/requires.txt @@ -0,0 +1,3 @@ +numpy +pandas +yoshi-seals diff --git a/yoshi_otter.egg-info/top_level.txt b/yoshi_otter.egg-info/top_level.txt new file mode 100644 index 0000000..ccaaf54 --- /dev/null +++ b/yoshi_otter.egg-info/top_level.txt @@ -0,0 +1 @@ +Otter