-
-
Notifications
You must be signed in to change notification settings - Fork 812
Add Gauss hypergeometric function #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0943177
cbba8a7
8f4c48c
4458d51
bbe6702
3da1a52
48fe866
b810b92
ab374bf
4f8f86c
d589fd2
4cfec44
41d646b
c4724d5
411d675
3a12c6f
e8e5bba
35f0078
c1606c3
6f08939
04d8520
752030a
4051c70
4d90da7
6b93501
2e3c32a
8bbe6f7
3de7c47
a5d9ebe
eae5660
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<!-- | ||
@license Apache-2.0 | ||
Copyright (c) 2018 The Stdlib Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
# hyp2f1 | ||
|
||
> Evaluate Gaussian hypergeometric function | ||
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> | ||
|
||
<section class="intro"> | ||
|
||
The Gaussian hypergeometric function is defined as | ||
|
||
<!-- <equation class="equation" label="eq:gaussian_hypergeometric_function" align="center" raw="\operatorname{hyp2f1}(a,b,c,z) = \sum_{n=0}^{\infty} \frac{(a)_n (b)_n}{(c)_n} \frac{z^n}{n!}" alt="Equation for Gaussian hypergeometric function."> --> | ||
|
||
<div class="equation" align="center" data-raw-text="\operatorname{hyp2f1}(a,b,c,z) = \sum_{n=0}^{\infty} \frac{(a)_n (b)_n}{(c)_n} \frac{z^n}{n!}" data-equation="eq:gaussian_hypergeometric_function"> | ||
<img src="https://cdn.rawgit.com/stdlib-js/stdlib/65a72b6be80b988ebfa5e581849691524b01a533/lib/node_modules/@stdlib/math/base/special/hyp2f1/docs/img/equationgaussian_hypergeometric_function.svg" alt="Equation for Gaussian hypergeometric function."> | ||
<br> | ||
</div> | ||
|
||
<!-- </equation> --> | ||
|
||
</section> | ||
|
||
<!-- /.intro --> | ||
|
||
<!-- Package usage documentation. --> | ||
|
||
<section class="usage"> | ||
|
||
## Usage | ||
|
||
```javascript | ||
var hyp2f1 = require( '@stdlib/math/base/special/hyp2f1' ); | ||
``` | ||
|
||
#### hyp2f1( a, b, c, z ) | ||
|
||
Evaluates the Gaussian hypergeometric function. | ||
|
||
```javascript | ||
var v = hyp2f1( 1.0, 1.0, 1.0, 0.0 ); | ||
// returns 1.0 | ||
``` | ||
|
||
</section> | ||
|
||
<!-- /.usage --> | ||
|
||
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | ||
|
||
<section class="notes"> | ||
|
||
</section> | ||
|
||
<!-- /.notes --> | ||
|
||
<!-- Package usage examples. --> | ||
|
||
<section class="examples"> | ||
|
||
## Examples | ||
|
||
<!-- eslint no-undef: "error" --> | ||
|
||
```javascript | ||
var hyp2f1 = require( '@stdlib/math/base/special/hyp2f1' ); | ||
``` | ||
|
||
</section> | ||
|
||
<!-- /.examples --> | ||
|
||
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | ||
|
||
<section class="references"> | ||
|
||
</section> | ||
|
||
<!-- /.references --> | ||
|
||
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | ||
|
||
<section class="links"> | ||
|
||
</section> | ||
|
||
<!-- /.links --> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2018 The Stdlib Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// MODULES // | ||
|
||
var bench = require( '@stdlib/bench' ); | ||
var isnan = require( '@stdlib/random/base/randu' ); | ||
var pkg = require( './../package.json' ).name; | ||
var hyp2f1 = require( './../lib' ); | ||
|
||
|
||
// MAIN // | ||
|
||
bench( pkg, function benchmark( b ) { | ||
var i; | ||
var y; | ||
|
||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
y = hyp2f1( 1.0, 1.0, 1.0, 0.0 ); | ||
if ( isnan( y ) ) { | ||
b.fail( 'something went wrong' ); | ||
} | ||
} | ||
b.toc(); | ||
b.pass( 'benchmark finished' ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing a |
||
b.end(); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
{{alias}}( a, b, c, x ) | ||
TODO: short desc. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File needs updating. |
||
|
||
TODO: longer desc/bkgd. | ||
|
||
List: | ||
|
||
- item 1 | ||
- item 2 | ||
|
||
Parameters | ||
---------- | ||
a: number | ||
TODO: desc | ||
b: number | ||
c: number | ||
x: number | ||
|
||
Returns | ||
------- | ||
y: number | ||
TODO: desc | ||
|
||
Examples | ||
-------- | ||
> var TODO = {{alias}}() | ||
TODO: abbrev output | ||
|
||
References | ||
---------- | ||
- TODO: only include reference(s) if usage requires citation(s) | ||
|
||
See Also | ||
-------- | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2018 The Stdlib Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var hyp2f1 = require( './../lib' ); | ||
|
||
var y; | ||
|
||
y = hyp2f1( 1.0, 1.0, 1.0, 0.0 ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this file is currently being used to check that the implementation works. I'll leave this comment here as a TODO that this file needs updating (e.g., random values, etc). |
||
console.log( 'hyp2f1( 1.0, 1.0, 1.0, 0.0) = %d', y ); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2018 The Stdlib Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/** | ||
* Evaulation of Gaussian hypergoemetric function. | ||
* | ||
* @module @stdlib/math/base/special/hyp2f1 | ||
* | ||
* @example | ||
* var hyp2f1 = require( '@stdlib/math/base/special/hyp2f1' ); | ||
* | ||
* var v = hyp2f1( 1.0, 1.0, 1.0, 0.0 ); | ||
* // returns 1.0 | ||
*/ | ||
|
||
// MODULES // | ||
|
||
var hyp2f1 = require( './main.js' ); | ||
|
||
|
||
// EXPORTS // | ||
|
||
module.exports = hyp2f1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be updated once the
examples/index.js
file is complete.