mathpack 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +68 -20
  3. data/lib/mathpack/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e848a2ca014612e04f7d621ff4667bc4dad2603
4
- data.tar.gz: 85a146ea4bea8cb8720f4a7542c4582849f42f11
3
+ metadata.gz: ebeda1905dee9fe22d4a6469200537d76d21c432
4
+ data.tar.gz: b3b71ff00ef7a9ced9dd6855f8ef912329167f0e
5
5
  SHA512:
6
- metadata.gz: e7f5d93c396d007c6b634e3b68874eef3e64b29e7d3e8397de39f0325d3f24b303391d4f8155e3afd106340d2fd527372c586696d2fc4077b4357dbf38861e5b
7
- data.tar.gz: 1f55b2454e8271adaa34f955cf161cd9e52807ba3090d0c5f925c53568de2a2eb04b5db01c4b8318d70b939794c4273bde6b31e914b0e7c6a1541da5a1068371
6
+ metadata.gz: 89c4e920ab56d6dc9ba263d0f04dc6682efba2f2374d01c3afc8f56b809e0a40ec96b9987e64c8ec8e5881b9e29bdd73162b32a15fa18c0bab6b43c0bbb14572
7
+ data.tar.gz: e19cd9fe1cf1bdc670e5b0ad2f1a2b47f9e6254cf6e4ba9cad9742a7f66ec43bfecf722f7f99919775196ca22a1f9144226762b3c5547e72495c688b9065f8a0
data/README.md CHANGED
@@ -25,6 +25,7 @@ Or install it yourself as:
25
25
  - **Functions**. Collects mathematical functions
26
26
  - **Approximation**. Allows to approximate table and analytical functions by polynom
27
27
  - **NonlinearEquations**. Solves unlinear mathematical equations
28
+ - **IntegralEquations**. Solves integral second order Fredholm and Volter equations
28
29
  - **Integration**. Integrates functions
29
30
  - **IO**. Prints data
30
31
  - **Functional**. Lambda functions
@@ -96,8 +97,8 @@ stat.trend(polynom_power: 1) #=> 1.7999999999999996*x - 0.9999999999999987
96
97
  #### solve(params = {})
97
98
  returns solution of nonlinear equation.
98
99
  ##### Parameters
99
- - *start* - point to start iteration process
100
- - *eps* - calculations accuraccy
100
+ - ***start*** - point to start iteration process
101
+ - ***eps*** - calculations accuraccy
101
102
 
102
103
  ### Usage
