This package has been deprecated

Author message:

`WARNING: This project has been renamed to Nsolvejs. Install using nsolvejs instead.`

# jnsolve

0.0.10 • Public • Published

# JNsolve

## Introduction

Solve numerically equations and calculate best fit to a data array given, also provides a series of numeric routines usable.

## Features

• JNsolve linear algebra
• JNsolve bestfit
• JNsolve regulafalsi
• JNsolve fixedpoint
• JNsolve bisection
• JNsolve Newton-Raphson
• JNsolve Newton-Raphson-Higher-Order
• JNsolve Numerical Derivative
• JNsolve FindRoot

## API

### `JNsolve`

Initialize `JNsolve`

### `Numerical analysis`

#### `JNsolve.calculusN.D`

Object with differents numerics methods to calculate the derivative of a function.

##### `JNsolve.calculusN.D.Nof(Function,Number,Array)`

Constructor that generates the numeric derivative of `Function`=> f(x) with a `Number` => N given of divisions in an interval `Array` => [a,b].

##### `JNsolve.calculusN.D.Nof.f_x`

Instance method what is the derivative numerical of `Function` with a `Number` given of divisions in an interval `Array`.

is a aproximation to the derivative of f (df_dx) on 3 with the 1000 divisions in the interval [2,7]. Is available another method that calculate the numerical derivative calculating the dx_i in a optimazed way, dx_i=h/sqrt(1+dfdx^2) with h=(b-a)/N.

##### `JNsolve.calculusN.D.linear_interpolation(Array)`

Is a constructor that generates the numeric linear interpolation of data given in `Array`= [[x_1,y_2],[x_2,y_3],...[x_n,y_n]] in the interval [x_1,x_n].

##### `JNsolve.calculusN.D.linear_interpolation(Array).function_interpolated`

Is a instance method what is the interpolated function of `Array` given.

Is a aproximation interpolated to the `Array` = [[0,3.2],[1,4.6],[2,5.1],[4,6.9]].

#### `JNsolve.nsolveqn(Function, Array[,Number,Object])`

Is a method that calculate numerically the solution of `Function`=>f(x)=0 try in the interval (`Array`=>[a,b]) beginning on `Number`=>x_0 (initial point).

The `Object`is default options and are { npoints_DNumeric : 1000, presicion : 0.001 , nstepsmax : 1000 , method : 'Newton_Rapshon' }. The mothods available are RegulaFalsi, bisection,fixedpoint,Newton_Raphson_Higherorder, Newton_Raphson. The rest of routines for every method are availables:

#### `JNsolve.calculusN.Newton_Raphson_Higherorder(Function,Array[, Number, Object])`

in every case if x_0 is undefined, is taken from a random number in interval `Array`=>[a,b]. All these methods return a object with properties Root, numSteps and method used.

#### `JNsolve.calculusN.findroot(Function, Array[,Number,Object])`

Is a method that calculate numerically the solution of `Function`=>f(x)=0 try in the interval (`Array`=>[a,b]) beginning on `Number`=>x_0 (initial point).

The `Object`is default options and are { npoints_DNumeric : 1000, precision : 0.001 , nstepsmax : 1000 , method : 'Newton_Rapshon' }. Here, findroot try find the root of function by all methods availables in the module.

### `Data Fitting`

#### `JNsolve.fit.best(Array[,Array,Array,Object,Function])` Calculate the best fit using the first `Array`= [[x_1,y_2],[x_2,y_3],...[x_n,y_n]] argument as data input, the second `Array` = [z_1,z_2...z_m] argument are the values of x's for which is necessary calculate their y`s values respectively, the third argument are the values of "y" for which is queried the values of "x". The properties of options object are smoothing (default = True), noiseeliminate (default = True), smoothingmethod (default ='exponential' only by moment), alpha (default = 0.8) and fits_name to use: the availables function are inverse (a/(b+x)), linear (ax+b), exponential (ae^(bx)), logarithmic (a+b Log(x)), polynomial (ax^2+bx+c), sqrt (a sqrt(x)+b) and power (ax^b), if not specified take all function availables. The noiseeliminate method eliminate data that are beyond of 3.5 standard deviation from mean(99.95 % Reliability if data have a normal distribution), does that make a loop filter until that not one data is out of this limit. Return a object with the properties: ans_ofY,ans_ofX, fitUsed, fitEquationUsed, fitParamsUsed, fitPointsUsed, fitWithError and fit. The last parameter is a callback function that receive as only parameter the fit self.

### `Linear Algebra`

#### `JNsolve.AL.matrix(Array)`

Is a constructor of a object matrix, the form of Array param have to be like `Array`= [[x_11,...x_1n],[x_21,...y_2n],...[x_m1,...x_mn]], if someone raw do not have the same column number returns a undefined object. The instance properties are raw, column,array and det which are the number of raw and column, the array is the array self passed to constructor. The Det property is obvious. The instance methods are _ , x, plus, pow, adj, inv, map, truncate, trans and scalar: the first is a method with integers parameters i,j that is the i,j member of matrix object, the second is the product by another matrix, accept as parameters matrix objects, plus method adds the object matrix to matrix parameters passed to the method, pow calculates the power of matrix and accepts as parameter the power n (integer), adj calculates the matrix adjoint, inv calculates the matrix inverse, map apply the map over matrix, truncate is a mapping that truncate the matrix's numbers to "n" parameter the digits, trans calculates the matrix transposed and finally the last calculates the scalar product with the number passed as parameter to method. The matrix constructor has the class methods adj, det, inv, minor, pscalar, sum, trans, multiply, map and pow that calculates the adjoint, determinant, inverse, minor, scalar product, sum, transposed, multiplication, mapping, create and power, the parameters of each one are obviously. Every method return a matrix object such way that can be chained another methods.

#### `JNsolve.AL.vector(Array)`

Constructor of a vector object with instance property array that is the array self passed as parameter, matrix (Here the vectors are matrixs of nx1) and the instance methods `dot(Vector)` that calculates the dot product, `sum(Vector[,Vector,...])`, `pscalar(Number)` and `cross(Vector)` that calculates the cross product. In another hand the constructor has the class method: `dotp(Vector,Vector)`, `sum(Vector,Vector[,Vector...])`, `scalarp(Number,Vector)` and `crossp(Vector,Vector[,Vector,...])`. Here the vectors behave as nx1 matrix, because of has all the methods and properties of matrix in matrix property.

#### `JNsolve.AL.solveLE(Array,Array)`

Solve the linear equation system:

a_11x_1+a_12 x_2+...a_1n x_n = b_1

. .

. .

. .

a_n1x_1+a_n2 x_2+...a_nn x_n = b_n

to do that is necessary pass the array [[a_11,a_12...a_1n]...,[a_n1,a_n2...a_nn]]firstly and the result array [b_1,b_2...,b_n]. Return the array solution for the system [x_1,x_2,...,x_n].

#### `JNsolve.utils`

Some utils function to use: ## Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code. For any bugs report please contact to me via e-mail: cereceres@ciencias.unam.mx.

## Licence

Copyright (c) 2015 Jesús Edel Cereceres with Andrés González and Marco Godínez as collaborators, 4yopping and all the related trademarks.

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.

## Package Sidebar

### Repository

github.com/4yopping/jnsolve

0

0.0.10