Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
e685087c
Commit
e685087c
authored
Aug 01, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add BESSELI formula
parent
4f94d56d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
43 deletions
+77
-43
cell/model/FormulaObjects/engineeringFunctions.js
cell/model/FormulaObjects/engineeringFunctions.js
+77
-43
No files found.
cell/model/FormulaObjects/engineeringFunctions.js
View file @
e685087c
...
...
@@ -228,6 +228,53 @@
return
new
cNumber
(
fRet
);
}
function
bessi0
(
x
){
var
ax
=
Math
.
abs
(
x
),
fRet
,
y
;
if
(
ax
<
3.75
)
{
y
=
x
/
3.75
;
y
*=
y
;
fRet
=
1.0
+
y
*
(
3.5156229
+
y
*
(
3.0899424
+
y
*
(
1.2067492
+
y
*
(
0.2659732
+
y
*
(
0.360768
e
-
1
+
y
*
0.45813
e
-
2
)))));
}
else
{
y
=
3.75
/
ax
;
fRet
=
(
Math
.
exp
(
ax
)
/
Math
.
sqrt
(
ax
))
*
(
0.39894228
+
y
*
(
0.1328592
e
-
1
+
y
*
(
0.225319
e
-
2
+
y
*
(
-
0.157565
e
-
2
+
y
*
(
0.916281
e
-
2
+
y
*
(
-
0.2057706
e
-
1
+
y
*
(
0.2635537
e
-
1
+
y
*
(
-
0.1647633
e
-
1
+
y
*
0.392377
e
-
2
))))))));
}
return
fRet
;
}
function
bessi
(
x
,
n
){
var
max
=
1.0e10
;
var
min
=
1.0
e
-
10
;
var
ACC
=
40.0
;
var
bi
,
bim
,
bip
,
tox
,
res
;
if
(
x
===
0.0
){
return
new
cNumber
(
0.0
);
}
else
{
tox
=
2.0
/
Math
.
abs
(
x
);
bip
=
res
=
0.0
;
bi
=
1.0
;
for
(
var
j
=
2
*
(
n
+
parseInt
(
Math
.
sqrt
(
ACC
*
n
)));
j
>
0
;
j
--
)
{
bim
=
bip
+
j
*
tox
*
bi
;
bip
=
bi
;
bi
=
bim
;
if
(
Math
.
abs
(
bi
)
>
max
)
{
res
*=
min
;
bi
*=
min
;
bip
*=
min
;
}
if
(
j
===
n
){
res
=
bip
;
}
}
res
*=
bessi0
(
x
)
/
bi
;
return
x
<
0.0
&&
(
n
&
1
)
?
new
cNumber
(
-
res
)
:
new
cNumber
(
res
);
}
}
function
BesselK
(
fNum
,
nOrder
)
{
switch
(
nOrder
)
{
case
0
:
...
...
@@ -987,7 +1034,7 @@
cOCT2DEC
,
cOCT2HEX
);
cFormulaFunctionGroup
[
'
NotRealised
'
]
=
cFormulaFunctionGroup
[
'
NotRealised
'
]
||
[];
cFormulaFunctionGroup
[
'
NotRealised
'
].
push
(
c
BESSELI
,
c
CONVERT
);
cFormulaFunctionGroup
[
'
NotRealised
'
].
push
(
cCONVERT
);
/**
* @constructor
...
...
@@ -1001,48 +1048,35 @@
cBESSELI
.
prototype
.
constructor
=
cBESSELI
;
cBESSELI
.
prototype
.
argumentsMin
=
2
;
cBESSELI
.
prototype
.
argumentsMax
=
2
;
/*cBESSELI.prototype.Calculate = function ( arg ) {
var x = arg[0],
n = arg[1];
if ( x instanceof cArea || x instanceof cArea3D ) {
x = x.cross( arguments[1] );
}
else if ( x instanceof cArray ) {
x = x.getElementRowCol( 0, 0 );
}
if ( n instanceof cArea || n instanceof cArea3D ) {
n = n.cross( arguments[1] );
}
else if ( n instanceof cArray ) {
n = n.getElementRowCol( 0, 0 );
}
cBESSELI
.
prototype
.
Calculate
=
function
(
arg
)
{
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
],
true
);
var
argClone
=
oArguments
.
args
;
x = x
.tocNumber();
n = n
.tocNumber();
argClone
[
0
]
=
argClone
[
0
]
.
tocNumber
();
argClone
[
1
]
=
argClone
[
1
]
.
tocNumber
();
if ( x instanceof cError ) {
return this.value = x;
}
if ( n instanceof cError ) {
return this.value = n;
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
return
this
.
value
=
argError
;
}
x = x.getValue();
n = n.getValue();
var
calcFunc
=
function
(
argArray
){
var
x
=
argArray
[
0
];
var
n
=
argArray
[
1
];
if
(
n
<
0
){
return this.value =
new cError( cErrorType.not_numeric );
return
new
cError
(
cErrorType
.
not_numeric
);
}
if
(
x
<
0
){
x
=
Math
.
abs
(
x
);
}
n
=
Math
.
floor
(
n
);
this.value = BesselI( x, n );
return this.value;
};*/
return
bessi
(
x
,
n
);
};
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
calcFunc
);
};
/**
* @constructor
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment