diff --git a/lib/node_modules/@stdlib/math/base/special/heaviside/README.md b/lib/node_modules/@stdlib/math/base/special/heaviside/README.md index 394facdae803..6da2cb6e7421 100644 --- a/lib/node_modules/@stdlib/math/base/special/heaviside/README.md +++ b/lib/node_modules/@stdlib/math/base/special/heaviside/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2018 The Stdlib Authors. +Copyright (c) 2025 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. @@ -164,6 +164,105 @@ logEachMap( 'H(%0.4f) = %0.4f', x, heaviside ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/math/base/special/heaviside.h" +``` + +#### stdlib_base_heaviside( x ) + +Evaluate the [Heaviside function][heaviside-function]. + +```c +double out = stdlib_base_heaviside( 0.0, 0 ); +// returns 0.0 + +out = stdlib_base_heaviside( 3.141592653589793 / 2.0, 0 ); +// returns 1.0 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **continuity**: `[in] int` input value. + +```c +double stdlib_base_heaviside( const double x, int continuity ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/math/base/special/heaviside.h" +#include + +int main( void ) { + const double x[] = { 0.0, -0.523, 0.785, -1.047, 3.14 }; + + double y; + int i; + for ( i = 0; i < 5; i++ ) { + y = stdlib_base_heaviside( x[ i ], STDLIB_HEAVISIDE_CONTINUITY_HALF ); + printf( "heaviside(%lf, half-maximum) = %lf\n", x[ i ], y ); + } + + for ( i = 0; i < 5; i++ ) { + y = stdlib_base_heaviside( x[ i ], STDLIB_HEAVISIDE_CONTINUITY_LEFT ); + printf( "heaviside(%lf, left-continuous) = %lf\n", x[ i ], y ); + } + + for ( i = 0; i < 5; i++ ) { + y = stdlib_base_heaviside( x[ i ], STDLIB_HEAVISIDE_CONTINUITY_RIGHT ); + printf( "heaviside(%lf, right-continuous) = %lf\n", x[ i ], y ); + } +} +``` + +
+ + + +
+ + +