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
dd6b2284
Commit
dd6b2284
authored
Jul 31, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add functions for BESSELY formula
parent
f7720ec5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
7 deletions
+75
-7
cell/model/FormulaObjects/engineeringFunctions.js
cell/model/FormulaObjects/engineeringFunctions.js
+75
-7
No files found.
cell/model/FormulaObjects/engineeringFunctions.js
View file @
dd6b2284
...
...
@@ -347,14 +347,53 @@
}
}
function
_Bessely0
(
fNum
)
{
if
(
fNum
<
8.0
)
{
var
y
=
(
fNum
*
fNum
);
var
f1
=
-
2957821389.0
+
y
*
(
7062834065.0
+
y
*
(
-
512359803.6
+
y
*
(
10879881.29
+
y
*
(
-
86327.92757
+
y
*
228.4622733
))));
var
f2
=
40076544269.0
+
y
*
(
745249964.8
+
y
*
(
7189466.438
+
y
*
(
47447.26470
+
y
*
(
226.1030244
+
y
))));
var
fRet
=
f1
/
f2
+
0.636619772
*
BesselJ
(
fNum
,
0
)
*
Math
.
log
(
fNum
);
}
else
{
var
z
=
8.0
/
fNum
;
var
y
=
(
z
*
z
);
var
xx
=
fNum
-
0.785398164
;
var
f1
=
1
+
y
*
(
-
0.1098628627
e
-
2
+
y
*
(
0.2734510407
e
-
4
+
y
*
(
-
0.2073370639
e
-
5
+
y
*
0.2093887211
e
-
6
)));
var
f2
=
-
0.1562499995
e
-
1
+
y
*
(
0.1430488765
e
-
3
+
y
*
(
-
0.6911147651
e
-
5
+
y
*
(
0.7621095161
e
-
6
+
y
*
(
-
0.934945152
e
-
7
))));
var
fRet
=
Math
.
sqrt
(
0.636619772
/
fNum
)
*
(
Math
.
sin
(
xx
)
*
f1
+
z
*
Math
.
cos
(
xx
)
*
f2
);
}
return
new
cNumber
(
fRet
);
}
// See #i31656# for a commented version of this implementation, attachment #desc6
// http://www.openoffice.org/nonav/issues/showattachment.cgi/63609/Comments%20to%20the%20implementation%20of%20the%20Bessel%20functions.odt
function
_Bessely1
(
fNum
)
{
if
(
fNum
<
8.0
)
{
var
y
=
(
fNum
*
fNum
);
var
f1
=
fNum
*
(
-
0.4900604943e13
+
y
*
(
0.1275274390e13
+
y
*
(
-
0.5153438139e11
+
y
*
(
0.7349264551e9
+
y
*
(
-
0.4237922726e7
+
y
*
0.8511937935e4
)))));
var
f2
=
0.2499580570e14
+
y
*
(
0.4244419664e12
+
y
*
(
0.3733650367e10
+
y
*
(
0.2245904002e8
+
y
*
(
0.1020426050e6
+
y
*
(
0.3549632885e3
+
y
)))));
var
fRet
=
f1
/
f2
+
0.636619772
*
(
BesselJ
(
fNum
,
1
)
*
Math
.
log
(
fNum
)
-
1
/
fNum
);
}
else
{
var
fRet
=
Math
.
sqrt
(
0.636619772
/
fNum
)
*
Math
.
sin
(
fNum
-
2.356194491
);
}
return
new
cNumber
(
fRet
);
}
function
BesselY
(
fNum
,
nOrder
)
{
switch
(
nOrder
)
{
case
0
:
return
Bessely0
(
fNum
);
return
_
Bessely0
(
fNum
);
case
1
:
return
Bessely1
(
fNum
);
return
_
Bessely1
(
fNum
);
default
:
{
var
fByp
,
fTox
=
2
/
fNum
,
fBym
=
Bessely0
(
fNum
),
fBy
=
Bessely1
(
fNum
);
var
fByp
,
fTox
=
2
/
fNum
,
fBym
=
_Bessely0
(
fNum
),
fBy
=
_
Bessely1
(
fNum
);
if
(
fBym
instanceof
cError
)
{
return
fBym
;
...
...
@@ -945,7 +984,7 @@
cOCT2DEC
,
cOCT2HEX
);
cFormulaFunctionGroup
[
'
NotRealised
'
]
=
cFormulaFunctionGroup
[
'
NotRealised
'
]
||
[];
cFormulaFunctionGroup
[
'
NotRealised
'
].
push
(
cBESSELI
,
c
BESSELY
,
c
CONVERT
);
cFormulaFunctionGroup
[
'
NotRealised
'
].
push
(
cBESSELI
,
cCONVERT
);
/**
* @constructor
...
...
@@ -1078,9 +1117,7 @@
if
(
n
<
0
||
x
<
0
){
return
new
cError
(
cErrorType
.
not_numeric
);
}
/*if(x < 0){
x = Math.abs(x);
}*/
n
=
Math
.
floor
(
n
);
return
BesselK
(
x
,
n
);
...
...
@@ -1100,6 +1137,37 @@
cBESSELY
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cBESSELY
.
prototype
.
constructor
=
cBESSELY
;
cBESSELY
.
prototype
.
argumentsMin
=
2
;
cBESSELY
.
prototype
.
argumentsMax
=
2
;
cBESSELY
.
prototype
.
Calculate
=
function
(
arg
)
{
//результаты вычислений как в LO
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
],
true
);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
return
this
.
value
=
argError
;
}
var
calcFunc
=
function
(
argArray
){
var
x
=
argArray
[
0
];
var
n
=
argArray
[
1
];
if
(
n
<
0
||
x
<
0
){
return
new
cError
(
cErrorType
.
not_numeric
);
}
n
=
Math
.
floor
(
n
);
return
BesselY
(
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