103
104
  Now you have no problems solving nonlinear equations. If you want, for example, to solve equation ![equation](http://latex.codecogs.com/gif.latex?x%5E%7B2%7D%20%3D%20%5Csin%28%7Bx+1%7D%29)
@@ -122,10 +123,10 @@ Mathpack::NonlinearEquations.solve(start: 0.01, eps: 0.00001){|x| Math.exp(x-2)
122
123
  #### solve_system(params = {})
123
124
  returns solution of system of nonlinear equations by *Newton method*
124
125
  ##### Parameters
125
- - *start* - vector to start iteration process
126
- - *eps* - calculations accuraccy
127
- - *f* - vector of right part lambdas
128
- - *w_matrix* - matrix *W* in Newton method
126
+ - ***start*** - vector to start iteration process
127
+ - ***eps*** - calculations accuraccy
128
+ - ***f*** - vector of right part lambdas
129
+ - ***w_matrix*** - matrix *W* in Newton method
129
130
 
130
131
  ### Usage
131
132
  If you have system of equations ![equation](http://latex.codecogs.com/gif.latex?f_%7Bi%7D%28x%29%20%3D%200%2C%20i%20%3D%200%2C%201%2C%20...%2C%20N-1)
@@ -149,12 +150,59 @@ w = -> x, y { [[1, 1], [2 * x, 2 * y]] }
149
150
  Mathpack::NonlinearEquations.solve_system(start: [1, 5], eps: 1e-4, f: f, w_matrix: w) #=> [-1.829420851037002e-12, 3.0000000000018296]
150
151
  ```
151
152
 
153
+ ## IntegralEquations
154
+ #### solve_fredholm_2(params={})
155
+ returns solution of integral equation as a hash of nodes and values arrays.
156
+ ##### Parameters
157
+ - ***from*** - left border
158
+ - ***to*** - right border
159
+ - ***lambda*** - *lambda* parameter
160
+ - ***k*** - kernel function (2 arguements)
161
+ - ***f*** - inhomogeneity function (1 arguement)
162
+ - ***eps*** - accuracy
163
+
164
+ ### Usage
165
+ Let we have the following integral equation
166
+
167
+ ![equation](http://latex.codecogs.com/gif.latex?u%28x%29%20-%20%5Cfrac%7B1%7D%7B2%7D%5Cint_%7B1%7D%5E%7B2%7D%5Cfrac%7Bu%28t%29%29%7D%7B%5Csqrt%7Bx+t%5E%7B2%7D%7D%7Ddt%20%3D%202x%20+%20%5Csqrt%7Bx+1%7D%20-%20%5Csqrt%7Bx+4%7D)
168
+
169
+ If you want to solve equation with accuracy **1e-5**, you should call
170
+ ```ruby
171
+ k = -> x, t { 1.0 / (x + t**2)**0.5 }
172
+ f = -> x { 2*x + (x + 1)**0.5 - (x + 4)**0.5 }
173
+ Mathpack::IntegralEquations.solve_fredholm_2(from: 1.0, to: 2.0, lambda: 0.5, eps: 1e-5, k: k, f: f)
174
+ #=> {:x=>[1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, 2.0], :f=>[1.9999989550044168, 2.2499991010033416, 2.499999229316462, 2.7499993410739187, 2.9999994379022, 3.2499995215457123, 3.4999995936848047, 3.7499996558559117, 3.9999997094242845]}
175
+ ```
176
+
177
+ #### solve_volter_2(params{})
178
+ returns solution of integral equation as a hash of nodes and values arrays.
179
+ ##### Parameters
180
+ - ***from*** - left border
181
+ - ***to*** - right border
182
+ - ***lambda*** - *lambda* parameter
183
+ - ***k*** - kernel function (2 arguements)
184
+ - ***f*** - inhomogeneity function (1 arguement)
185
+ - ***eps*** - accuracy
186
+
187
+ ### Usage
188
+ Let we have the following integral equation
189
+
190
+ ![equation](http://latex.codecogs.com/gif.latex?u%28x%29%20%3D%20%5Cfrac%7B1%7D%7B2%7D%5Cint_%7B0%7D%5E%7Bx%7Dcos%28x-t%29u%28t%29dt%20+%20%5Cfrac%7B3%7D%7B4%7De%5E%7Bx%7D%20+%20%5Cfrac%7B1%7D%7B4%7Dcosx-%5Cfrac%7B1%7D%7B4%7Dsinx%2C%200%5Cleq%20x%20%5Cleq%201)
191
+
192
+ If you want to solve equation with accuracy **1e-3**, you should call
193
+ ```ruby
194
+ k = -> x, t { Math.cos(x - t) }
195
+ f = -> x { 0.75 * Math.exp(x) + 0.25 * Math.cos(x) - 0.25 * Math.sin(x) }
196
+ Mathpack::IntegralEquations.solve_volter_2(from: 0.0, to: 1.0, lambda: 0.5, eps: 1e-3, k: k, f: f)
197
+ #=> {:x=>[0.0, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1.0], :f=>[1.0, 1.0644951210235056, 1.1331511709098798, 1.2062365414157485, 1.2840369296892897, 1.3668564541117094, 1.455018842114489, 1.5488686946157586, 1.6487728320186184, 1.755121727033003, 1.868331029922017, 1.9888431921348702, 2.117129194673052, 2.2536903879456665, 2.3990604503055315, 2.5538074729214233, 2.718536179135541]}
198
+ ```
199
+
152
200
  ## SLE
153
201
  #### solve(params = {})
154
202
  returns solution of system of linear equations.
155
203
  ##### Parameters
156
- - *matrix* - system matrix
157
- - *f* - right part vector
204
+ - ***matrix*** - system matrix
205
+ - ***f*** - right part vector
158
206
 
159
207
  ### Usage
160
208
  Let's solve some system of linear equations. It can be written as
@@ -181,16 +229,16 @@ Mathpack::SLE.solve(matrix: a, f: b) #=> Matrix[[-1.0, 2.0, 4.0]]
181
229
  #### approximate_by_polynom(params = {})
182
230
  returns array of coefficients of polynom, approximating given function on [from, to] segment.
183
231
  ##### Parameters
184
- - *x* - array of approximation nodes
185
- - *polynom_power* - power of approximation polynom
186
- - *f* - functions values in *x* if you have table function
232
+ - ***x*** - array of approximation nodes
233
+ - ***polynom_power*** - power of approximation polynom
234
+ - ***f*** - functions values in *x* if you have table function
187
235
 
188
236
  #### generate_nodes(params = {})
189
237
  returns nodes for approximation with some step.
190
238
  ##### Parameters
191
- - *from* - first node
192
- - *to* - last node
193
- - *step* - step between nodes
239
+ - ***from*** - first node
240
+ - ***to*** - last node
241
+ - ***step*** - step between nodes
194
242
 
195
243
  #### print_polynom(coefficients)
196
244
  returns a string representing polynom with given coefficients.
@@ -222,8 +270,8 @@ Mathpack::Approximation.print_polynom(result) #=> x^2
222
270
  #### integrate(params = {})
223
271
  returns integral value.
224
272
  ##### Parameters
225
- - *from* - start of integration
226
- - *to* - end of integration
273
+ - ***from*** - start of integration
274
+ - ***to*** - end of integration
227
275
 
228
276
  ### Usage
229
277
  Let you have the following integral:
@@ -246,10 +294,10 @@ Mathpack::Integration.integrate(from: -Float::INFINITY, to: Float::INFINITY){ |x
246
294
  #### print_table_function(params = {})
247
295
  writes table function values to file
248
296
  ##### Parameters
249
- - *filename* - name of output file
250
- - *x* - arguements array
251
- - *y* - function values array
252
- - *labels* - hash of labels names for *x* and *y* column
297
+ - ***filename*** - name of output file
298
+ - ***x*** - arguements array
299
+ - ***y*** - function values array
300
+ - ***labels*** - hash of labels names for *x* and *y* column
253
301
 
254
302
  #### read_table_function(filename)
255
303
  returns table function values hash, written to **filename**
@@ -1,3 +1,3 @@
1
1
  module Mathpack
2
- VERSION = '0.4.6'
2
+ VERSION = '0.4.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mathpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - maxmilan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-08 00:00:00.000000000 Z
11
+ date: 2015-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler