NZMATH  1.2.0
About: NZMATH is a Python based number theory oriented calculation system.
  Fossies Dox: NZMATH-1.2.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

nzmath.equation Namespace Reference

Functions

def e1 (x)
 
def e1_ZnZ (x, n)
 
def e2 (x)
 
def e2_Fp (x, p)
 
def e3 (x)
 
def e3_Fp (x, p)
 
def Newton (f, initial=1, repeat=250)
 
def SimMethod (f, NewtonInitial=1, repeat=250)
 
def _SimMethod (g, initials=None, newtoninitial=None, repeat=250)
 
def _initialize (g, newtoninitial=None)
 
def _upper_bound_of_roots (g)
 
def root_Fp (g, p, flag=True)
 
def allroots_Fp (g, p)
 
def roots_loop (g, deg_g, p, Fp)
 

Variables

 _log = logging.getLogger('nzmath.equation')
 

Detailed Description

equation -- methods to solve algebraic equations.

If you would like to solve an equation in the complex field and need
more precision, then you can import and use plugins.SETPRECISION.

e.g:
from nzmath.plugins import SETPRECISION
SETPRECISION(200)

Then, the following computations will be done in such precision, if
plugins.PRECISION_CHANGEABLE is true.

Function Documentation

◆ _initialize()

def nzmath.equation._initialize (   g,
  newtoninitial = None 
)
private
create initial values of equation given as a list g.

Definition at line 216 of file equation.py.

References nzmath.equation._upper_bound_of_roots(), nzmath.equation.Newton(), and nzmath.bigrange.range().

Referenced by nzmath.equation._SimMethod().

◆ _SimMethod()

def nzmath.equation._SimMethod (   g,
  initials = None,
  newtoninitial = None,
  repeat = 250 
)
private
Return zeros of a polynomial given as a list.

- g is the list of the polynomial coefficient in ascending order.
- initial (optional) is a list of initial approximations of zeros.
- newtoninitial (optional) is an initial value for Newton method to
  obtain an initial approximations of zeros if 'initial' is not given.
- repeat (optional) is the number of iteration. The default is 250.

Definition at line 172 of file equation.py.

References nzmath.equation._initialize(), and nzmath.bigrange.range().

Referenced by nzmath.equation.SimMethod().

◆ _upper_bound_of_roots()

def nzmath.equation._upper_bound_of_roots (   g)
private
Return an upper bound of roots.

Definition at line 240 of file equation.py.

Referenced by nzmath.equation._initialize().

◆ allroots_Fp()

def nzmath.equation.allroots_Fp (   g,
  p 
)
Return roots over F_p of nonzero polynomial g.
p must be prime.

Definition at line 296 of file equation.py.

References nzmath.bigrange.range(), and nzmath.equation.roots_loop().

◆ e1()

def nzmath.equation.e1 (   x)
0 = x[0] + x[1]*t

Definition at line 33 of file equation.py.

◆ e1_ZnZ()

def nzmath.equation.e1_ZnZ (   x,
  n 
)
Return the solution of x[0] + x[1]*t = 0 (mod n).
x[0], x[1] and n must be positive integers.

Definition at line 42 of file equation.py.

Referenced by nzmath.equation.e2_Fp().

◆ e2()

def nzmath.equation.e2 (   x)
0 = x[0] + x[1]*t + x[2]*t**2

Definition at line 52 of file equation.py.

◆ e2_Fp()

def nzmath.equation.e2_Fp (   x,
  p 
)
p is prime
f = x[0] + x[1]*t + x[2]*t**2

Definition at line 64 of file equation.py.

References nzmath.equation.e1_ZnZ().

Referenced by nzmath.equation.e3_Fp().

◆ e3()

def nzmath.equation.e3 (   x)
0 = x[0] + x[1]*t + x[2]*t**2 + x[3]*t**3

Definition at line 88 of file equation.py.

References nzmath.bigrange.range().

◆ e3_Fp()

def nzmath.equation.e3_Fp (   x,
  p 
)
p is prime
0 = x[0] + x[1]*t + x[2]*t**2 + x[3]*t**3

Definition at line 114 of file equation.py.

References nzmath.equation.e2_Fp(), and nzmath.arith1.inverse().

◆ Newton()

def nzmath.equation.Newton (   f,
  initial = 1,
  repeat = 250 
)
Compute x s.t. 0 = f[0] + f[1] * x + ... + f[n] * x ** n

Definition at line 136 of file equation.py.

References nzmath.bigrange.range().

Referenced by nzmath.equation._initialize().

◆ root_Fp()

def nzmath.equation.root_Fp (   g,
  p,
  flag = True 
)
Return a root over F_p of nonzero polynomial g.
p must be prime.
If flag = False, return a root randomly

Definition at line 248 of file equation.py.

References nzmath.bigrange.range().

◆ roots_loop()

def nzmath.equation.roots_loop (   g,
  deg_g,
  p,
  Fp 
)

Definition at line 316 of file equation.py.

Referenced by nzmath.equation.allroots_Fp().

◆ SimMethod()

def nzmath.equation.SimMethod (   f,
  NewtonInitial = 1,
  repeat = 250 
)
Return zeros of a polynomial given as a list.

Definition at line 161 of file equation.py.

References nzmath.equation._SimMethod().

Variable Documentation

◆ _log

nzmath.equation._log = logging.getLogger('nzmath.equation')
private

Definition at line 28 of file equation.py.