Skip to content

Commit 3d6fbfb

Browse files
committed
"added README file"
1 parent f16cdd5 commit 3d6fbfb

File tree

1 file changed

+213
-0
lines changed
  • lib/node_modules/@stdlib/math/base/special/cosc

1 file changed

+213
-0
lines changed
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2018 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# cosc
22+
23+
> Compute the [derivative of cardinal sine][cosc] of a number.
24+
25+
<section class="intro">
26+
27+
The normalized [derivative of cardinal sine][cosc] function is defined as
28+
29+
<!-- <equation class="equation" label="eq:cosc_function" align="center" raw="\operatorname{cosc}(x) := \begin{cases} \frac{{\operatorname{cos}(\pi x)}-\frac{\operatorname{sin}(\pi x)}{\pi x}}{x} & \textrm{if}\ x \neq 0 \\ 0 & \textrm{if}\ x = 0 \end{cases}" alt="Cosc function"> -->
30+
31+
```math
32+
\mathop{\mathrm{cosc}}(x) := \begin{cases} \frac {{\operatorname{cos}(\pi x)}-\frac{\operatorname{sin}(\pi x)}{\pi x}}{x} & \textrm{if}\ x \neq 0 \\ 0 & \textrm{if}\ x = 0 \end{cases}
33+
```
34+
35+
<!-- <div class="equation" align="center" data-raw-text="\operatorname{cosc}(x) := \begin{cases} \frac {{\operatorname{cos}(\pi x)}-\frac{\operatorname{sin}(\pi x)}{\pi x}}{x} &amp; \textrm{if}\ x \neq 0 \\ 0 &amp; \textrm{if}\ x = 0 \end{cases}" data-equation="eq:cosc_function">
36+
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bb29798906e119fcb2af99e94b60407a270c9b32/lib/node_modules/@stdlib/math/base/special/cosc/docs/img/equation_cosc_function.svg" alt="Cosc function">
37+
<br>
38+
</div> -->
39+
40+
<!-- </equation> -->
41+
42+
for any real number `x`.
43+
44+
</section>
45+
46+
<!-- /.intro -->
47+
48+
<section class="usage">
49+
50+
## Usage
51+
52+
```javascript
53+
var cosc = require( '@stdlib/math/base/special/cosc' );
54+
```
55+
56+
#### cosc( x )
57+
58+
Computes the normalized [cardinal cose][cosc] of a `number`.
59+
60+
```javascript
61+
var v = cosc( 0.5 );
62+
// returns ~0.637
63+
64+
v = cosc( -1.2 );
65+
// returns ~-0.156
66+
67+
v = cosc( 0.0 );
68+
// returns 1.0
69+
70+
v = cosc( NaN );
71+
// returns NaN
72+
```
73+
74+
</section>
75+
76+
<!-- /.usage -->
77+
78+
<section class="examples">
79+
80+
## Examples
81+
82+
<!-- eslint no-undef: "error" -->
83+
84+
```javascript
85+
var linspace = require( '@stdlib/array/base/linspace' );
86+
var cosc = require( '@stdlib/math/base/special/cosc' );
87+
88+
var x = linspace( -5.0, 5.0, 100 );
89+
90+
var i;
91+
for ( i = 0; i < x.length; i++ ) {
92+
console.log( cosc( x[ i ] ) );
93+
}
94+
```
95+
96+
</section>
97+
98+
<!-- /.examples -->
99+
100+
<!-- C interface documentation. -->
101+
102+
* * *
103+
104+
<section class="c">
105+
106+
## C APIs
107+
108+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
109+
110+
<section class="intro">
111+
112+
</section>
113+
114+
<!-- /.intro -->
115+
116+
<!-- C usage documentation. -->
117+
118+
<section class="usage">
119+
120+
### Usage
121+
122+
```c
123+
#include "stdlib/math/base/special/cosc.h"
124+
```
125+
126+
#### stdlib_base_cosc( x )
127+
128+
Computes the normalized [derivative of cardinal sine][cosc] of a `number`.
129+
130+
```c
131+
double y = stdlib_base_cosc( 0.5 );
132+
// returns ~-1.273
133+
```
134+
135+
The function accepts the following arguments:
136+
137+
- **x**: `[in] double` input value.
138+
139+
```c
140+
double stdlib_base_cosc( const double x );
141+
```
142+
143+
</section>
144+
145+
<!-- /.usage -->
146+
147+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
148+
149+
<section class="notes">
150+
151+
</section>
152+
153+
<!-- /.notes -->
154+
155+
<!-- C API usage examples. -->
156+
157+
<section class="examples">
158+
159+
### Examples
160+
161+
```c
162+
#include "stdlib/math/base/special/cosc.h"
163+
#include <stdio.h>
164+
165+
int main( void ) {
166+
const double x[] = { 0.0, 0.523, 0.785, 1.047, 3.14 };
167+
168+
double y;
169+
int i;
170+
for ( i = 0; i < 5; i++ ) {
171+
y = stdlib_base_cosc( x[ i ] );
172+
printf( "cosc(%lf) = %lf\n", x[ i ], y );
173+
}
174+
}
175+
```
176+
177+
</section>
178+
179+
<!-- /.examples -->
180+
181+
</section>
182+
183+
<!-- /.c -->
184+
185+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
186+
187+
<section class="related">
188+
189+
* * *
190+
191+
## See Also
192+
193+
- <span class="package-name">[`@stdlib/math/base/special/cos`][@stdlib/math/base/special/cos]</span><span class="delimiter">: </span><span class="description">compute the cos of a number.</span>
194+
195+
</section>
196+
197+
<!-- /.related -->
198+
199+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
200+
201+
<section class="links">
202+
203+
[cosc]: https://en.wikipedia.org/wiki/cosc_function
204+
205+
<!-- <related-links> -->
206+
207+
[@stdlib/math/base/special/cos]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/cos
208+
209+
<!-- </related-links> -->
210+
211+
</section>
212+
213+
<!-- /.links -->

0 commit comments

Comments
 (0)